Skip to content

Commit f126ce6

Browse files
committedJan 4, 2019
[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
1 parent d0dc161 commit f126ce6

File tree

13 files changed

+190
-173
lines changed

13 files changed

+190
-173
lines changed
 

‎lldb/CMakeLists.txt

+14-41
Original file line numberDiff line numberDiff line change
@@ -28,46 +28,18 @@ if(APPLE)
2828
add_definitions(-DLLDB_USE_OS_LOG)
2929
endif()
3030

31-
# lldb-suite is a dummy target that encompasses all the necessary tools and
32-
# libraries for building a fully-functioning liblldb.
33-
add_custom_target(lldb-suite)
34-
set(LLDB_SUITE_TARGET lldb-suite)
35-
36-
if(LLDB_BUILD_FRAMEWORK)
37-
add_custom_target(lldb-framework)
38-
39-
# These are used to fill out LLDB-Info.plist. These are relevant when building
40-
# the framework, and must be defined before building liblldb.
41-
set(PRODUCT_NAME "LLDB")
42-
set(EXECUTABLE_NAME "LLDB")
43-
set(CURRENT_PROJECT_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}")
44-
set(LLDB_SUITE_TARGET lldb-framework)
45-
46-
set(LLDB_FRAMEWORK_DIR
47-
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
48-
include(LLDBFramework)
49-
endif()
50-
5131
add_subdirectory(docs)
5232
if (NOT LLDB_DISABLE_PYTHON)
53-
if(LLDB_USE_SYSTEM_SIX)
54-
set(SIX_EXTRA_ARGS "--useSystemSix")
55-
endif()
56-
5733
set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
5834
set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
5935
if(LLDB_BUILD_FRAMEWORK)
60-
set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_DIR})
36+
set(LLDB_PYTHON_TARGET_DIR ${LLDB_FRAMEWORK_BUILD_DIR})
6137
set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
62-
else()
63-
# Don't set -m when building the framework.
64-
set(FINISH_EXTRA_ARGS "-m")
6538
endif()
6639

6740

6841
add_subdirectory(scripts)
6942
endif ()
70-
7143
add_subdirectory(source)
7244
add_subdirectory(tools)
7345

@@ -154,8 +126,14 @@ if(LLDB_INCLUDE_TESTS)
154126
add_subdirectory(utils/lldb-dotest)
155127
endif()
156128

157-
158129
if (NOT LLDB_DISABLE_PYTHON)
130+
if(NOT LLDB_BUILD_FRAMEWORK)
131+
set(use_python_wrapper_from_src_dir -m)
132+
endif()
133+
if(LLDB_USE_SYSTEM_SIX)
134+
set(use_six_py_from_system --useSystemSix)
135+
endif()
136+
159137
# Add a Post-Build Event to copy over Python files and create the symlink
160138
# to liblldb.so for the Python API(hardlink on Windows)
161139
add_custom_target(finish_swig ALL
@@ -167,29 +145,24 @@ if (NOT LLDB_DISABLE_PYTHON)
167145
--prefix=${CMAKE_BINARY_DIR}
168146
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
169147
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
170-
${SIX_EXTRA_ARGS}
171-
${FINISH_EXTRA_ARGS}
148+
${use_python_wrapper_from_src_dir}
149+
${use_six_py_from_system}
172150
VERBATIM
173151
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
174152
DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
175153
COMMENT "Python script sym-linking LLDB Python API")
176154

177-
# We depend on liblldb and lldb-argdumper being built before we can do this step.
178-
add_dependencies(finish_swig ${LLDB_SUITE_TARGET})
179155

180-
# If we build the readline module, we depend on that happening
181-
# first.
182156
if (TARGET readline)
183-
add_dependencies(finish_swig readline)
157+
set(readline_dep readline)
184158
endif()
159+
add_dependencies(finish_swig swig_wrapper liblldb lldb-argdumper ${readline_dep})
185160

186161
# Ensure we do the python post-build step when building lldb.
187162
add_dependencies(lldb finish_swig)
188163

189-
if (LLDB_BUILD_FRAMEWORK)
190-
# The target to install libLLDB needs to depend on finish_swig so that the
191-
# framework build properly copies over the Python files.
192-
add_dependencies(install-liblldb finish_swig)
164+
if(LLDB_BUILD_FRAMEWORK)
165+
add_dependencies(lldb-framework finish_swig)
193166
endif()
194167

195168
# Add a Post-Build Event to copy the custom Python DLL to the lldb binaries dir so that Windows can find it when launching

‎lldb/cmake/modules/AddLLDB.cmake

