mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[CMake] Add option LLVM_EXTERNALIZE_DEBUGINFO
Summary: This adds support for generating dSYM files and stripping debug info from executables and dylibs. It also supports passing -object_path_lto to the linker to generate dSYMs for LTO builds. Reviewers: bogner, friss Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D15133 llvm-svn: 254627
This commit is contained in:
parent
0fc2f90156
commit
fa052602ba
@ -301,6 +301,9 @@ endif( LLVM_USE_INTEL_JITEVENTS )
|
|||||||
option(LLVM_USE_OPROFILE
|
option(LLVM_USE_OPROFILE
|
||||||
"Use opagent JIT interface to inform OProfile about JIT code" OFF)
|
"Use opagent JIT interface to inform OProfile about JIT code" OFF)
|
||||||
|
|
||||||
|
option(LLVM_EXTERNALIZE_DEBUGINFO
|
||||||
|
"Generate dSYM files and strip executables and libraries (Darwin Only)" OFF)
|
||||||
|
|
||||||
# If enabled, verify we are on a platform that supports oprofile.
|
# If enabled, verify we are on a platform that supports oprofile.
|
||||||
if( LLVM_USE_OPROFILE )
|
if( LLVM_USE_OPROFILE )
|
||||||
if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )
|
if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )
|
||||||
|
@ -512,6 +512,10 @@ function(llvm_add_library name)
|
|||||||
add_dependencies(${objlib} ${LLVM_COMMON_DEPENDS})
|
add_dependencies(${objlib} ${LLVM_COMMON_DEPENDS})
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ARG_SHARED OR ARG_MODULE)
|
||||||
|
llvm_externalize_debuginfo(${name})
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
macro(add_llvm_library name)
|
macro(add_llvm_library name)
|
||||||
@ -655,6 +659,8 @@ macro(add_llvm_executable name)
|
|||||||
if( LLVM_COMMON_DEPENDS )
|
if( LLVM_COMMON_DEPENDS )
|
||||||
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
|
||||||
endif( LLVM_COMMON_DEPENDS )
|
endif( LLVM_COMMON_DEPENDS )
|
||||||
|
|
||||||
|
llvm_externalize_debuginfo(${name})
|
||||||
endmacro(add_llvm_executable name)
|
endmacro(add_llvm_executable name)
|
||||||
|
|
||||||
function(export_executable_symbols target)
|
function(export_executable_symbols target)
|
||||||
@ -1168,3 +1174,24 @@ function(add_llvm_tool_symlink name dest)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(llvm_externalize_debuginfo name)
|
||||||
|
if(NOT LLVM_EXTERNALIZE_DEBUGINFO)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
if(CMAKE_CXX_FLAGS MATCHES "-flto"
|
||||||
|
OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto")
|
||||||
|
|
||||||
|
set(lto_object ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${name}-lto.o)
|
||||||
|
set_target_properties(${name} PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,-object_path_lto -Wl,${lto_object}")
|
||||||
|
endif()
|
||||||
|
add_custom_command(TARGET ${name} POST_BUILD
|
||||||
|
COMMAND xcrun dsymutil $<TARGET_FILE:${name}>
|
||||||
|
COMMAND xcrun strip -Sl $<TARGET_FILE:${name}>)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "LLVM_EXTERNALIZE_DEBUGINFO isn't implemented for non-darwin platforms!")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user