mirror of
https://github.com/darlinghq/darling.git
synced 2024-11-23 12:19:43 +00:00
1edcfebc27
This change allows you to build multiple components and still choose to install only some of them using CMake's `cmake_install.cmake` script.
51 lines
2.3 KiB
CMake
51 lines
2.3 KiB
CMake
|
|
function(dsym target)
|
|
cmake_parse_arguments(DSYM "EXCLUDE_FROM_ALL" "" "" ${ARGN})
|
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type)
|
|
|
|
if (DSYM_EXCLUDE_FROM_ALL)
|
|
set(EXCLUDE_FROM_ALL_ARG "EXCLUDE_FROM_ALL")
|
|
else()
|
|
set(EXCLUDE_FROM_ALL_ARG "")
|
|
endif()
|
|
|
|
if (DSYMUTIL_EXE AND build_type MATCHES debug)
|
|
|
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" DEPENDS "${target}" COMMAND ${CMAKE_COMMAND} -E env
|
|
"PATH=${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/misc:$ENV{PATH}"
|
|
"${DSYMUTIL_EXE}" "-flat" "-o" "${target}.dSYM" "$<TARGET_FILE:${target}>")
|
|
|
|
add_custom_target("${target}-dSYM" ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" getuuid lipo)
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}.dSYM" DESTINATION "${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/Caches/dsym/files" ${EXCLUDE_FROM_ALL_ARG})
|
|
install(DIRECTORY DESTINATION "${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/Caches/dsym/uuid" ${EXCLUDE_FROM_ALL_ARG})
|
|
|
|
install(CODE "execute_process(COMMAND \"${CMAKE_BINARY_DIR}/src/buildtools/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()
|
|
" ${EXCLUDE_FROM_ALL_ARG})
|
|
endif ()
|
|
|
|
endfunction(dsym)
|
|
|
|
function(FindDsymutil)
|
|
# llvm-dsymutil-4.0 is not listed, because it's very buggy
|
|
find_program(DSYMUTIL_EXE NAMES "llvm-dsymutil" "dsymutil" "dsymutil-7" "llvm-dsymutil-7.0" "llvm-dsymutil-6.0" "llvm-dsymutil-5.0" "llvm-dsymutil-3.9" "llvm-dsymutil-3.8" "llvm-dsymutil-3.7" "dsymutil-10 dsymutil-11 dsymutil-12 dsymutil-13 dsymutil-14 dsymutil-15 dsymutil-16")
|
|
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)
|