2018-07-21 22:26:07 +00:00
|
|
|
|
|
|
|
function(dsym target)
|
2018-07-31 15:20:36 +00:00
|
|
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type)
|
|
|
|
if (DSYMUTIL_EXE AND build_type MATCHES debug)
|
2018-07-21 22:26:07 +00:00
|
|
|
|
2018-07-31 15:20:36 +00:00
|
|
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" DEPENDS "${target}" COMMAND ${CMAKE_COMMAND} -E env
|
2018-07-30 10:22:45 +00:00
|
|
|
"PATH=${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/misc:$ENV{PATH}"
|
|
|
|
"${DSYMUTIL_EXE}" "-flat" "-o" "${target}.dSYM" "$<TARGET_FILE:${target}>")
|
2018-07-21 22:26:07 +00:00
|
|
|
|
2018-07-31 15:20:36 +00:00
|
|
|
add_custom_target("${target}-dSYM" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" getuuid lipo)
|
2018-07-30 10:22:45 +00:00
|
|
|
|
2018-07-21 22:26:07 +00:00
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" DESTINATION "${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/Caches/dsym/files")
|
|
|
|
install(DIRECTORY DESTINATION "${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/Caches/dsym/uuid")
|
|
|
|
|
|
|
|
install(CODE "execute_process(COMMAND \"${CMAKE_BINARY_DIR}/src/DebugSymbols/getuuid/getuuid\" \"${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM\" RESULT_VARIABLE getuuid_result OUTPUT_VARIABLE macho_uuid)
|
|
|
|
|
|
|
|
if (NOT \${getuuid_result} EQUAL 0)
|
|
|
|
message(WARNING \"Cannot determine UUID of ${target}\")
|
|
|
|
else()
|
|
|
|
# message(STATUS \"Installing dsym for ${target}\")
|
|
|
|
foreach (uuid \${macho_uuid})
|
|
|
|
# message(STATUS \" UUID \${uuid}\")
|
|
|
|
|
|
|
|
execute_process(COMMAND \"${CMAKE_COMMAND}\" -E create_symlink
|
|
|
|
\"../files/${target}.dSYM\"
|
|
|
|
\$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/Caches/dsym/uuid/\${uuid}.dSYM)
|
|
|
|
endforeach (uuid)
|
|
|
|
endif()
|
|
|
|
")
|
2018-07-30 15:16:44 +00:00
|
|
|
endif ()
|
2018-07-21 22:26:07 +00:00
|
|
|
|
|
|
|
endfunction(dsym)
|
|
|
|
|
|
|
|
function(FindDsymutil)
|
2018-07-31 15:20:36 +00:00
|
|
|
# llvm-dsymutil-4.0 is not listed, because it's very buggy
|
|
|
|
find_program(DSYMUTIL_EXE NAMES "llvm-dsymutil" "dsymutil" "llvm-dsymutil-7.0" "llvm-dsymutil-6.0" "llvm-dsymutil-5.0" "llvm-dsymutil-3.9" "llvm-dsymutil-3.8" "llvm-dsymutil-3.7")
|
2018-07-21 22:26:07 +00:00
|
|
|
if (DSYMUTIL_EXE)
|
|
|
|
message(STATUS "Found dsymutil: ${DSYMUTIL_EXE}")
|
|
|
|
else (DSYMUTIL_EXE)
|
|
|
|
message(WARNING "Cannot find llvm-dsymutil, will not produce debug information")
|
|
|
|
endif (DSYMUTIL_EXE)
|
|
|
|
endfunction(FindDsymutil)
|