diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -267,7 +267,7 @@ # 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 --- a/lldb/cmake/modules/LLDBFramework.cmake +++ b/lldb/cmake/modules/LLDBFramework.cmake @@ -3,22 +3,38 @@ 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 @@ 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 @@ # 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 @@ # 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} $/Headers COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $/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 $) @@ -120,6 +137,16 @@ ) 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 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -93,7 +93,7 @@ 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 --- a/lldb/tools/debugserver/source/CMakeLists.txt +++ b/lldb/tools/debugserver/source/CMakeLists.txt @@ -99,7 +99,7 @@ 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 @@ 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 @@ 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 --- a/lldb/tools/lldb-server/CMakeLists.txt +++ b/lldb/tools/lldb-server/CMakeLists.txt @@ -16,7 +16,7 @@ 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 --- a/lldb/unittests/debugserver/CMakeLists.txt +++ b/lldb/unittests/debugserver/CMakeLists.txt @@ -21,7 +21,7 @@ ${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