+13-55
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ function(add_lldb_library name)
5050

5151
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
5252
if (PARAM_SHARED)
53-
set(out_dir lib${LLVM_LIBDIR_SUFFIX})
5453
if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK)
55-
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
56-
# The framework that is generated will install with install-liblldb
57-
# because we enable CMake's framework support. CMake will copy all the
58-
# headers and resources for us.
59-
add_dependencies(install-lldb-framework install-${name})
60-
add_dependencies(install-lldb-framework-stripped install-${name}-stripped)
54+
if(LLDB_FRAMEWORK_INSTALL_DIR)
55+
set(install_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
56+
else()
57+
set(install_dir ".")
58+
endif()
59+
else()
60+
set(install_dir lib${LLVM_LIBDIR_SUFFIX})
6161
endif()
6262
install(TARGETS ${name}
6363
COMPONENT ${name}
6464
RUNTIME DESTINATION bin
65-
LIBRARY DESTINATION ${out_dir}
66-
ARCHIVE DESTINATION ${out_dir})
65+
LIBRARY DESTINATION ${install_dir}
66+
ARCHIVE DESTINATION ${install_dir})
6767
else()
6868
install(TARGETS ${name}
6969
COMPONENT ${name}
@@ -74,13 +74,6 @@ function(add_lldb_library name)
7474
add_llvm_install_targets(install-${name}
7575
DEPENDS $<TARGET_FILE:${name}>
7676
COMPONENT ${name})
77-
78-
# install-liblldb{,-stripped} is the actual target that will install the
79-
# framework, so it must rely on the framework being fully built first.
80-
if (LLDB_BUILD_FRAMEWORK AND ${name} STREQUAL "liblldb")
81-
add_dependencies(install-${name} lldb-framework)
82-
add_dependencies(install-${name}-stripped lldb-framework)
83-
endif()
8477
endif()
8578
endif()
8679
endif()
@@ -99,7 +92,7 @@ endfunction(add_lldb_library)
9992

10093
function(add_lldb_executable name)
10194
cmake_parse_arguments(ARG
102-
"INCLUDE_IN_SUITE;GENERATE_INSTALL"
95+
"GENERATE_INSTALL"
10396
"ENTITLEMENTS"
10497
"LINK_LIBS;LINK_COMPONENTS"
10598
${ARGN}
@@ -109,53 +102,18 @@ function(add_lldb_executable name)
109102
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS} ENTITLEMENTS ${ARG_ENTITLEMENTS})
110103

