1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
add_definitions( -DEXPORT_LIBLLDB )
endif()
get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
if(LLDB_BUILD_FRAMEWORK)
set(option_install_prefix INSTALL_PREFIX ${LLDB_FRAMEWORK_INSTALL_DIR})
set(option_framework FRAMEWORK)
endif()
if(LLDB_ENABLE_PYTHON)
get_target_property(python_bindings_dir swig_wrapper_python BINARY_DIR)
set(lldb_python_wrapper ${python_bindings_dir}/LLDBWrapPython.cpp)
endif()
if(LLDB_ENABLE_LUA)
get_target_property(lua_bindings_dir swig_wrapper_lua BINARY_DIR)
set(lldb_lua_wrapper ${lua_bindings_dir}/LLDBWrapLua.cpp)
endif()
set(output_name lldb)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(output_name liblldb)
endif()
add_lldb_library(liblldb SHARED OUTPUT_NAME ${output_name} SONAME
SBAddress.cpp
SBAttachInfo.cpp
SBBlock.cpp
SBBreakpoint.cpp
SBBreakpointLocation.cpp
SBBreakpointName.cpp
SBBreakpointOptionCommon.cpp
SBBroadcaster.cpp
SBCommandInterpreter.cpp
SBCommandInterpreterRunOptions.cpp
SBCommandReturnObject.cpp
SBCommunication.cpp
SBCompileUnit.cpp
SBData.cpp
SBDebugger.cpp
SBDeclaration.cpp
SBEnvironment.cpp
SBError.cpp
SBEvent.cpp
SBExecutionContext.cpp
SBExpressionOptions.cpp
SBFileSpec.cpp
SBFile.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
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}
${lldb_lua_wrapper}
LINK_LIBS
lldbBase
lldbBreakpoint
lldbCore
lldbDataFormatters
lldbExpression
lldbHost
lldbInitialization
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
${LLDB_ALL_PLUGINS}
LINK_COMPONENTS
Support
${option_install_prefix}
)
# lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,
# which depends on lib/libLLVM*.so (BUILD_SHARED_LIBS) or lib/libLLVM-10git.so
# (LLVM_LINK_LLVM_DYLIB). Add an additional rpath $ORIGIN/../../../../lib so
# that _lldb.so can be loaded from Python.
if(LLDB_ENABLE_PYTHON AND (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB) AND UNIX AND NOT APPLE)
set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}")
endif()
if(Python3_RPATH)
set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "${Python3_RPATH}")
set_property(TARGET liblldb APPEND PROPERTY BUILD_RPATH "${Python3_RPATH}")
endif()
if(LLDB_ENABLE_PYTHON)
add_dependencies(liblldb swig_wrapper_python)
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()
if(LLDB_ENABLE_LUA)
add_dependencies(liblldb swig_wrapper_lua)
target_include_directories(liblldb PRIVATE ${LUA_INCLUDE_DIR})
if (MSVC)
set_property(SOURCE ${lldb_lua_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
else()
set_property(SOURCE ${lldb_lua_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
endif()
set_source_files_properties(${lldb_lua_wrapper} PROPERTIES GENERATED ON)
endif()
set_target_properties(liblldb
PROPERTIES
VERSION 1
)
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 (NOT MSVC)
# set_target_properties(liblldb
# PROPERTIES
# OUTPUT_NAME lldb
# )
#endif()
# The Clang expression parser in LLDB requires the Clang resource directory to function.
if (TARGET clang-resource-headers)
# If building alongside Clang, just add a dependency to ensure it is build together with liblldb.
add_dependencies(liblldb clang-resource-headers)
else()
# In a standalone build create a symlink from the LLDB library directory that points to the
# resource directory in the Clang library directory. LLDB searches relative to its install path,
# and the symlink is created in the same relative path as the resource directory of Clang when
# building alongside Clang.
# When building the LLDB framework, this isn't necessary as there we copy everything we need into
# the framework (including the Clang resourece directory).
if(NOT LLDB_BUILD_FRAMEWORK)
set(LLDB_CLANG_RESOURCE_DIR_PARENT "$<TARGET_FILE_DIR:liblldb>/clang")
file(MAKE_DIRECTORY "${LLDB_CLANG_RESOURCE_DIR_PARENT}")
add_custom_command(TARGET liblldb POST_BUILD
COMMENT "Linking Clang resource dir into LLDB build directory: ${LLDB_CLANG_RESOURCE_DIR_PARENT}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${LLDB_CLANG_RESOURCE_DIR_PARENT}"
COMMAND ${CMAKE_COMMAND} -E create_symlink "${LLDB_EXTERNAL_CLANG_RESOURCE_DIR}"
"${LLDB_CLANG_RESOURCE_DIR_PARENT}/${LLDB_CLANG_RESOURCE_DIR_NAME}"
)
endif()
endif()
if(LLDB_BUILD_FRAMEWORK)
include(LLDBFramework)
endif()
|