From a53c1bfe8b3722113328d62ba20f06d6f0ea08f7 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 5 Apr 2020 14:04:10 +0100 Subject: [PATCH] CMake logic to export debug symbols --- CMakeLists.txt | 3 ++- CMakeModules/ExportDebugSymbols.cmake | 26 ++++++++++++++++++++++++++ simgear/CMakeLists.txt | 3 +++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 CMakeModules/ExportDebugSymbols.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c7ee245..33eb6c2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 # 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) # read 'version' file into a variable (stripping any newlines or spaces) @@ -137,6 +137,7 @@ if (NOT ENABLE_SIMD AND ENABLE_SIMD_CODE) endif() include (DetectArch) +include (ExportDebugSymbols) # until the fstream fix is applied and generally available in OSG, # keep the compatability link option as the default diff --git a/CMakeModules/ExportDebugSymbols.cmake b/CMakeModules/ExportDebugSymbols.cmake new file mode 100644 index 00000000..2a522abe --- /dev/null +++ b/CMakeModules/ExportDebugSymbols.cmake @@ -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 $ + DEPENDS $ + ) + + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM DESTINATION symbols OPTIONAL) + + add_dependencies(debug_symbols ${target}.dSYM) + endif() + +endfunction() \ No newline at end of file diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index 92cb7bab..8162cea3 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -65,6 +65,9 @@ if(SIMGEAR_SHARED) set_property(TARGET SimGearScene PROPERTY VERSION ${SIMGEAR_VERSION}) set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION}) endif() + + export_debug_symbols(SimGearCore) + export_debug_symbols(SimGearScene) else() message(STATUS "Library building mode: STATIC LIBRARIES")