[Lldb-commits] [lldb] d49aedd - Build a flat LLDB.framework for embedded Darwin targets
Vedant Kumar via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 12 13:35:10 PDT 2020
Author: Vedant Kumar
Date: 2020-08-12T13:34:29-07:00
New Revision: d49aedd315e35180b1df19476353ebe2558a318b
URL: https://github.com/llvm/llvm-project/commit/d49aedd315e35180b1df19476353ebe2558a318b
DIFF: https://github.com/llvm/llvm-project/commit/d49aedd315e35180b1df19476353ebe2558a318b.diff
LOG: Build a flat LLDB.framework for embedded Darwin targets
This patch configures LLDB.framework to build as a flat unversioned
framework on non-macOS Darwin targets, which have never supported the
macOS framework layout.
This patch also renames the 'IOS' cmake variable to 'APPLE_EMBEDDED' to
reflect the fact that lldb is built for several different kinds of embedded
Darwin targets, not just iOS.
Differential Revision: https://reviews.llvm.org/D85770
Added:
Modified:
lldb/cmake/modules/LLDBConfig.cmake
lldb/cmake/modules/LLDBFramework.cmake
lldb/source/Host/CMakeLists.txt
lldb/tools/debugserver/source/CMakeLists.txt
lldb/tools/lldb-server/CMakeLists.txt
lldb/unittests/debugserver/CMakeLists.txt
Removed:
################################################################################
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 7e5848c800f8..ed77e188c107 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -267,7 +267,7 @@ endif()
# Find Apple-specific libraries or frameworks that may be needed.
if (APPLE)
- if(NOT IOS)
+ if(NOT APPLE_EMBEDDED)
find_library(CARBON_LIBRARY Carbon)
find_library(CORE_SERVICES_LIBRARY CoreServices)
endif()
diff --git a/lldb/cmake/modules/LLDBFramework.cmake b/lldb/cmake/modules/LLDBFramework.cmake
index c52daaa4fa8b..43af71b78f24 100644
--- a/lldb/cmake/modules/LLDBFramework.cmake
+++ b/lldb/cmake/modules/LLDBFramework.cmake
@@ -3,22 +3,38 @@ message(STATUS "LLDB.framework: install path is '${LLDB_FRAMEWORK_INSTALL_DIR}'"
message(STATUS "LLDB.framework: resources subdirectory is 'Versions/${LLDB_FRAMEWORK_VERSION}/Resources'")
# Configure liblldb as a framework bundle
-set_target_properties(liblldb PROPERTIES
- FRAMEWORK ON
- FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
+if(NOT APPLE_EMBEDDED)
+ set_target_properties(liblldb PROPERTIES
+ FRAMEWORK ON
+ FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
- OUTPUT_NAME LLDB
- VERSION ${LLDB_VERSION}
- LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
+ OUTPUT_NAME LLDB
+ VERSION ${LLDB_VERSION}
+ LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
- # Compatibility version
- SOVERSION "1.0.0"
+ # Compatibility version
+ SOVERSION "1.0.0"
- MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
- MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
- MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
- MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
-)
+ MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
+ MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
+ MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
+ MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
+ )
+else()
+ set_target_properties(liblldb PROPERTIES
+ FRAMEWORK ON
+ FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
+
+ # Note: iOS doesn't specify version, as the framework layout is flat.
+ OUTPUT_NAME LLDB
+ LIBRARY_OUTPUT_DIRECTORY ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}
+
+ MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
+ MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
+ MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
+ MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
+ )
+endif()
# Used in llvm_add_library() to set default output directories for multi-config
# generators. Overwrite to account for special framework output directory.
@@ -30,7 +46,7 @@ set_output_directory(liblldb
lldb_add_post_install_steps_darwin(liblldb ${LLDB_FRAMEWORK_INSTALL_DIR})
# Affects the layout of the framework bundle (default is macOS layout).
-if(IOS)
+if(APPLE_EMBEDDED)
set_target_properties(liblldb PROPERTIES
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONEOS_DEPLOYMENT_TARGET}")
else()
@@ -41,13 +57,16 @@ endif()
# Add -Wdocumentation parameter
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_DOCUMENTATION_COMMENTS "YES")
-# Apart from this one, CMake creates all required symlinks in the framework bundle.
-add_custom_command(TARGET liblldb POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E create_symlink
- Versions/Current/Headers
- ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Headers
- COMMENT "LLDB.framework: create Headers symlink"
-)
+# On iOS, there is no versioned framework layout. Skip this symlink step.
+if(NOT APPLE_EMBEDDED)
+ # Apart from this one, CMake creates all required symlinks in the framework bundle.
+ add_custom_command(TARGET liblldb POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ Versions/Current/Headers
+ ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Headers
+ COMMENT "LLDB.framework: create Headers symlink"
+ )
+endif()
# At configuration time, collect headers for the framework bundle and copy them
# into a staging directory. Later we can copy over the entire folder.
@@ -79,16 +98,14 @@ add_dependencies(liblldb liblldb-resource-headers)
# At build time, copy the staged headers into the framework bundle (and do
# some post-processing in-place).
-if (NOT IOS)
add_custom_command(TARGET liblldb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} $<TARGET_FILE_DIR:liblldb>/Headers
COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $<TARGET_FILE_DIR:liblldb>/Headers ${LLDB_VERSION}
COMMENT "LLDB.framework: copy framework headers"
)
-endif()
# Copy vendor-specific headers from clang (without staging).
-if(NOT IOS)
+if(NOT APPLE_EMBEDDED)
if (TARGET clang-resource-headers)
add_dependencies(liblldb clang-resource-headers)
set(clang_resource_headers_dir $<TARGET_PROPERTY:clang-resource-headers,RUNTIME_OUTPUT_DIRECTORY>)
@@ -120,6 +137,16 @@ if(NOT IOS)
)
endif()
+# IOS framework bundles are flat
+if(NOT APPLE_EMBEDDED)
+ add_custom_command(TARGET liblldb POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
+ Versions/Current/XPCServices
+ ${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/XPCServices
+ COMMENT "LLDB.framework: create symlink XPCServices"
+ )
+endif()
+
# Add an rpath pointing to the directory where LLDB.framework is installed.
# This allows frameworks (relying on @rpath) to be installed in the same folder and found at runtime.
set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH
diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
index add503a5f36a..7456cb98bfa1 100644
--- a/lldb/source/Host/CMakeLists.txt
+++ b/lldb/source/Host/CMakeLists.txt
@@ -93,7 +93,7 @@ else()
macosx/cfcpp/CFCMutableSet.cpp
macosx/cfcpp/CFCString.cpp
)
- if(IOS)
+ if(APPLE_EMBEDDED)
set_property(SOURCE macosx/Host.mm APPEND PROPERTY
COMPILE_DEFINITIONS "NO_XPC_SERVICES=1")
endif()
diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt
index 1fa880381821..0ed6280168f3 100644
--- a/lldb/tools/debugserver/source/CMakeLists.txt
+++ b/lldb/tools/debugserver/source/CMakeLists.txt
@@ -99,7 +99,7 @@ set_property(GLOBAL PROPERTY
LLDB_DEBUGSERVER_CODESIGN_IDENTITY ${debugserver_codesign_identity})
if(APPLE)
- if(IOS)
+ if(APPLE_EMBEDDED)
find_library(BACKBOARD_LIBRARY BackBoardServices
PATHS ${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks)
find_library(FRONTBOARD_LIBRARY FrontBoardServices
@@ -121,7 +121,7 @@ if(HAVE_LIBCOMPRESSION)
endif()
if(LLDB_USE_ENTITLEMENTS)
- if(IOS)
+ if(APPLE_EMBEDDED)
set(entitlements ${CMAKE_CURRENT_SOURCE_DIR}/debugserver-entitlements.plist)
else()
# Same entitlements file as used for lldb-server
@@ -260,7 +260,7 @@ endif()
set_target_properties(debugserver PROPERTIES FOLDER "lldb libraries/debugserver")
-if(IOS)
+if(APPLE_EMBEDDED)
set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_DEFINITIONS
WITH_LOCKDOWN
WITH_FBS
diff --git a/lldb/tools/lldb-server/CMakeLists.txt b/lldb/tools/lldb-server/CMakeLists.txt
index 7443c6c90e8c..02453b205deb 100644
--- a/lldb/tools/lldb-server/CMakeLists.txt
+++ b/lldb/tools/lldb-server/CMakeLists.txt
@@ -16,7 +16,7 @@ else()
list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF)
endif()
-if(IOS)
+if(APPLE_EMBEDDED)
if(LLDB_CODESIGN_IDENTITY)
# Use explicit LLDB identity
set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY})
diff --git a/lldb/unittests/debugserver/CMakeLists.txt b/lldb/unittests/debugserver/CMakeLists.txt
index 415336948d0f..fd488c1623b8 100644
--- a/lldb/unittests/debugserver/CMakeLists.txt
+++ b/lldb/unittests/debugserver/CMakeLists.txt
@@ -21,7 +21,7 @@ target_include_directories(debugserverTests PRIVATE
${LLDB_SOURCE_DIR}/tools/debugserver/source
${LLDB_SOURCE_DIR}/tools/debugserver/source/MacOSX)
-if(IOS)
+if(APPLE_EMBEDDED)
set_property(TARGET debugserverTests APPEND PROPERTY COMPILE_DEFINITIONS
WITH_LOCKDOWN
WITH_FBS
More information about the lldb-commits
mailing list