Skip to content

Commit

Permalink
Correctly set -DCMAKE_BUILD_TYPE for Hermes on iOS
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cortinico authored and facebook-github-bot committed Nov 3, 2022
1 parent f8a2dd7 commit c631332
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 9 additions & 2 deletions sdks/hermes-engine/utils/build-apple-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function build_host_hermesc {

# Utility function to configure an Apple framework
function configure_apple_framework {
local build_cli_tools enable_bitcode enable_debugger
local build_cli_tools enable_bitcode enable_debugger cmake_build_type

if [[ $1 == iphoneos || $1 == catalyst ]]; then
enable_bitcode="true"
Expand All @@ -69,6 +69,13 @@ function configure_apple_framework {
else
enable_debugger="false"
fi
if [[ $BUILD_TYPE == "Debug" ]]; then
# JS developers aren't VM developers.
# Therefore we're passing as build type Release, to provide a faster build.
cmake_build_type="Release"
else
cmake_build_type="MinSizeRel"
fi

pushd "$HERMES_PATH" > /dev/null || exit 1
cmake -S . -B "build_$1" \
Expand All @@ -88,7 +95,7 @@ function configure_apple_framework {
-DJSI_DIR="$JSI_PATH" \
-DHERMES_RELEASE_VERSION="for RN $(get_release_version)" \
-DCMAKE_INSTALL_PREFIX:PATH=../destroot \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE"
-DCMAKE_BUILD_TYPE="$cmake_build_type"
popd > /dev/null || exit 1
}

Expand Down
11 changes: 10 additions & 1 deletion sdks/hermes-engine/utils/build-hermes-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
enable_debugger="true"
fi

cmake_build_type=""
if [[ $CONFIGURATION == "Debug" ]]; then
# JS developers aren't VM developers.
# Therefore we're passing as build type Release, to provide a faster build.
cmake_build_type="Release"
else
cmake_build_type="MinSizeRel"
fi

deployment_target=${IPHONEOS_DEPLOYMENT_TARGET}
if [ -z "$deployment_target" ]; then
deployment_target=${MACOSX_DEPLOYMENT_TARGET}
Expand Down Expand Up @@ -46,7 +55,7 @@ echo "Configure Apple framework"
-DIMPORT_HERMESC:PATH="${hermesc_path}" \
-DHERMES_RELEASE_VERSION="for RN $release_version" \
-DCMAKE_INSTALL_PREFIX:PATH="${PODS_ROOT}/hermes-engine/destroot" \
-DCMAKE_BUILD_TYPE="$CONFIGURATION"
-DCMAKE_BUILD_TYPE="$cmake_build_type"

echo "Build Apple framework"

Expand Down

0 comments on commit c631332

Please sign in to comment.