Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions API/hermes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ if(APPLE AND HERMES_BUILD_APPLE_FRAMEWORK)
set_source_files_properties(${api_public_headers} PROPERTIES
MACOSX_PACKAGE_LOCATION Headers/Public
)
if(HERMES_ENABLE_BITCODE)
target_compile_options(libhermes PUBLIC "-fembed-bitcode")
target_link_libraries(libhermes PUBLIC "-fembed-bitcode")
endif()
endif()

install(TARGETS libhermes
Expand Down
3 changes: 3 additions & 0 deletions API/jsi/jsi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
# when they go out of scope due to exceptions.
list(APPEND jsi_compile_flags "/EHsc")
endif()
if (HERMES_ENABLE_BITCODE)
list(APPEND jsi_compile_flags "-fembed-bitcode")
endif ()
target_compile_options(jsi PUBLIC ${jsi_compile_flags})

install(DIRECTORY "${PROJECT_SOURCE_DIR}/API/jsi/" DESTINATION include
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ set(HERMES_ENABLE_THREAD_SANITIZER OFF CACHE BOOL
set(HERMES_ENABLE_FUZZING OFF CACHE BOOL
"Enable fuzzing")

# Enable bitcode
set(HERMES_ENABLE_BITCODE OFF CACHE BOOL
"Include bitcode with the framework")

# Set linker flag for building the fuzzer
set(HERMES_FUZZING_FLAG "-fsanitize=fuzzer" CACHE STRING
"Linker argument to link fuzz targets against a given fuzzer.")
Expand Down
3 changes: 3 additions & 0 deletions cmake/modules/Hermes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ function(add_hermes_library name)
target_link_libraries(${name} ${ARG_LINK_LIBS} ${HERMES_LINK_COMPONENTS})
set_property(TARGET ${name} PROPERTY POSITION_INDEPENDENT_CODE ON)
hermes_update_compile_flags(${name})
if (HERMES_ENABLE_BITCODE)
target_compile_options(${name} PUBLIC "-fembed-bitcode")
endif ()
endfunction(add_hermes_library)

function(add_hermes_executable name)
Expand Down
8 changes: 8 additions & 0 deletions utils/build-apple-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@ fi

# Utility function to configure an Apple framework
function configure_apple_framework {
local enable_bitcode
if [[ $1 == "macosx" ]]; then
enable_bitcode="false"
else
enable_bitcode="true"
fi

local cmake_flags=" \
-DHERMES_APPLE_TARGET_PLATFORM:STRING=$1 \
-DCMAKE_OSX_ARCHITECTURES:STRING=$2 \
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=$3 \
-DHERMES_ENABLE_DEBUGGER:BOOLEAN=true \
-DHERMES_ENABLE_FUZZING:BOOLEAN=false \
-DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false \
-DHERMES_ENABLE_BITCODE:BOOLEAN=$enable_bitcode \
-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=true \
-DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true
-DCMAKE_INSTALL_PREFIX:PATH=../destroot"
Expand Down