Skip to content

Commit 83f4741

Browse files
hramosfacebook-github-bot
authored andcommitted
Hermes: Always use Unix Makefiles for Apple build, and use all available cores
Summary: Hermes' build scripts use the Ninja build utility if available, otherwise they default to Unix Makefiles. When Unix Makefiles were used, builds would take far too long due to the use of a single core. To reduce the surface area of issues that may arise as we switch to building Hermes from source, we will now focus on a single build system using Unix Makefiles. We will also ensure all available cores are used when building on macOS. Changelog: [Internal] Reviewed By: cortinico, neildhar Differential Revision: D36296838 fbshipit-source-id: 4be23739fb022e3ae8e974ad3c2c70e7011abb5a
1 parent ae28880 commit 83f4741

File tree

2 files changed

+8
-26
lines changed

2 files changed

+8
-26
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ jobs:
417417
- with_brew_cache_span:
418418
steps:
419419
- brew_install:
420-
package: cmake ninja
420+
package: cmake
421421

422422
- run:
423423
name: Setup the CocoaPods environment
@@ -474,7 +474,7 @@ jobs:
474474
- with_brew_cache_span:
475475
steps:
476476
- brew_install:
477-
package: watchman cmake ninja
477+
package: watchman cmake
478478
- run:
479479
name: "Brew: Tap wix/brew"
480480
command: brew tap wix/brew >/dev/null
@@ -745,7 +745,7 @@ jobs:
745745
- with_brew_cache_span:
746746
steps:
747747
- brew_install:
748-
package: cmake ninja
748+
package: cmake
749749

750750
- run:
751751
name: Install CocoaPods dependencies
@@ -999,7 +999,7 @@ jobs:
999999
- run:
10001000
name: Install dependencies
10011001
command: |
1002-
brew install cmake ninja
1002+
brew install cmake
10031003
- run:
10041004
name: Build HermesC for macOS
10051005
command: |

sdks/hermes-engine/utils/build-apple-framework.sh

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,7 @@ else
1010
BUILD_TYPE="Release"
1111
fi
1212

13-
function command_exists {
14-
command -v "${1}" > /dev/null 2>&1
15-
}
16-
17-
if command_exists "cmake"; then
18-
if command_exists "ninja"; then
19-
BUILD_SYSTEM="Ninja"
20-
else
21-
BUILD_SYSTEM="Unix Makefiles"
22-
fi
23-
else
24-
echo >&2 'CMake is required to install Hermes, install it with: brew install cmake'
25-
exit 1
26-
fi
13+
NUM_CORES=$(sysctl -n hw.ncpu)
2714

2815
function get_release_version {
2916
ruby -rcocoapods-core -rjson -e "puts Pod::Specification.from_file('hermes-engine.podspec').version"
@@ -40,7 +27,7 @@ function get_mac_deployment_target {
4027
# Build host hermes compiler for internal bytecode
4128
function build_host_hermesc {
4229
cmake -S . -B build_host_hermesc
43-
cmake --build ./build_host_hermesc --target hermesc
30+
cmake --build ./build_host_hermesc --target hermesc -j ${NUM_CORES}
4431
}
4532

4633
# Utility function to configure an Apple framework
@@ -58,7 +45,7 @@ function configure_apple_framework {
5845
build_cli_tools="false"
5946
fi
6047

61-
cmake -S . -B "build_$1" -G "$BUILD_SYSTEM" \
48+
cmake -S . -B "build_$1" \
6249
-DHERMES_APPLE_TARGET_PLATFORM:STRING="$1" \
6350
-DCMAKE_OSX_ARCHITECTURES:STRING="$2" \
6451
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$3" \
@@ -84,12 +71,7 @@ function build_apple_framework {
8471
echo "Host hermesc is required to build apple frameworks!"
8572

8673
configure_apple_framework "$1" "$2" "$3"
87-
88-
if [[ "$BUILD_SYSTEM" == "Ninja" ]]; then
89-
(cd "./build_$1" && ninja install/strip)
90-
else
91-
(cd "./build_$1" && make install/strip)
92-
fi
74+
cmake --build "./build_$1" --target install/strip -j ${NUM_CORES}
9375
}
9476

9577
# Accepts an array of frameworks and will place all of

0 commit comments

Comments
 (0)