111104
target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
112-
set_target_properties(${name} PROPERTIES
113-
FOLDER "lldb executables")
114-
115-
if(ARG_INCLUDE_IN_SUITE)
116-
add_dependencies(lldb-suite ${name})
117-
if(LLDB_BUILD_FRAMEWORK)
118-
if(NOT IOS)
119-
set(resource_dir "/Resources")
120-
set(resource_dots "../")
121-
endif()
122-
string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
123-
set_target_properties(${name} PROPERTIES
124-
RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>${resource_dir}
125-
BUILD_WITH_INSTALL_RPATH On
126-
INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
127-
endif()
128-
endif()
129-
130-
if(LLDB_BUILD_FRAMEWORK AND NOT ARG_INCLUDE_IN_SUITE)
131-
set_target_properties(${name} PROPERTIES
132-
BUILD_WITH_INSTALL_RPATH On
133-
INSTALL_RPATH "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
134-
endif()
105+
set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
135106

136107
if(ARG_GENERATE_INSTALL)
137-
set(out_dir "bin")
138-
if (LLDB_BUILD_FRAMEWORK AND ARG_INCLUDE_IN_SUITE)
139-
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
140-
# While install-liblldb-stripped will handle copying the tools, it will
141-
# not strip them. We depend on this target to guarantee a stripped version
142-
# will get installed in the framework.
143-
add_dependencies(install-lldb-framework-stripped install-${name}-stripped)
144-
endif()
145108
install(TARGETS ${name}
146-
COMPONENT ${name}
147-
RUNTIME DESTINATION ${out_dir})
109+
COMPONENT ${name}
110+
RUNTIME DESTINATION bin)
148111
if (NOT CMAKE_CONFIGURATION_TYPES)
149112
add_llvm_install_targets(install-${name}
150113
DEPENDS ${name}
151114
COMPONENT ${name})
152115
endif()
153116
endif()
154-
155-
if(ARG_INCLUDE_IN_SUITE AND LLDB_BUILD_FRAMEWORK)
156-
add_llvm_tool_symlink(${name} ${name} ALWAYS_GENERATE SKIP_INSTALL
157-
OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
158-
endif()
159117
endfunction(add_lldb_executable)
160118

161119
function(add_lldb_tool name)

‎lldb/cmake/modules/LLDBConfig.cmake

+25-16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
44
set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
55
set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
66

7+
set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
8+
set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
9+
10+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
11+
message(FATAL_ERROR
12+
"In-source builds are not allowed. CMake would overwrite the makefiles "
13+
"distributed with LLDB. Please create a directory and run cmake from "
14+
"there, passing the path to this source directory as the last argument. "
15+
"This process created the file `CMakeCache.txt' and the directory "
16+
"`CMakeFiles'. Please delete them.")
17+
endif()
18+
719
set(LLDB_LINKER_SUPPORTS_GROUPS OFF)
820
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
921
# The Darwin linker doesn't understand --start-group/--end-group.
@@ -45,6 +57,19 @@ if(LLDB_BUILD_FRAMEWORK)
4557
if(CMAKE_VERSION VERSION_LESS 3.7)
4658
message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
4759
endif()
60+
61+
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
62+
set(LLDB_FRAMEWORK_BUILD_DIR bin CACHE STRING "Output directory for LLDB.framework")
63+
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Install directory for LLDB.framework")
64+
set(LLDB_FRAMEWORK_TOOLS darwin-debug;debugserver;lldb-argdumper;lldb-server CACHE INTERNAL
65+
"List of tools to include in LLDB.framework/Resources")
66+
67+
# Set designated directory for all dSYMs. Essentially, this emits the
68+
# framework's dSYM outside of the framework directory.
69+
if(LLVM_EXTERNALIZE_DEBUGINFO)
70+
set(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING
71+
"Directory to emit dSYM files stripped from executables and libraries (Darwin Only)")
72+
endif()
4873
endif()
4974

5075
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
@@ -269,17 +294,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
269294
add_definitions( -D_UNICODE -DUNICODE )
270295
endif()
271296

272-
set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
273-
set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
274-
275-
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
276-
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
277-
"the makefiles distributed with LLDB. Please create a directory and run cmake "
278-
"from there, passing the path to this source directory as the last argument. "
279-
"This process created the file `CMakeCache.txt' and the directory "
280-
"`CMakeFiles'. Please delete them.")
281-
endif()
282-
283297
# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
284298
if(NOT DEFINED LLDB_VERSION_MAJOR)
285299
set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
@@ -345,11 +359,6 @@ if (APPLE)
345359
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
346360
find_library(SECURITY_LIBRARY Security)
347361

348-
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output directory for LLDB.framework")
349-
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
350-
set(LLDB_FRAMEWORK_RESOURCE_DIR
351-
LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources)
352-
353362
add_definitions( -DLIBXML2_DEFINED )
354363
list(APPEND system_libs xml2
355364
${CURSES_LIBRARIES}

‎lldb/cmake/modules/LLDBFramework.cmake

+89-21
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,107 @@
1+
# Path relative to the root binary directory
2+
get_filename_component(
3+
framework_target_dir ${LLDB_FRAMEWORK_BUILD_DIR} ABSOLUTE
4+
BASE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}
5+
)
6+
7+
message(STATUS "LLDB.framework: build path is '${framework_target_dir}'")
8+
message(STATUS "LLDB.framework: install path is '${LLDB_FRAMEWORK_INSTALL_DIR}'")
9+
message(STATUS "LLDB.framework: resources subdirectory is 'Versions/${LLDB_FRAMEWORK_VERSION}/Resources'")
10+
11+
# Configure liblldb as a framework bundle
12+
set_target_properties(liblldb PROPERTIES
13+
FRAMEWORK ON
14+
FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
15+
16+
OUTPUT_NAME LLDB
17+
VERSION ${LLDB_VERSION}
18+
LIBRARY_OUTPUT_DIRECTORY ${framework_target_dir}
19+
20+
# Compatibility version
21+
SOVERSION "1.0.0"
22+
23+
MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
24+
MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
25+
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
26+
MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
27+
)
28+
29+
# Affects the layout of the framework bundle (default is macOS layout).
30+
if(IOS)
31+
set_target_properties(liblldb PROPERTIES
32+
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONEOS_DEPLOYMENT_TARGET}")
33+
else()
34+
set_target_properties(liblldb PROPERTIES
35+
XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "${MACOSX_DEPLOYMENT_TARGET}")
36+
endif()
37+
38+
# Target to capture extra steps for a fully functional framework bundle.
39+
add_custom_target(lldb-framework)
40+
add_dependencies(lldb-framework liblldb)
41+
42+
# Dependencies are defined once tools are added (see AddLLDB.cmake)
43+
if(LLDB_FRAMEWORK_TOOLS)
44+
foreach(tool ${LLDB_FRAMEWORK_TOOLS})
45+
add_custom_command(TARGET lldb-framework POST_BUILD
46+
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${tool}> $<TARGET_FILE_DIR:liblldb>/Resources
47+
COMMENT "LLDB.framework: copy additional tool ${tool}"
48+
)
49+
endforeach()
50+
else()
51+
message(WARNING "LLDB.framework: no additional tools configured (set via LLDB_FRAMEWORK_TOOLS)")
52+
endif()
53+
54+
# Apart from this one, CMake creates all required symlinks in the framework bundle.
55+
add_custom_command(TARGET lldb-framework POST_BUILD
56+
COMMAND ${CMAKE_COMMAND} -E create_symlink
57+
Versions/Current/Headers
58+
${framework_target_dir}/LLDB.framework/Headers
59+
COMMENT "LLDB.framework: create Headers symlink"
60+
)
61+
62+
# At configuration time, collect headers for the framework bundle and copy them
63+
# into a staging directory. Later we can copy over the entire folder.
164
file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
265
file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
366
file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
467
list(REMOVE_ITEM root_public_headers ${root_private_headers})
68+
69+
set(lldb_header_staging ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
570
foreach(header
671
${public_headers}
772
${root_public_headers}
873
${LLDB_SOURCE_DIR}/include/lldb/Utility/SharingPtr.h)
74+
975
get_filename_component(basename ${header} NAME)
10-
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename}
11-
DEPENDS ${header}
12-
COMMAND ${CMAKE_COMMAND} -E copy ${header} ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
13-
list(APPEND framework_headers ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
76+
set(staged_header ${lldb_header_staging}/${basename})
77+
78+
add_custom_command(
79+
DEPENDS ${header} OUTPUT ${staged_header}
80+
COMMAND ${CMAKE_COMMAND} -E copy ${header} ${staged_header}
81+
COMMENT "LLDB.framework: collect framework header")
82+
83+
list(APPEND lldb_staged_headers ${staged_header})
1484
endforeach()
1585

16-
add_custom_target(lldb-framework-headers DEPENDS ${framework_headers})
86+
# Wrap output in a target, so lldb-framework can depend on it.
87+
add_custom_target(lldb-framework-headers DEPENDS ${lldb_staged_headers})
88+
add_dependencies(lldb-framework lldb-framework-headers)
1789

18-
add_custom_command(TARGET lldb-framework POST_BUILD
19-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $<TARGET_FILE_DIR:liblldb>/Headers
90+
# At build time, copy the staged headers into the framework bundle (and do
91+
# some post-processing in-place).
92+
add_custom_command(TARGET lldb-framework-headers POST_BUILD
93+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} $<TARGET_FILE_DIR:liblldb>/Headers
2094
COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $<TARGET_FILE_DIR:liblldb>/Headers ${LLDB_VERSION}
95+
COMMENT "LLDB.framework: copy framework headers"
2196
)
2297

23-
if (NOT IOS)
24-
if (NOT LLDB_BUILT_STANDALONE)
25-
add_dependencies(lldb-framework clang-headers)
26-
endif()
98+
# Copy vendor-specific headers from clang (without staging).
99+
if(NOT IOS AND NOT LLDB_BUILT_STANDALONE)
100+
add_dependencies(lldb-framework clang-headers)
27101
add_custom_command(TARGET lldb-framework POST_BUILD
28-
COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Headers
29-
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Versions/Current
30-
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH} $<TARGET_FILE_DIR:liblldb>/Resources/Clang
102+
COMMAND ${CMAKE_COMMAND} -E copy_directory
103+
$<TARGET_PROPERTY:clang-headers,RUNTIME_OUTPUT_DIRECTORY>
104+
$<TARGET_FILE_DIR:liblldb>/Resources/Clang/include
105+
COMMENT "LLDB.framework: copy clang vendor-specific headers"
31106
)
32107
endif()
33-
34-
add_dependencies(lldb-framework
35-
lldb-framework-headers
36-
lldb-suite)
37-
38-
add_custom_target(install-lldb-framework)
39-
add_custom_target(install-lldb-framework-stripped)

‎lldb/resources/LLDB-Info.plist.in

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>LLDB</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>${MACOSX_FRAMEWORK_IDENTIFIER}</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundlePackageType</key>
14+
<string>FMWK</string>
15+
<key>CFBundleShortVersionString</key>
16+
<string>${MACOSX_FRAMEWORK_SHORT_VERSION_STRING}</string>
17+
<key>CFBundleSignature</key>
18+
<string>????</string>
19+
<key>CFBundleVersion</key>
20+
<string>${MACOSX_FRAMEWORK_BUNDLE_VERSION}</string>
21+
<key>CFBundleName</key>
22+
<string>LLDB</string>
23+
</dict>
24+
</plist>

‎lldb/source/API/CMakeLists.txt

+19-29
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,26 @@ add_lldb_library(liblldb SHARED
9292
Support
9393
)
9494

95-
add_dependencies(lldb-suite liblldb)
95+
if(LLDB_WRAP_PYTHON)
96+
add_dependencies(liblldb swig_wrapper)
9697

97-
if (MSVC)
98-
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
99-
else()
100-
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
101-
endif()
98+
if (MSVC)
99+
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
100+
else()
101+
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
102+
endif()
102103

103-
set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
104-
if (CLANG_CL)
105-
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
106-
PROPERTY COMPILE_FLAGS " -Wno-unused-function")
104+
set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
105+
if (CLANG_CL)
106+
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
107+
PROPERTY COMPILE_FLAGS " -Wno-unused-function")
108+
endif()
109+
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
110+
NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
111+
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
112+
PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
113+
endif ()
107114
endif()
108-
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
109-
NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
110-
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING
111-
PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
112-
endif ()
113115

