2015-02-18 06:20:20 +08:00
|
|
|
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
2015-02-25 06:17:57 +08:00
|
|
|
add_definitions( -DEXPORT_LIBLLDB )
|
2015-02-18 06:20:20 +08:00
|
|
|
endif()
|
|
|
|
|
2016-09-22 05:02:16 +08:00
|
|
|
option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
|
|
|
|
|
2016-12-16 02:18:47 +08:00
|
|
|
if(LLDB_BUILD_FRAMEWORK AND CMAKE_VERSION VERSION_LESS 3.7)
|
|
|
|
message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
|
|
|
|
endif()
|
|
|
|
|
2016-09-22 05:02:16 +08:00
|
|
|
if (LLDB_BUILD_FRAMEWORK AND NOT APPLE)
|
|
|
|
message(FATAL_ERROR "LLDB.framework cannot be generated unless targeting Apple platforms.")
|
|
|
|
endif()
|
|
|
|
|
2017-02-09 05:00:46 +08:00
|
|
|
get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
|
|
|
|
|
2015-03-19 00:56:24 +08:00
|
|
|
add_lldb_library(liblldb SHARED
|
2013-09-25 18:37:32 +08:00
|
|
|
SBAddress.cpp
|
2015-02-16 08:04:19 +08:00
|
|
|
SBAttachInfo.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBBlock.cpp
|
|
|
|
SBBreakpoint.cpp
|
|
|
|
SBBreakpointLocation.cpp
|
2017-09-15 04:31:02 +08:00
|
|
|
SBBreakpointName.cpp
|
|
|
|
SBBreakpointOptionCommon.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBBroadcaster.cpp
|
|
|
|
SBCommandInterpreter.cpp
|
|
|
|
SBCommandReturnObject.cpp
|
|
|
|
SBCommunication.cpp
|
|
|
|
SBCompileUnit.cpp
|
|
|
|
SBData.cpp
|
|
|
|
SBDebugger.cpp
|
|
|
|
SBDeclaration.cpp
|
|
|
|
SBError.cpp
|
|
|
|
SBEvent.cpp
|
2014-10-02 05:33:28 +08:00
|
|
|
SBExecutionContext.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBExpressionOptions.cpp
|
|
|
|
SBFileSpec.cpp
|
|
|
|
SBFileSpecList.cpp
|
|
|
|
SBFrame.cpp
|
|
|
|
SBFunction.cpp
|
|
|
|
SBHostOS.cpp
|
|
|
|
SBInstruction.cpp
|
|
|
|
SBInstructionList.cpp
|
2015-04-28 20:51:16 +08:00
|
|
|
SBLanguageRuntime.cpp
|
2015-02-05 07:19:15 +08:00
|
|
|
SBLaunchInfo.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBLineEntry.cpp
|
|
|
|
SBListener.cpp
|
2016-06-23 16:35:37 +08:00
|
|
|
SBMemoryRegionInfo.cpp
|
|
|
|
SBMemoryRegionInfoList.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBModule.cpp
|
|
|
|
SBModuleSpec.cpp
|
2013-11-21 22:38:22 +08:00
|
|
|
SBPlatform.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBProcess.cpp
|
2017-08-01 15:34:26 +08:00
|
|
|
SBProcessInfo.cpp
|
2013-12-13 08:29:16 +08:00
|
|
|
SBQueue.cpp
|
|
|
|
SBQueueItem.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBSection.cpp
|
|
|
|
SBSourceManager.cpp
|
|
|
|
SBStream.cpp
|
|
|
|
SBStringList.cpp
|
2016-08-19 12:21:48 +08:00
|
|
|
SBStructuredData.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBSymbol.cpp
|
|
|
|
SBSymbolContext.cpp
|
|
|
|
SBSymbolContextList.cpp
|
|
|
|
SBTarget.cpp
|
|
|
|
SBThread.cpp
|
2014-09-06 09:22:55 +08:00
|
|
|
SBThreadCollection.cpp
|
2014-09-30 23:58:56 +08:00
|
|
|
SBThreadPlan.cpp
|
2017-04-26 16:48:50 +08:00
|
|
|
SBTrace.cpp
|
|
|
|
SBTraceOptions.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBType.cpp
|
|
|
|
SBTypeCategory.cpp
|
2014-06-03 04:55:29 +08:00
|
|
|
SBTypeEnumMember.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBTypeFilter.cpp
|
|
|
|
SBTypeFormat.cpp
|
|
|
|
SBTypeNameSpecifier.cpp
|
|
|
|
SBTypeSummary.cpp
|
|
|
|
SBTypeSynthetic.cpp
|
|
|
|
SBValue.cpp
|
|
|
|
SBValueList.cpp
|
2015-02-18 01:55:50 +08:00
|
|
|
SBVariablesOptions.cpp
|
2013-09-25 18:37:32 +08:00
|
|
|
SBWatchpoint.cpp
|
2014-06-24 03:30:49 +08:00
|
|
|
SBUnixSignals.cpp
|
2015-04-01 05:03:22 +08:00
|
|
|
SystemInitializerFull.cpp
|
2015-03-19 00:56:24 +08:00
|
|
|
${LLDB_WRAP_PYTHON}
|
2017-02-09 05:00:46 +08:00
|
|
|
|
|
|
|
LINK_LIBS
|
|
|
|
lldbBase
|
|
|
|
lldbBreakpoint
|
|
|
|
lldbCore
|
|
|
|
lldbDataFormatters
|
|
|
|
lldbExpression
|
|
|
|
lldbHost
|
|
|
|
lldbInitialization
|
|
|
|
lldbInterpreter
|
|
|
|
lldbSymbol
|
|
|
|
lldbTarget
|
2017-02-14 05:16:01 +08:00
|
|
|
lldbUtility
|
2017-02-09 05:00:46 +08:00
|
|
|
${LLDB_ALL_PLUGINS}
|
|
|
|
LINK_COMPONENTS
|
|
|
|
Support
|
2015-03-19 00:56:24 +08:00
|
|
|
)
|
|
|
|
|
2016-10-06 01:07:16 +08:00
|
|
|
if (LLVM_ENABLE_WERROR)
|
|
|
|
if (MSVC)
|
|
|
|
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
|
|
|
|
else()
|
|
|
|
set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
|
|
|
|
endif()
|
|
|
|
endif()
|
2017-10-31 21:23:19 +08:00
|
|
|
set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
|
|
|
|
if (CLANG_CL)
|
|
|
|
set_property(SOURCE ${LLDB_WRAP_PYTHON} 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_WRAP_PYTHON} APPEND_STRING
|
|
|
|
PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
|
|
|
|
endif ()
|
2016-10-06 01:07:16 +08:00
|
|
|
|
2015-07-31 04:28:07 +08:00
|
|
|
target_link_libraries(liblldb PRIVATE
|
|
|
|
lldbPluginScriptInterpreterNone
|
|
|
|
lldbPluginScriptInterpreterPython
|
|
|
|
)
|
|
|
|
|
2015-03-19 00:56:24 +08:00
|
|
|
set_target_properties(liblldb
|
|
|
|
PROPERTIES
|
|
|
|
VERSION ${LLDB_VERSION}
|
2013-09-25 18:37:32 +08:00
|
|
|
)
|
2015-03-19 00:56:24 +08:00
|
|
|
|
2015-09-04 08:00:41 +08:00
|
|
|
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
2015-10-14 22:52:15 +08:00
|
|
|
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.
|
2016-10-29 08:29:15 +08:00
|
|
|
MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace")
|
2015-10-14 22:52:15 +08:00
|
|
|
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.
|
2016-10-29 08:29:15 +08:00
|
|
|
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)
|
2015-10-14 22:52:15 +08:00
|
|
|
endif()
|
2015-09-04 08:00:41 +08:00
|
|
|
endif()
|
|
|
|
|
2015-03-19 00:56:24 +08:00
|
|
|
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()
|
|
|
|
|
2015-10-09 11:40:55 +08:00
|
|
|
if (LLDB_WRAP_PYTHON)
|
2015-03-19 00:56:24 +08:00
|
|
|
add_dependencies(liblldb swig_wrapper)
|
|
|
|
endif()
|
|
|
|
|
2016-09-22 05:02:16 +08:00
|
|
|
if(LLDB_BUILD_FRAMEWORK)
|
2017-07-26 04:30:58 +08:00
|
|
|
file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h
|
|
|
|
${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
|
|
|
|
file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
|
2017-07-28 23:39:51 +08:00
|
|
|
file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
|
|
|
|
list(REMOVE_ITEM root_public_headers ${root_private_headers})
|
2017-07-26 04:30:58 +08:00
|
|
|
|
2017-07-29 04:27:38 +08:00
|
|
|
foreach(header ${public_headers} ${root_public_headers} ${LLDB_SOURCE_DIR}/include/lldb/Utility/SharingPtr.h)
|
2017-07-26 04:30:58 +08:00
|
|
|
get_filename_component(basename ${header} NAME)
|
2017-07-28 23:39:51 +08:00
|
|
|
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename}
|
|
|
|
DEPENDS ${header}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${header} ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
|
2017-07-26 04:30:58 +08:00
|
|
|
list(APPEND framework_headers ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
|
|
|
|
endforeach()
|
|
|
|
|
2017-07-28 23:39:51 +08:00
|
|
|
add_custom_target(lldb-framework-headers DEPENDS ${framework_headers}
|
|
|
|
COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders ${LLDB_VERSION})
|
2017-07-26 04:30:58 +08:00
|
|
|
add_dependencies(liblldb lldb-framework-headers)
|
|
|
|
|
2016-09-22 05:02:16 +08:00
|
|
|
set_target_properties(liblldb PROPERTIES
|
|
|
|
OUTPUT_NAME LLDB
|
|
|
|
FRAMEWORK On
|
|
|
|
FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
|
2016-10-15 01:09:55 +08:00
|
|
|
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}
|
2017-07-26 04:30:58 +08:00
|
|
|
PUBLIC_HEADER "${framework_headers}")
|
2016-10-15 01:09:55 +08:00
|
|
|
|
2017-07-26 04:31:15 +08:00
|
|
|
if(NOT IOS)
|
|
|
|
add_custom_command(TARGET liblldb POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $<TARGET_FILE_DIR:liblldb>/Headers
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Versions/Current
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
add_custom_command(TARGET liblldb POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $<TARGET_FILE_DIR:liblldb>/Headers
|
|
|
|
)
|
|
|
|
endif()
|
2017-07-26 04:30:58 +08:00
|
|
|
|
2016-09-22 05:02:16 +08:00
|
|
|
endif()
|
|
|
|
|