Skip to content

Commit c631332

Browse files
cortinicofacebook-github-bot
authored andcommitted
Correctly set -DCMAKE_BUILD_TYPE for Hermes on iOS
Summary: We accidentally added `-DCMAKE_BUILD_TYPE=Debug` for Hermes which is causing a really slow engine execution. This fixes it and keep the -DCMAKE_BUILD_TYPE aligned with the one used on Android. Changelog: [iOS] [Fixed] - Correctly set -DCMAKE_BUILD_TYPE for Hermes on iOS Reviewed By: hramos, cipolleschi Differential Revision: D40980934 fbshipit-source-id: 30f0455990a911b51eb109bebca8272507302650
1 parent f8a2dd7 commit c631332

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function build_host_hermesc {
5252

5353
# Utility function to configure an Apple framework
5454
function configure_apple_framework {
55-
local build_cli_tools enable_bitcode enable_debugger
55+
local build_cli_tools enable_bitcode enable_debugger cmake_build_type
5656

5757
if [[ $1 == iphoneos || $1 == catalyst ]]; then
5858
enable_bitcode="true"
@@ -69,6 +69,13 @@ function configure_apple_framework {
6969
else
7070
enable_debugger="false"
7171
fi
72+
if [[ $BUILD_TYPE == "Debug" ]]; then
73+
# JS developers aren't VM developers.
74+
# Therefore we're passing as build type Release, to provide a faster build.
75+
cmake_build_type="Release"
76+
else
77+
cmake_build_type="MinSizeRel"
78+
fi
7279

7380
pushd "$HERMES_PATH" > /dev/null || exit 1
7481
cmake -S . -B "build_$1" \
@@ -88,7 +95,7 @@ function configure_apple_framework {
8895
-DJSI_DIR="$JSI_PATH" \
8996
-DHERMES_RELEASE_VERSION="for RN $(get_release_version)" \
9097
-DCMAKE_INSTALL_PREFIX:PATH=../destroot \
91-
-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
98+
-DCMAKE_BUILD_TYPE="$cmake_build_type"
9299
popd > /dev/null || exit 1
93100
}
94101

sdks/hermes-engine/utils/build-hermes-xcode.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
1919
enable_debugger="true"
2020
fi
2121

22+
cmake_build_type=""
23+
if [[ $CONFIGURATION == "Debug" ]]; then
24+
# JS developers aren't VM developers.
25+
# Therefore we're passing as build type Release, to provide a faster build.
26+
cmake_build_type="Release"
27+
else
28+
cmake_build_type="MinSizeRel"
29+
fi
30+
2231
deployment_target=${IPHONEOS_DEPLOYMENT_TARGET}
2332
if [ -z "$deployment_target" ]; then
2433
deployment_target=${MACOSX_DEPLOYMENT_TARGET}
@@ -46,7 +55,7 @@ echo "Configure Apple framework"
4655
-DIMPORT_HERMESC:PATH="${hermesc_path}" \
4756
-DHERMES_RELEASE_VERSION="for RN $release_version" \
4857
-DCMAKE_INSTALL_PREFIX:PATH="${PODS_ROOT}/hermes-engine/destroot" \
49-
-DCMAKE_BUILD_TYPE="$CONFIGURATION"
58+
-DCMAKE_BUILD_TYPE="$cmake_build_type"
5059

5160
echo "Build Apple framework"
5261

0 commit comments

Comments
 (0)