2016-12-16 06:01:17 +08:00
|
|
|
function(add_lldb_library name)
|
2015-07-17 23:26:27 +08:00
|
|
|
# only supported parameters to this macro are the optional
|
2015-03-19 00:56:24 +08:00
|
|
|
# MODULE;SHARED;STATIC library type and source files
|
|
|
|
cmake_parse_arguments(PARAM
|
2017-02-01 06:12:59 +08:00
|
|
|
"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
|
2019-01-30 23:13:16 +08:00
|
|
|
"ENTITLEMENTS"
|
2017-12-08 02:57:09 +08:00
|
|
|
"EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS"
|
2015-03-19 00:56:24 +08:00
|
|
|
${ARGN})
|
|
|
|
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
|
2017-02-01 00:59:46 +08:00
|
|
|
list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
|
2015-03-19 00:56:24 +08:00
|
|
|
|
2017-02-01 06:12:59 +08:00
|
|
|
if(PARAM_PLUGIN)
|
|
|
|
set_property(GLOBAL APPEND PROPERTY LLDB_PLUGINS ${name})
|
|
|
|
endif()
|
|
|
|
|
2015-03-19 00:56:24 +08:00
|
|
|
if (MSVC_IDE OR XCODE)
|
|
|
|
string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
list(GET split_path -1 dir)
|
|
|
|
file(GLOB_RECURSE headers
|
|
|
|
../../include/lldb${dir}/*.h)
|
|
|
|
set(srcs ${srcs} ${headers})
|
|
|
|
endif()
|
|
|
|
if (PARAM_MODULE)
|
|
|
|
set(libkind MODULE)
|
|
|
|
elseif (PARAM_SHARED)
|
|
|
|
set(libkind SHARED)
|
|
|
|
elseif (PARAM_OBJECT)
|
|
|
|
set(libkind OBJECT)
|
|
|
|
else ()
|
2015-06-04 11:12:37 +08:00
|
|
|
# PARAM_STATIC or library type unspecified. BUILD_SHARED_LIBS
|
|
|
|
# does not control the kind of libraries created for LLDB,
|
|
|
|
# only whether or not they link to shared/static LLVM/Clang
|
|
|
|
# libraries.
|
|
|
|
set(libkind STATIC)
|
2015-03-19 00:56:24 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#PIC not needed on Win
|
2017-12-08 02:57:09 +08:00
|
|
|
# FIXME: Setting CMAKE_CXX_FLAGS here is a no-op, use target_compile_options
|
|
|
|
# or omit this logic instead.
|
2016-12-15 23:00:41 +08:00
|
|
|
if (NOT WIN32)
|
2015-03-19 00:56:24 +08:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (PARAM_OBJECT)
|
|
|
|
add_library(${name} ${libkind} ${srcs})
|
|
|
|
else()
|
2019-01-30 23:13:16 +08:00
|
|
|
if(PARAM_ENTITLEMENTS)
|
|
|
|
set(pass_ENTITLEMENTS ENTITLEMENTS ${PARAM_ENTITLEMENTS})
|
|
|
|
endif()
|
|
|
|
|
[CMake] Revised RPATH handling
Summary:
If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.
* In the build-tree, tools use the absolute path to the framework's actual output location.
* In the install-tree, tools get a list of RPATHs to look for the framework when deployed.
`LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree.
If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree).
If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree.
For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks".
Reviewers: xiaobai, JDevlieghere, aprantl, clayborg
Reviewed By: JDevlieghere
Subscribers: ki.stfu, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55330
llvm-svn: 350392
2019-01-04 20:46:57 +08:00
|
|
|
if(LLDB_NO_INSTALL_DEFAULT_RPATH)
|
|
|
|
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
llvm_add_library(${name} ${libkind} ${srcs}
|
|
|
|
LINK_LIBS ${PARAM_LINK_LIBS}
|
|
|
|
DEPENDS ${PARAM_DEPENDS}
|
2019-01-30 23:13:16 +08:00
|
|
|
${pass_ENTITLEMENTS}
|
[CMake] Revised RPATH handling
Summary:
If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.
* In the build-tree, tools use the absolute path to the framework's actual output location.
* In the install-tree, tools get a list of RPATHs to look for the framework when deployed.
`LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree.
If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree).
If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree.
For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks".
Reviewers: xiaobai, JDevlieghere, aprantl, clayborg
Reviewed By: JDevlieghere
Subscribers: ki.stfu, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55330
llvm-svn: 350392
2019-01-04 20:46:57 +08:00
|
|
|
${pass_NO_INSTALL_RPATH}
|
|
|
|
)
|
2015-03-19 00:56:24 +08:00
|
|
|
|
2015-06-29 19:03:21 +08:00
|
|
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
|
|
|
|
if (PARAM_SHARED)
|
2016-09-22 05:02:16 +08:00
|
|
|
if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK)
|
[CMake] Revised LLDB.framework builds
Summary:
Add features to LLDB CMake builds that have so far only been available in Xcode. Clean up a few inconveniences and prepare further improvements.
Options:
* `LLDB_FRAMEWORK_BUILD_DIR` determines target directory (in build-tree)
* `LLDB_FRAMEWORK_INSTALL_DIR` **only** determines target directory in install-tree
* `LLVM_EXTERNALIZE_DEBUGINFO` allows externalized debug info (dSYM on Darwin, emitted to `bin`)
* `LLDB_FRAMEWORK_TOOLS` determines which executables will be copied to the framework's Resources (dropped symlinking, removed INCLUDE_IN_SUITE, removed dummy targets)
Other changes:
* clean up `add_lldb_executable()`
* include `LLDBFramework.cmake` from `source/API/CMakeLists.txt`
* use `*.plist.in` files, which are typical for CMake and independent from Xcode
* add clang headers to the framework bundle
Reviewers: xiaobai, JDevlieghere, aprantl, davide, beanz, stella.stamenova, clayborg, labath
Reviewed By: aprantl
Subscribers: friss, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55328
llvm-svn: 350391
2019-01-04 20:46:50 +08:00
|
|
|
if(LLDB_FRAMEWORK_INSTALL_DIR)
|
|
|
|
set(install_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
|
|
|
|
else()
|
|
|
|
set(install_dir ".")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(install_dir lib${LLVM_LIBDIR_SUFFIX})
|
2016-09-22 05:02:16 +08:00
|
|
|
endif()
|
2015-06-29 19:03:21 +08:00
|
|
|
install(TARGETS ${name}
|
2016-12-16 06:01:17 +08:00
|
|
|
COMPONENT ${name}
|
2015-06-29 19:03:21 +08:00
|
|
|
RUNTIME DESTINATION bin
|
[CMake] Revised LLDB.framework builds
Summary:
Add features to LLDB CMake builds that have so far only been available in Xcode. Clean up a few inconveniences and prepare further improvements.
Options:
* `LLDB_FRAMEWORK_BUILD_DIR` determines target directory (in build-tree)
* `LLDB_FRAMEWORK_INSTALL_DIR` **only** determines target directory in install-tree
* `LLVM_EXTERNALIZE_DEBUGINFO` allows externalized debug info (dSYM on Darwin, emitted to `bin`)
* `LLDB_FRAMEWORK_TOOLS` determines which executables will be copied to the framework's Resources (dropped symlinking, removed INCLUDE_IN_SUITE, removed dummy targets)
Other changes:
* clean up `add_lldb_executable()`
* include `LLDBFramework.cmake` from `source/API/CMakeLists.txt`
* use `*.plist.in` files, which are typical for CMake and independent from Xcode
* add clang headers to the framework bundle
Reviewers: xiaobai, JDevlieghere, aprantl, davide, beanz, stella.stamenova, clayborg, labath
Reviewed By: aprantl
Subscribers: friss, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55328
llvm-svn: 350391
2019-01-04 20:46:50 +08:00
|
|
|
LIBRARY DESTINATION ${install_dir}
|
|
|
|
ARCHIVE DESTINATION ${install_dir})
|
2015-06-29 19:03:21 +08:00
|
|
|
else()
|
|
|
|
install(TARGETS ${name}
|
2016-12-16 06:01:17 +08:00
|
|
|
COMPONENT ${name}
|
2015-06-29 19:03:21 +08:00
|
|
|
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
|
|
|
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
|
|
|
endif()
|
2016-12-16 06:01:17 +08:00
|
|
|
if (NOT CMAKE_CONFIGURATION_TYPES)
|
2017-12-12 08:47:07 +08:00
|
|
|
add_llvm_install_targets(install-${name}
|
2019-04-30 03:44:43 +08:00
|
|
|
DEPENDS ${name}
|
2017-12-13 09:14:27 +08:00
|
|
|
COMPONENT ${name})
|
2016-12-16 06:01:17 +08:00
|
|
|
endif()
|
2015-03-19 00:56:24 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2018-08-02 01:21:18 +08:00
|
|
|
|
2016-08-20 05:00:40 +08:00
|
|
|
# Hack: only some LLDB libraries depend on the clang autogenerated headers,
|
|
|
|
# but it is simple enough to make all of LLDB depend on some of those
|
|
|
|
# headers without negatively impacting much of anything.
|
2019-03-12 23:54:35 +08:00
|
|
|
if(NOT LLDB_BUILT_STANDALONE)
|
2019-01-29 00:15:27 +08:00
|
|
|
add_dependencies(${name} clang-tablegen-targets)
|
|
|
|
endif()
|
2015-03-19 00:56:24 +08:00
|
|
|
|
2017-12-08 02:57:09 +08:00
|
|
|
# Add in any extra C++ compilation flags for this library.
|
|
|
|
target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS})
|
|
|
|
|
2019-05-28 17:29:05 +08:00
|
|
|
if(PARAM_PLUGIN)
|
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lldb plugins")
|
|
|
|
else()
|
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
|
|
|
|
endif()
|
2016-12-16 06:01:17 +08:00
|
|
|
endfunction(add_lldb_library)
|
2015-03-19 00:56:24 +08:00
|
|
|
|
2016-12-16 06:01:17 +08:00
|
|
|
function(add_lldb_executable name)
|
2017-02-01 00:59:46 +08:00
|
|
|
cmake_parse_arguments(ARG
|
[CMake] Revised LLDB.framework builds
Summary:
Add features to LLDB CMake builds that have so far only been available in Xcode. Clean up a few inconveniences and prepare further improvements.
Options:
* `LLDB_FRAMEWORK_BUILD_DIR` determines target directory (in build-tree)
* `LLDB_FRAMEWORK_INSTALL_DIR` **only** determines target directory in install-tree
* `LLVM_EXTERNALIZE_DEBUGINFO` allows externalized debug info (dSYM on Darwin, emitted to `bin`)
* `LLDB_FRAMEWORK_TOOLS` determines which executables will be copied to the framework's Resources (dropped symlinking, removed INCLUDE_IN_SUITE, removed dummy targets)
Other changes:
* clean up `add_lldb_executable()`
* include `LLDBFramework.cmake` from `source/API/CMakeLists.txt`
* use `*.plist.in` files, which are typical for CMake and independent from Xcode
* add clang headers to the framework bundle
Reviewers: xiaobai, JDevlieghere, aprantl, davide, beanz, stella.stamenova, clayborg, labath
Reviewed By: aprantl
Subscribers: friss, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55328
llvm-svn: 350391
2019-01-04 20:46:50 +08:00
|
|
|
"GENERATE_INSTALL"
|
[CMake] Streamline code signing for debugserver #2
Summary:
Major fixes after D54476 (use Diff1 as base for comparison to see only recent changes):
* In standalone builds target directory for debugserver must be LLDB's bin, not LLVM's bin
* Default identity for code signing must not force-override LLVM_CODESIGNING_IDENTITY globally
We have a lot of cases, make them explicit:
* ID used for code signing (debugserver and in tests):
** `LLDB_CODESIGN_IDENTITY` if set explicitly, or otherwise
** `LLVM_CODESIGNING_IDENTITY` if set explicitly, or otherwise
** `lldb_codesign` as the default
* On Darwin we have a debugserver target that:
* On other systems, the debugserver target is not defined, which is equivalent to **[3A]**
Common configurations on Darwin:
* **[1A]** `cmake -GNinja ../llvm` builds debugserver from source and signs with `lldb_codesign`, no code signing for other binaries (prints status: //lldb debugserver: /path/to/bin/debugserver//)
* **[1A]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- -DLLDB_CODESIGN_IDENTITY=lldb_codesign ../llvm` builds debugserver from source and signs with `lldb_codesign`, ad-hoc code signing for other binaries (prints status: //lldb debugserver: /path/to/bin/debugserver//)
* **[2A]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- -DLLDB_USE_SYSTEM_DEBUGSERVER=ON ../llvm` copies debugserver from system, ad-hoc code signing for other binaries (prints status: //Copy system debugserver from: /path/to/system/debugserver//)
* **[2B]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- ../llvm` same, but prints additional warning: //Cannot code sign debugserver with identity '-'. Will fall back to system's debugserver. Pass -DLLDB_CODESIGN_IDENTITY=lldb_codesign to override the LLVM value for debugserver.//
* **[3A]** `cmake -GNinja -DLLVM_CODESIGNING_IDENTITY=- -DLLDB_NO_DEBUGSERVER=ON ../llvm` debugserver not available (prints status: //lldb debugserver will not be available)//
Reviewers: JDevlieghere, beanz, davide, vsk, aprantl, labath
Reviewed By: JDevlieghere, labath
Subscribers: mgorny, #lldb, lldb-commits
Differential Revision: https://reviews.llvm.org/D55013
llvm-svn: 350388
2019-01-04 20:46:30 +08:00
|
|
|
"ENTITLEMENTS"
|
2017-02-01 00:59:46 +08:00
|
|
|
"LINK_LIBS;LINK_COMPONENTS"
|
|
|
|
${ARGN}
|
|
|
|
)
|
|
|
|
|
2019-01-30 23:13:16 +08:00
|
|
|
if(ARG_ENTITLEMENTS)
|
|
|
|
set(pass_ENTITLEMENTS ENTITLEMENTS ${ARG_ENTITLEMENTS})
|
|
|
|
endif()
|
|
|
|
|
[CMake] Revised RPATH handling
Summary:
If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.
* In the build-tree, tools use the absolute path to the framework's actual output location.
* In the install-tree, tools get a list of RPATHs to look for the framework when deployed.
`LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree.
If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree).
If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree.
For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks".
Reviewers: xiaobai, JDevlieghere, aprantl, clayborg
Reviewed By: JDevlieghere
Subscribers: ki.stfu, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55330
llvm-svn: 350392
2019-01-04 20:46:57 +08:00
|
|
|
if(LLDB_NO_INSTALL_DEFAULT_RPATH)
|
|
|
|
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
|
|
|
|
endif()
|
|
|
|
|
2017-02-01 00:59:46 +08:00
|
|
|
list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
|
2019-01-30 23:13:16 +08:00
|
|
|
add_llvm_executable(${name}
|
|
|
|
${pass_ENTITLEMENTS}
|
[CMake] Revised RPATH handling
Summary:
If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.
* In the build-tree, tools use the absolute path to the framework's actual output location.
* In the install-tree, tools get a list of RPATHs to look for the framework when deployed.
`LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree.
If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree).
If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree.
For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks".
Reviewers: xiaobai, JDevlieghere, aprantl, clayborg
Reviewed By: JDevlieghere
Subscribers: ki.stfu, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55330
llvm-svn: 350392
2019-01-04 20:46:57 +08:00
|
|
|
${pass_NO_INSTALL_RPATH}
|
2019-01-30 23:13:16 +08:00
|
|
|
${ARG_UNPARSED_ARGUMENTS}
|
[CMake] Revised RPATH handling
Summary:
If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.
* In the build-tree, tools use the absolute path to the framework's actual output location.
* In the install-tree, tools get a list of RPATHs to look for the framework when deployed.
`LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree.
If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree).
If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree.
For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks".
Reviewers: xiaobai, JDevlieghere, aprantl, clayborg
Reviewed By: JDevlieghere
Subscribers: ki.stfu, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55330
llvm-svn: 350392
2019-01-04 20:46:57 +08:00
|
|
|
)
|
2017-02-01 00:59:46 +08:00
|
|
|
|
[CMake] Use PRIVATE in target_link_libraries for executables
We currently use target_link_libraries without an explicit scope
specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables.
Dependencies added in this way apply to both the target and its
dependencies, i.e. they become part of the executable's link interface
and are transitive.
Transitive dependencies generally don't make sense for executables,
since you wouldn't normally be linking against an executable. This also
causes issues for generating install export files when using
LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM
library dependencies, which are currently added as interface
dependencies. If clang is in the distribution components but the LLVM
libraries it depends on aren't (which is a perfectly legitimate use case
if the LLVM libraries are being built static and there are therefore no
run-time dependencies on them), CMake will complain about the LLVM
libraries not being in export set when attempting to generate the
install export file for clang. This is reasonable behavior on CMake's
part, and the right thing is for LLVM's build system to explicitly use
PRIVATE dependencies for executables.
Unfortunately, CMake doesn't allow you to mix and match the keyword and
non-keyword target_link_libraries signatures for a single target; i.e.,
if a single call to target_link_libraries for a particular target uses
one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must
also be updated to use those keywords. This means we must do this change
in a single shot. I also fully expect to have missed some instances; I
tested by enabling all the projects in the monorepo (except dragonegg),
and configuring both with and without shared libraries, on both Darwin
and Linux, but I'm planning to rely on the buildbots for other
configurations (since it should be pretty easy to fix those).
Even after this change, we still have a lot of target_link_libraries
calls that don't specify a scope keyword, mostly for shared libraries.
I'm thinking about addressing those in a follow-up, but that's a
separate change IMO.
Differential Revision: https://reviews.llvm.org/D40823
llvm-svn: 319840
2017-12-06 05:49:56 +08:00
|
|
|
target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
|
[CMake] Revised LLDB.framework builds
Summary:
Add features to LLDB CMake builds that have so far only been available in Xcode. Clean up a few inconveniences and prepare further improvements.
Options:
* `LLDB_FRAMEWORK_BUILD_DIR` determines target directory (in build-tree)
* `LLDB_FRAMEWORK_INSTALL_DIR` **only** determines target directory in install-tree
* `LLVM_EXTERNALIZE_DEBUGINFO` allows externalized debug info (dSYM on Darwin, emitted to `bin`)
* `LLDB_FRAMEWORK_TOOLS` determines which executables will be copied to the framework's Resources (dropped symlinking, removed INCLUDE_IN_SUITE, removed dummy targets)
Other changes:
* clean up `add_lldb_executable()`
* include `LLDBFramework.cmake` from `source/API/CMakeLists.txt`
* use `*.plist.in` files, which are typical for CMake and independent from Xcode
* add clang headers to the framework bundle
Reviewers: xiaobai, JDevlieghere, aprantl, davide, beanz, stella.stamenova, clayborg, labath
Reviewed By: aprantl
Subscribers: friss, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55328
llvm-svn: 350391
2019-01-04 20:46:50 +08:00
|
|
|
set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
|
2018-06-19 02:27:16 +08:00
|
|
|
|
2018-07-17 03:19:56 +08:00
|
|
|
if(ARG_GENERATE_INSTALL)
|
2016-12-21 00:28:18 +08:00
|
|
|
install(TARGETS ${name}
|
[CMake] Revised LLDB.framework builds
Summary:
Add features to LLDB CMake builds that have so far only been available in Xcode. Clean up a few inconveniences and prepare further improvements.
Options:
* `LLDB_FRAMEWORK_BUILD_DIR` determines target directory (in build-tree)
* `LLDB_FRAMEWORK_INSTALL_DIR` **only** determines target directory in install-tree
* `LLVM_EXTERNALIZE_DEBUGINFO` allows externalized debug info (dSYM on Darwin, emitted to `bin`)
* `LLDB_FRAMEWORK_TOOLS` determines which executables will be copied to the framework's Resources (dropped symlinking, removed INCLUDE_IN_SUITE, removed dummy targets)
Other changes:
* clean up `add_lldb_executable()`
* include `LLDBFramework.cmake` from `source/API/CMakeLists.txt`
* use `*.plist.in` files, which are typical for CMake and independent from Xcode
* add clang headers to the framework bundle
Reviewers: xiaobai, JDevlieghere, aprantl, davide, beanz, stella.stamenova, clayborg, labath
Reviewed By: aprantl
Subscribers: friss, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55328
llvm-svn: 350391
2019-01-04 20:46:50 +08:00
|
|
|
COMPONENT ${name}
|
|
|
|
RUNTIME DESTINATION bin)
|
2016-12-21 00:28:18 +08:00
|
|
|
if (NOT CMAKE_CONFIGURATION_TYPES)
|
2017-12-12 08:47:07 +08:00
|
|
|
add_llvm_install_targets(install-${name}
|
2017-12-13 09:14:27 +08:00
|
|
|
DEPENDS ${name}
|
|
|
|
COMPONENT ${name})
|
2016-09-22 05:02:16 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
2016-12-16 06:01:17 +08:00
|
|
|
endfunction(add_lldb_executable)
|
|
|
|
|
2019-04-17 05:15:28 +08:00
|
|
|
|
|
|
|
macro(add_lldb_tool_subdirectory name)
|
|
|
|
add_llvm_subdirectory(LLDB TOOL ${name})
|
|
|
|
endmacro()
|
|
|
|
|
2016-12-16 06:01:17 +08:00
|
|
|
function(add_lldb_tool name)
|
|
|
|
add_lldb_executable(${name} GENERATE_INSTALL ${ARGN})
|
|
|
|
endfunction()
|
2015-10-14 22:52:15 +08:00
|
|
|
|
|
|
|
# Support appending linker flags to an existing target.
|
|
|
|
# This will preserve the existing linker flags on the
|
|
|
|
# target, if there are any.
|
|
|
|
function(lldb_append_link_flags target_name new_link_flags)
|
|
|
|
# Retrieve existing linker flags.
|
|
|
|
get_target_property(current_link_flags ${target_name} LINK_FLAGS)
|
|
|
|
|
|
|
|
# If we had any linker flags, include them first in the new linker flags.
|
|
|
|
if(current_link_flags)
|
|
|
|
set(new_link_flags "${current_link_flags} ${new_link_flags}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Now set them onto the target.
|
|
|
|
set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
|
|
|
|
endfunction()
|
[CMake] Revised RPATH handling
Summary:
If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.
* In the build-tree, tools use the absolute path to the framework's actual output location.
* In the install-tree, tools get a list of RPATHs to look for the framework when deployed.
`LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree.
If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree).
If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree.
For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks".
Reviewers: xiaobai, JDevlieghere, aprantl, clayborg
Reviewed By: JDevlieghere
Subscribers: ki.stfu, mgorny, lldb-commits, #lldb
Differential Revision: https://reviews.llvm.org/D55330
llvm-svn: 350392
2019-01-04 20:46:57 +08:00
|
|
|
|
2019-05-29 19:26:06 +08:00
|
|
|
# Unified handling for executable LLDB.framework resources. Given the name of an
|
|
|
|
# executable target, this function adds a post-build step to copy it to the
|
|
|
|
# framework bundle in the build-tree.
|
|
|
|
function(lldb_add_to_framework name)
|
|
|
|
set(subdir "LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources")
|
|
|
|
|
|
|
|
# Destination for the copy in the build-tree. While the framework target may
|
|
|
|
# not exist yet, it will exist when the generator expression gets expanded.
|
|
|
|
set(copy_dest "$<TARGET_FILE_DIR:liblldb>/../../../${subdir}")
|
|
|
|
|
|
|
|
# Copy into the framework's Resources directory for testing.
|
|
|
|
add_custom_command(TARGET ${name} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${name}> ${copy_dest}
|
|
|
|
COMMENT "Copy ${name} to ${copy_dest}"
|
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# CMake's set_target_properties() doesn't allow to pass lists for RPATH
|
|
|
|
# properties directly (error: "called with incorrect number of arguments").
|
|
|
|
# Instead of defining two list variables each time, use this helper function.
|
|
|
|
function(lldb_setup_rpaths name)
|
|
|
|
cmake_parse_arguments(LIST "" "" "BUILD_RPATH;INSTALL_RPATH" ${ARGN})
|
|
|
|
set_target_properties(${name} PROPERTIES
|
|
|
|
BUILD_WITH_INSTALL_RPATH OFF
|
|
|
|
BUILD_RPATH "${LIST_BUILD_RPATH}"
|
|
|
|
INSTALL_RPATH "${LIST_INSTALL_RPATH}"
|
|
|
|
)
|
|
|
|
endfunction()
|