| 1 |
|
| 2 |
|
| 3 |
# placehodler target for other ones to depend upon |
| 4 |
if (NOT TARGET debug_symbols) |
| 5 |
add_custom_target(debug_symbols) |
| 6 |
endif() |
| 7 |
|
| 8 |
function(export_debug_symbols target) |
| 9 |
|
| 10 |
if (APPLE) |
| 11 |
# workaround because we adjust the bundle name in some cases, and |
| 12 |
# TARGET_FILE seems to have a bug of assuming the executable name matches |
| 13 |
if (isBundle) |
| 14 |
add_custom_target(${target}.dSYM |
| 15 |
COMMENT "Generating dSYM files for ${target}" |
| 16 |
COMMAND dsymutil --out=${CMAKE_BINARY_DIR}/symbols/${target}.dSYM $<TARGET_BUNDLE_CONTENT_DIR:${target}>/MacOS/$<TARGET_NAME:${target}> |
| 17 |
DEPENDS ${target} |
| 18 |
) |
| 19 |
else() |
| 20 |
add_custom_target(${target}.dSYM |
| 21 |
COMMENT "Generating dSYM files for ${target}" |
| 22 |
COMMAND dsymutil --out=${CMAKE_BINARY_DIR}/symbols/${target}.dSYM $<TARGET_FILE:${target}> |
| 23 |
DEPENDS ${target} |
| 24 |
) |
| 25 |
endif() |
| 26 |
|
| 27 |
install(DIRECTORY ${CMAKE_BINARY_DIR}/symbols/${target}.dSYM |
| 28 |
DESTINATION symbols OPTIONAL |
| 29 |
COMPONENT symbols EXCLUDE_FROM_ALL) |
| 30 |
|
| 31 |
add_dependencies(debug_symbols ${target}.dSYM) |
| 32 |
endif() |
| 33 |
|
| 34 |
if (MSVC) |
| 35 |
set_property(TARGET ${target} PROPERTY PDB_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/symbols) |
| 36 |
install(FILES $<TARGET_PDB_FILE:${target}> |
| 37 |
DESTINATION symbols OPTIONAL |
| 38 |
COMPONENT symbols EXCLUDE_FROM_ALL) |
| 39 |
endif() |
| 40 |
endfunction() |
| 41 |
|
| 42 |
|
| 43 |
file(TO_NATIVE_PATH "${FINAL_MSVC_3RDPARTY_DIR}/bin" _msvc_3rdparty_bin_dir) |
| 44 |
set(CMAKE_MSVCIDE_RUN_PATH "${_msvc_3rdparty_bin_dir}") |
| 45 |
|
| 46 |
if (FG_BUILD_TYPE STREQUAL "Release") |
| 47 |
add_custom_target(upload_debug_symbols |
| 48 |
COMMENT "Uploading debug symbols via sentry-cli" |
| 49 |
COMMAND sentry-cli upload-dif --org flightgear --project flightgear ${CMAKE_BINARY_DIR}/symbols |
| 50 |
) |
| 51 |
|
| 52 |
add_dependencies(upload_debug_symbols debug_symbols) |
| 53 |
else() |
| 54 |
# make a dummy target to keep CI simple, but it doesn't do anything |
| 55 |
add_custom_target(upload_debug_symbols |
| 56 |
COMMENT "Non-release FG_BUILD_TYPE: symbol upload is disabled" |
| 57 |
) |
| 58 |
endif() |
| 59 |
|
| 60 |
|