Skip to content

Commit c1cd032

Browse files
committed
feat: include macOS slice in Hermes xcframework
Add macOS ("macosx") as a platform in build-ios-framework.sh so the universal Hermes xcframework includes a native macOS slice. Previously, macOS was built separately by build-mac-framework.sh but not included in the xcframework. Changes: - Add "macosx" to create_universal_framework and create_framework - Add macosx to get_architecture (x86_64;arm64) and get_deployment_target - Make HERMES_PATH overridable via env var in build-apple-framework.sh
1 parent a885ae6 commit c1cd032

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CURR_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
1212
IMPORT_HERMESC_PATH=${HERMES_OVERRIDE_HERMESC_PATH:-$PWD/build_host_hermesc/ImportHermesc.cmake}
1313
BUILD_TYPE=${BUILD_TYPE:-Debug}
1414

15-
HERMES_PATH="$CURR_SCRIPT_DIR/.."
15+
HERMES_PATH=${HERMES_PATH:-"$CURR_SCRIPT_DIR/.."}
1616
REACT_NATIVE_PATH=${REACT_NATIVE_PATH:-$CURR_SCRIPT_DIR/../../..}
1717

1818
NUM_CORES=$(sysctl -n hw.ncpu)

packages/react-native/sdks/hermes-engine/utils/build-ios-framework.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010
set -e
1111

1212
# Given a specific target, retrieve the right architecture for it
13-
# $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst, xros, xrsimulator
13+
# $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst, macosx, xros, xrsimulator
1414
function get_architecture {
1515
if [[ $1 == "iphoneos" || $1 == "xros" ]]; then
1616
echo "arm64"
@@ -20,7 +20,7 @@ function get_architecture {
2020
echo "arm64"
2121
elif [[ $1 == "appletvsimulator" ]]; then
2222
echo "x86_64;arm64"
23-
elif [[ $1 == "catalyst" ]]; then
23+
elif [[ $1 == "catalyst" || $1 == "macosx" ]]; then
2424
echo "x86_64;arm64"
2525
else
2626
echo "Error: unknown architecture passed $1"
@@ -29,7 +29,9 @@ function get_architecture {
2929
}
3030

3131
function get_deployment_target {
32-
if [[ $1 == "xros" || $1 == "xrsimulator" ]]; then
32+
if [[ $1 == "macosx" ]]; then
33+
echo "$(get_mac_deployment_target)"
34+
elif [[ $1 == "xros" || $1 == "xrsimulator" ]]; then
3335
echo "$(get_visionos_deployment_target)"
3436
else # tvOS and iOS use the same deployment target
3537
echo "$(get_ios_deployment_target)"
@@ -53,7 +55,7 @@ function build_framework {
5355
# group the frameworks together to create a universal framework
5456
function build_universal_framework {
5557
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
56-
create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator"
58+
create_universal_framework "macosx" "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator"
5759
else
5860
echo "Skipping; Clean \"destroot\" to rebuild".
5961
fi
@@ -63,6 +65,7 @@ function build_universal_framework {
6365
# this is used to preserve backward compatibility
6466
function create_framework {
6567
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
68+
build_framework "macosx"
6669
build_framework "iphoneos"
6770
build_framework "iphonesimulator"
6871
build_framework "appletvos"

0 commit comments

Comments
 (0)