Skip to content

Commit

Permalink
Remove dSYM generation from CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
piaskowyk committed Dec 16, 2024
1 parent 5e41c57 commit 30262f4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 38 deletions.
9 changes: 1 addition & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ set(CMAKE_OSX_SYSROOT ${HERMES_APPLE_TARGET_PLATFORM})

if(HERMES_APPLE_TARGET_PLATFORM MATCHES "catalyst")
set(CMAKE_OSX_SYSROOT "macosx")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-target x86_64-arm64-apple-ios14.0-macabi -isystem ${CMAKE_OSX_SYSROOT}/System/iOSSupport/usr/include")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -target x86_64-arm64-apple-ios14.0-macabi -isystem ${CMAKE_OSX_SYSROOT}/System/iOSSupport/usr/include")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-target x86_64-arm64-apple-ios14.0-macabi -isystem ${CMAKE_OSX_SYSROOT}/System/iOSSupport/usr/include")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
Expand Down Expand Up @@ -279,9 +279,6 @@ set(HERMES_ENABLE_TEST_SUITE ON CACHE BOOL
set(HERMES_BUILD_APPLE_FRAMEWORK OFF 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")

set(HERMES_BUILD_NODE_HERMES OFF CACHE BOOL "Whether to build node-hermes")

set(HERMES_BUILD_LEAN_LIBHERMES OFF CACHE BOOL "Exclude the Hermes compiler from libhermes.")
Expand Down Expand Up @@ -321,10 +318,6 @@ if(HERMES_CHECK_NATIVE_STACK)
add_definitions(-DHERMES_CHECK_NATIVE_STACK)
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()
Expand Down
29 changes: 0 additions & 29 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,35 +205,6 @@ if(APPLE AND HERMES_BUILD_APPLE_FRAMEWORK)
endif()
endif()

# 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(HERMES_BUILD_APPLE_DSYM)
if(CMAKE_CXX_FLAGS MATCHES "-flto")
set(lto_object ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/hermesvm-lto.o)
set_property(TARGET hermesvm APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-object_path_lto,${lto_object}")
endif()

get_target_property(DSYM_PATH hermesvm LOCATION)
if(HERMES_BUILD_APPLE_FRAMEWORK)
get_filename_component(DSYM_PATH ${DSYM_PATH} DIRECTORY)
endif()
set(DSYM_PATH "${DSYM_PATH}.dSYM")

if(NOT CMAKE_DSYMUTIL)
set(CMAKE_DSYMUTIL xcrun dsymutil)
endif()
add_custom_command(TARGET hermesvm POST_BUILD
COMMAND ${CMAKE_DSYMUTIL} $<TARGET_FILE:hermesvm> --out ${DSYM_PATH}
BYPRODUCTS ${DSYM_PATH}
)

if(HERMES_BUILD_APPLE_FRAMEWORK)
install(DIRECTORY ${DSYM_PATH} DESTINATION Library/Frameworks/${HERMES_APPLE_TARGET_PLATFORM})
else()
install(DIRECTORY ${DSYM_PATH} DESTINATION lib)
endif()
endif()

# Force the entire hermesvm_a library to be used by hermesvm. There is
# no cross platform way to do this (force_load is for macOS). Once we upgrade
# CMake 3.24, we can use the LINK_LIBRARY generator expression to do this.
Expand Down
2 changes: 1 addition & 1 deletion utils/build-apple-framework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function configure_apple_framework {
-DHERMES_ENABLE_FUZZILLI:BOOLEAN=false \
-DHERMES_ENABLE_TEST_SUITE:BOOLEAN=false \
-DHERMES_BUILD_APPLE_FRAMEWORK:BOOLEAN=true \
-DHERMES_BUILD_APPLE_DSYM:BOOLEAN=true \
-DCMAKE_CXX_FLAGS="-gdwarf ${CMAKE_CXX_FLAGS}" \
-DHERMES_ENABLE_TOOLS:BOOLEAN="$build_cli_tools" \
-DIMPORT_HERMESC:PATH="$PWD/build_host_hermesc/ImportHermesc.cmake" \
-DCMAKE_INSTALL_PREFIX:PATH=../destroot \
Expand Down

0 comments on commit 30262f4

Please sign in to comment.