forked from OSchip/llvm-project
[CMake] Refactor LLDB libraries and tools to be components
In LLVM's CMake we have a convention that components have both a build and an install target. Making LLDB follow this convention will allow LLDB to take advantage of the LLVM_DISTRIBUTION_COMPONENTS build option from LLVM. llvm-svn: 289879
This commit is contained in:
parent
40f05dcec9
commit
d69b9414b3
|
@ -17,7 +17,7 @@ function(lldb_link_common_libs name targetkind)
|
|||
endif()
|
||||
endfunction(lldb_link_common_libs)
|
||||
|
||||
macro(add_lldb_library name)
|
||||
function(add_lldb_library name)
|
||||
# only supported parameters to this macro are the optional
|
||||
# MODULE;SHARED;STATIC library type and source files
|
||||
cmake_parse_arguments(PARAM
|
||||
|
@ -80,14 +80,23 @@ macro(add_lldb_library name)
|
|||
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
endif()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${out_dir}
|
||||
ARCHIVE DESTINATION ${out_dir})
|
||||
else()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=${name}
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -100,14 +109,15 @@ macro(add_lldb_library name)
|
|||
endif()
|
||||
|
||||
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
|
||||
endmacro(add_lldb_library)
|
||||
endfunction(add_lldb_library)
|
||||
|
||||
macro(add_lldb_executable name)
|
||||
cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK" "" "" ${ARGN})
|
||||
function(add_lldb_executable name)
|
||||
cmake_parse_arguments(ARG "INCLUDE_IN_FRAMEWORK;GENERATE_INSTALL" "" "" ${ARGN})
|
||||
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
|
||||
set_target_properties(${name} PROPERTIES
|
||||
FOLDER "lldb executables")
|
||||
|
||||
set(install_dir bin)
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
if(ARG_INCLUDE_IN_FRAMEWORK)
|
||||
string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
|
@ -115,16 +125,34 @@ macro(add_lldb_executable name)
|
|||
RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>/Resources
|
||||
BUILD_WITH_INSTALL_RPATH On
|
||||
INSTALL_RPATH "@loader_path/../../../../${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
|
||||
add_llvm_tool_symlink(${name} ${name} ARG_ALWAYS_GENERATE
|
||||
OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
|
||||
else()
|
||||
set_target_properties(${name} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH On
|
||||
INSTALL_RPATH "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
if(ARG_GENERATE_INSTALL)
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
RUNTIME DESTINATION ${install_dir})
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=${name}
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endmacro(add_lldb_executable)
|
||||
|
||||
if(ARG_INCLUDE_IN_FRAMEWORK AND LLDB_BUILD_FRAMEWORK)
|
||||
add_llvm_tool_symlink(${name} ${name} ALWAYS_GENERATE SKIP_INSTALL
|
||||
OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
|
||||
endif()
|
||||
endfunction(add_lldb_executable)
|
||||
|
||||
function(add_lldb_tool name)
|
||||
add_lldb_executable(${name} GENERATE_INSTALL ${ARGN})
|
||||
endfunction()
|
||||
|
||||
# Support appending linker flags to an existing target.
|
||||
# This will preserve the existing linker flags on the
|
||||
|
|
|
@ -275,6 +275,7 @@ include_directories(BEFORE
|
|||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
install(DIRECTORY include/
|
||||
COMPONENT lldb_headers
|
||||
DESTINATION include
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
|
||||
|
||||
add_lldb_executable(lldb-argdumper INCLUDE_IN_FRAMEWORK
|
||||
add_lldb_tool(lldb-argdumper INCLUDE_IN_FRAMEWORK
|
||||
argdumper.cpp
|
||||
)
|
||||
|
||||
|
@ -11,6 +11,3 @@ else()
|
|||
endif()
|
||||
llvm_config(lldb-argdumper ${LLVM_LINK_COMPONENTS})
|
||||
|
||||
|
||||
install(TARGETS lldb-argdumper
|
||||
RUNTIME DESTINATION bin)
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
add_lldb_executable(darwin-debug INCLUDE_IN_FRAMEWORK
|
||||
add_lldb_tool(darwin-debug INCLUDE_IN_FRAMEWORK
|
||||
darwin-debug.cpp
|
||||
)
|
||||
|
||||
install(TARGETS darwin-debug
|
||||
RUNTIME DESTINATION bin)
|
||||
|
|
|
@ -36,7 +36,7 @@ set(DEBUGSERVER_USED_LIBS
|
|||
lldbDebugserverMacOSX_DarwinLog
|
||||
)
|
||||
|
||||
add_lldb_executable(debugserver INCLUDE_IN_FRAMEWORK
|
||||
add_lldb_tool(debugserver INCLUDE_IN_FRAMEWORK
|
||||
HasAVX.s
|
||||
CFBundle.cpp
|
||||
CFString.cpp
|
||||
|
@ -78,7 +78,3 @@ if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
|
|||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS debugserver
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake)
|
||||
|
||||
add_lldb_executable(lldb
|
||||
add_lldb_tool(lldb
|
||||
Driver.cpp
|
||||
Platform.cpp
|
||||
)
|
||||
|
@ -32,5 +32,3 @@ endif()
|
|||
|
||||
set_target_properties(lldb PROPERTIES VERSION ${LLDB_VERSION})
|
||||
|
||||
install(TARGETS lldb
|
||||
RUNTIME DESTINATION bin)
|
||||
|
|
|
@ -84,7 +84,7 @@ endif ()
|
|||
# We need to include the llvm components we depend on manually, as liblldb does
|
||||
# not re-export those.
|
||||
set(LLVM_LINK_COMPONENTS Support)
|
||||
add_lldb_executable(lldb-mi ${LLDB_MI_SOURCES})
|
||||
add_lldb_tool(lldb-mi ${LLDB_MI_SOURCES})
|
||||
|
||||
target_link_libraries(lldb-mi liblldb)
|
||||
if (HAVE_LIBPTHREAD)
|
||||
|
@ -92,6 +92,3 @@ if (HAVE_LIBPTHREAD)
|
|||
endif ()
|
||||
|
||||
set_target_properties(lldb-mi PROPERTIES VERSION ${LLDB_VERSION})
|
||||
|
||||
install(TARGETS lldb-mi
|
||||
RUNTIME DESTINATION bin)
|
||||
|
|
|
@ -165,7 +165,7 @@ set(LLVM_LINK_COMPONENTS
|
|||
target
|
||||
)
|
||||
|
||||
add_lldb_executable(lldb-server INCLUDE_IN_FRAMEWORK
|
||||
add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK
|
||||
Acceptor.cpp
|
||||
lldb-gdbserver.cpp
|
||||
lldb-platform.cpp
|
||||
|
@ -188,6 +188,3 @@ llvm_config(lldb-server ${LLVM_LINK_COMPONENTS})
|
|||
target_link_libraries(lldb-server ${LLDB_SYSTEM_LIBS})
|
||||
|
||||
set_target_properties(lldb-server PROPERTIES VERSION ${LLDB_VERSION})
|
||||
|
||||
install(TARGETS lldb-server
|
||||
RUNTIME DESTINATION bin)
|
||||
|
|
Loading…
Reference in New Issue