Summary: There's a number of requirements for installing LLDB on macOS that are untypical for LLVM projects: use special install-prefix for LLDB.framework, ship headers and tools as framework resources, patch RPATHs, externalize debug-info to dSYM's and strip binaries with `-ST`. For some of it we could use `llvm_externalize_debuginfo()` in the past and just add special cases. However, this complicates the code for all projects and comes with the major drawback, that it adds all these actions at build-time, i.e. dSYM creation and stripping take a lot of time and don't make sense at build-time. LLVM's distribution mechanism (https://llvm.org/docs/BuildingADistribution.html) appears to be the natural candidate to install LLDB. Based on D64399 (enable in standalone builds), this patch integrates framework installation with the distribution mechanism and adds custom stripping flags and dSYM creation at install-time. Unlike the abandoned D61952, it leaves build-tree binaries untouched, so there's no side-effects on testing. Potential install-order issues must be handled externally. Please let me know what you think, while I run a few more tests and add remarks+documentation. Reviewers: xiaobai, compnerd, JDevlieghere, davide, labath, mgorny Reviewed By: xiaobai, JDevlieghere Subscribers: lldb-commits, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D64408 llvm-svn: 365617
172 lines
4.3 KiB
CMake
172 lines
4.3 KiB
CMake
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
add_definitions( -DEXPORT_LIBLLDB )
|
|
endif()
|
|
|
|
get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
|
|
|
|
if(NOT LLDB_DISABLE_PYTHON)
|
|
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
|
|
set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
|
|
endif()
|
|
|
|
if(LLDB_BUILD_FRAMEWORK)
|
|
set(option_install_prefix INSTALL_PREFIX ${LLDB_FRAMEWORK_INSTALL_DIR})
|
|
endif()
|
|
|
|
add_lldb_library(liblldb SHARED
|
|
SBAddress.cpp
|
|
SBAttachInfo.cpp
|
|
SBBlock.cpp
|
|
SBBreakpoint.cpp
|
|
SBBreakpointLocation.cpp
|
|
SBBreakpointName.cpp
|
|
SBBreakpointOptionCommon.cpp
|
|
SBBroadcaster.cpp
|
|
SBCommandInterpreter.cpp
|
|
SBCommandReturnObject.cpp
|
|
SBCommunication.cpp
|
|
SBCompileUnit.cpp
|
|
SBData.cpp
|
|
SBDebugger.cpp
|
|
SBDeclaration.cpp
|
|
SBError.cpp
|
|
SBEvent.cpp
|
|
SBExecutionContext.cpp
|
|
SBExpressionOptions.cpp
|
|
SBFileSpec.cpp
|
|
SBFileSpecList.cpp
|
|
SBFrame.cpp
|
|
SBFunction.cpp
|
|
SBHostOS.cpp
|
|
SBInstruction.cpp
|
|
SBInstructionList.cpp
|
|
SBLanguageRuntime.cpp
|
|
SBLaunchInfo.cpp
|
|
SBLineEntry.cpp
|
|
SBListener.cpp
|
|
SBMemoryRegionInfo.cpp
|
|
SBMemoryRegionInfoList.cpp
|
|
SBModule.cpp
|
|
SBModuleSpec.cpp
|
|
SBPlatform.cpp
|
|
SBProcess.cpp
|
|
SBProcessInfo.cpp
|
|
SBQueue.cpp
|
|
SBQueueItem.cpp
|
|
SBReproducer.cpp
|
|
SBSection.cpp
|
|
SBSourceManager.cpp
|
|
SBStream.cpp
|
|
SBStringList.cpp
|
|
SBStructuredData.cpp
|
|
SBSymbol.cpp
|
|
SBSymbolContext.cpp
|
|
SBSymbolContextList.cpp
|
|
SBTarget.cpp
|
|
SBThread.cpp
|
|
SBThreadCollection.cpp
|
|
SBThreadPlan.cpp
|
|
SBTrace.cpp
|
|
SBTraceOptions.cpp
|
|
SBType.cpp
|
|
SBTypeCategory.cpp
|
|
SBTypeEnumMember.cpp
|
|
SBTypeFilter.cpp
|
|
SBTypeFormat.cpp
|
|
SBTypeNameSpecifier.cpp
|
|
SBTypeSummary.cpp
|
|
SBTypeSynthetic.cpp
|
|
SBValue.cpp
|
|
SBValueList.cpp
|
|
SBVariablesOptions.cpp
|
|
SBWatchpoint.cpp
|
|
SBUnixSignals.cpp
|
|
SystemInitializerFull.cpp
|
|
${lldb_python_wrapper}
|
|
|
|
LINK_LIBS
|
|
lldbBase
|
|
lldbBreakpoint
|
|
lldbCore
|
|
lldbDataFormatters
|
|
lldbExpression
|
|
lldbHost
|
|
lldbInitialization
|
|
lldbInterpreter
|
|
lldbSymbol
|
|
lldbTarget
|
|
lldbUtility
|
|
${LLDB_ALL_PLUGINS}
|
|
LINK_COMPONENTS
|
|
Support
|
|
|
|
${option_install_prefix}
|
|
)
|
|
|
|
if (MSVC)
|
|
set_source_files_properties(SBReproducer.cpp PROPERTIES COMPILE_FLAGS /bigobj)
|
|
endif()
|
|
|
|
if(lldb_python_wrapper)
|
|
add_dependencies(liblldb swig_wrapper)
|
|
|
|
if (MSVC)
|
|
set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
|
|
else()
|
|
set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
|
|
endif()
|
|
|
|
set_source_files_properties(${lldb_python_wrapper} PROPERTIES GENERATED ON)
|
|
if (CLANG_CL)
|
|
set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
|
|
PROPERTY COMPILE_FLAGS " -Wno-unused-function")
|
|
endif()
|
|
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
|
|
NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
|
set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
|
|
PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
|
|
endif ()
|
|
endif()
|
|
|
|
set_target_properties(liblldb
|
|
PROPERTIES
|
|
VERSION ${LLDB_VERSION}
|
|
)
|
|
|
|
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|
if (NOT LLDB_EXPORT_ALL_SYMBOLS)
|
|
# If we're not exporting all symbols, we'll want to explicitly set
|
|
# the exported symbols here. This prevents 'log enable --stack ...'
|
|
# from working on some systems but limits the liblldb size.
|
|
MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace")
|
|
add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports)
|
|
else()
|
|
# Don't use an explicit export. Instead, tell the linker to
|
|
# export all symbols.
|
|
MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and lldb_private namespaces")
|
|
add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports)
|
|
endif()
|
|
set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
|
|
endif()
|
|
|
|
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
|
# Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
|
|
# so only it needs to explicitly link against ${PYTHON_LIBRARY}
|
|
if (MSVC AND NOT LLDB_DISABLE_PYTHON)
|
|
target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY})
|
|
endif()
|
|
else()
|
|
set_target_properties(liblldb
|
|
PROPERTIES
|
|
OUTPUT_NAME lldb
|
|
)
|
|
endif()
|
|
|
|
if (NOT LLDB_BUILT_STANDALONE)
|
|
add_dependencies(liblldb clang-resource-headers)
|
|
endif()
|
|
|
|
if(LLDB_BUILD_FRAMEWORK)
|
|
include(LLDBFramework)
|
|
endif()
|