114116
set_target_properties(liblldb
115117
PROPERTIES
@@ -144,18 +146,6 @@ else()
144146
)
145147
endif()
146148

147-
if (LLDB_BUILD_FRAMEWORK)
148-
set_target_properties(liblldb
149-
PROPERTIES
150-
SOVERSION "1.0.0"
151-
OUTPUT_NAME LLDB
152-
FRAMEWORK On
153-
FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
154-
MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist
155-
LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_DIR}
156-
)
157-
endif()
158-
159-
if (LLDB_WRAP_PYTHON)
160-
add_dependencies(liblldb swig_wrapper)
149+
if(LLDB_BUILD_FRAMEWORK)
150+
include(LLDBFramework)
161151
endif()

‎lldb/test/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ if(LLDB_CODESIGN_IDENTITY_USED)
7979
endif()
8080

8181
if(LLDB_BUILD_FRAMEWORK)
82-
list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLDB_FRAMEWORK_DIR}/LLDB.framework)
82+
get_target_property(framework_target_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
83+
list(APPEND LLDB_TEST_COMMON_ARGS --framework ${framework_target_dir}/LLDB.framework)
8384
endif()
8485

8586
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")

‎lldb/tools/argdumper/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add_lldb_tool(lldb-argdumper INCLUDE_IN_SUITE
1+
add_lldb_tool(lldb-argdumper
22
argdumper.cpp
33

44
LINK_LIBS
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
add_lldb_tool(darwin-debug INCLUDE_IN_SUITE
1+
add_lldb_tool(darwin-debug
22
darwin-debug.cpp
33
)

‎lldb/tools/debugserver/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
1515

1616
set(LLDB_SOURCE_DIR "${CMAKE_SOURCE_DIR}/../../")
1717
include_directories(${LLDB_SOURCE_DIR}/include)
18-
19-
# lldb-suite is a dummy target that encompasses all the necessary tools and
20-
# libraries for building a fully-functioning liblldb.
21-
add_custom_target(lldb-suite)
22-
set(LLDB_SUITE_TARGET lldb-suite)
2318
endif()
2419

2520
add_subdirectory(source)

‎lldb/tools/debugserver/source/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ if(build_and_sign_debugserver)
259259
COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
260260
endif()
261261
set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
262-
add_lldb_tool(debugserver INCLUDE_IN_SUITE
262+
add_lldb_tool(debugserver
263263
debugserver.cpp
264264

265265
LINK_LIBS

‎lldb/tools/driver/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
1919
endif()
2020

2121
add_dependencies(lldb
22-
${LLDB_SUITE_TARGET}
2322
LLDBOptionsTableGen
2423
${tablegen_deps}
2524
)

‎lldb/tools/lldb-server/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ else()
4242
list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
4343
endif()
4444

45-
add_lldb_tool(lldb-server INCLUDE_IN_SUITE
45+
add_lldb_tool(lldb-server
4646
Acceptor.cpp
4747
lldb-gdbserver.cpp
4848
lldb-platform.cpp

0 commit comments

Comments
 (0)
Please sign in to comment.