CMake logic to export debug symbols

This commit is contained in:
James Turner 2020-04-05 14:04:10 +01:00
parent 6185b8fd0d
commit a53c1bfe8b
3 changed files with 31 additions and 1 deletions

View File

@ -39,7 +39,7 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment ver
# let's use & require C++11 - note these are only functional with CMake 3.1 # let's use & require C++11 - note these are only functional with CMake 3.1
# we do manual fallbacks for CMake 3.0 in the compilers section # we do manual fallbacks for CMake 3.0 in the compilers section
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_STANDARD_REQUIRED YES)
# read 'version' file into a variable (stripping any newlines or spaces) # read 'version' file into a variable (stripping any newlines or spaces)
@ -137,6 +137,7 @@ if (NOT ENABLE_SIMD AND ENABLE_SIMD_CODE)
endif() endif()
include (DetectArch) include (DetectArch)
include (ExportDebugSymbols)
# until the fstream fix is applied and generally available in OSG, # until the fstream fix is applied and generally available in OSG,
# keep the compatability link option as the default # keep the compatability link option as the default

View File

@ -0,0 +1,26 @@
# placehodler target for other ones to depend upon
add_custom_target(
debug_symbols
)
function(export_debug_symbols target)
if (NOT SIMGEAR_SHARED)
return()
endif()
if (APPLE)
add_custom_target(${target}.dSYM
COMMENT "Generating dSYM files for ${target}"
COMMAND dsymutil --out=${target}.dSYM $<TARGET_FILE:${target}>
DEPENDS $<TARGET_FILE:${target}>
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM DESTINATION symbols OPTIONAL)
add_dependencies(debug_symbols ${target}.dSYM)
endif()
endfunction()

View File

@ -65,6 +65,9 @@ if(SIMGEAR_SHARED)
set_property(TARGET SimGearScene PROPERTY VERSION ${SIMGEAR_VERSION}) set_property(TARGET SimGearScene PROPERTY VERSION ${SIMGEAR_VERSION})
set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION}) set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
endif() endif()
export_debug_symbols(SimGearCore)
export_debug_symbols(SimGearScene)
else() else()
message(STATUS "Library building mode: STATIC LIBRARIES") message(STATUS "Library building mode: STATIC LIBRARIES")