diff --git a/API/hermes/CMakeLists.txt b/API/hermes/CMakeLists.txt index 08fc998038e..dc4f4e20d6b 100644 --- a/API/hermes/CMakeLists.txt +++ b/API/hermes/CMakeLists.txt @@ -134,7 +134,7 @@ install(DIRECTORY "${PROJECT_SOURCE_DIR}/API/hermes" DESTINATION include # Create debug symbols (dSYM) bundle for Apple platform dylibs/frameworks # Largely inspired by https://github.com/llvm/llvm-project/blob/6701993027f8af172d7ba697884459261b00e3c6/llvm/cmake/modules/AddLLVM.cmake#L1934-L1986 -if(APPLE AND CMAKE_CXX_FLAGS MATCHES "-gdwarf") +if(HERMES_BUILD_APPLE_DSYM) if(CMAKE_CXX_FLAGS MATCHES "-flto") set(lto_object ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libhermes-lto.o) set_property(TARGET libhermes APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-object_path_lto,${lto_object}") diff --git a/CMakeLists.txt b/CMakeLists.txt index 79ccb541da1..e5cb5b7f17c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,6 +214,9 @@ set(HERMES_ENABLE_TEST_SUITE ON CACHE BOOL set(HERMES_BUILD_APPLE_FRAMEWORK ON CACHE BOOL "Whether to build the libhermes target as a framework bundle or dylib on Apple platforms") +set(HERMES_BUILD_APPLE_DSYM OFF CACHE BOOL + "Whether to build a DWARF debugging symbols bundle") + if (HERMES_IS_ANDROID) set(HERMES_IS_MOBILE_BUILD TRUE) @@ -237,6 +240,10 @@ if (HERMES_IS_ANDROID) endif() endif() +if(HERMES_BUILD_APPLE_DSYM) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf") +endif() + if (HERMES_IS_MOBILE_BUILD) add_definitions(-DHERMES_IS_MOBILE_BUILD) endif() @@ -695,7 +702,8 @@ add_custom_target( add_custom_target( hermes-runtime-darwin-cocoapods-release - DEPENDS install + COMMAND + ${CMAKE_COMMAND} --build . --target install/strip COMMAND mkdir -p ${HERMES_GITHUB_DIR}/package-root COMMAND diff --git a/hermes.podspec b/hermes.podspec index 7ac47cef317..a635714d6db 100644 --- a/hermes.podspec +++ b/hermes.podspec @@ -12,7 +12,7 @@ module HermesHelper end def self.cmake_configuration - "-DHERMES_ENABLE_DEBUGGER:BOOLEAN=true -DHERMES_ENABLE_FUZZING:BOOLEAN=false -DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false" + "-DHERMES_ENABLE_DEBUGGER:BOOLEAN=true -DHERMES_ENABLE_FUZZING:BOOLEAN=false -DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false -DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=true -DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true" end def self.configure_command @@ -41,9 +41,9 @@ Pod::Spec.new do |spec| if [ ! -d destroot/Library/Frameworks/hermes.framework ]; then if #{HermesHelper.command_exists?("cmake")}; then if #{HermesHelper.command_exists?("ninja")}; then - #{HermesHelper.configure_command} --build-system='Ninja' && cd build && ninja install + #{HermesHelper.configure_command} --build-system='Ninja' && cd build && ninja install/strip else - #{HermesHelper.configure_command} --build-system='Unix Makefiles' && cd build && make install + #{HermesHelper.configure_command} --build-system='Unix Makefiles' && cd build && make install/strip fi else echo >&2 'CMake is required to install Hermes, install it with: brew install cmake'