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 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
|
include_directories(.)
if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
include_directories(
Plugins/Process/Linux
Plugins/Process/POSIX
)
endif ()
if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
include_directories(
Plugins/Process/FreeBSD
Plugins/Process/POSIX
)
endif ()
# Need to export the API in the liblldb.dll for Windows
# The lldbAPI source files are added directly in liblldb
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
add_subdirectory(API)
endif ()
add_subdirectory(Breakpoint)
add_subdirectory(Commands)
add_subdirectory(Core)
add_subdirectory(DataFormatters)
add_subdirectory(Expression)
add_subdirectory(Host)
add_subdirectory(Interpreter)
add_subdirectory(Plugins)
add_subdirectory(Symbol)
add_subdirectory(Target)
add_subdirectory(Utility)
set( LLDB_USED_LIBS
lldbBreakpoint
lldbCommands
lldbDataFormatters
lldbHostCommon
lldbCore
lldbExpression
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
# Plugins
lldbPluginDisassemblerLLVM
lldbPluginSymbolFileDWARF
lldbPluginSymbolFileSymtab
lldbPluginDynamicLoaderStatic
lldbPluginDynamicLoaderPosixDYLD
lldbPluginDynamicLoaderHexagonDYLD
lldbPluginObjectFileMachO
lldbPluginObjectFileELF
lldbPluginObjectFileJIT
lldbPluginSymbolVendorELF
lldbPluginObjectContainerBSDArchive
lldbPluginObjectContainerMachOArchive
lldbPluginProcessGDBRemote
lldbPluginProcessMachCore
lldbPluginProcessUtility
lldbPluginPlatformGDB
lldbPluginPlatformFreeBSD
lldbPluginPlatformKalimba
lldbPluginPlatformLinux
lldbPluginPlatformPOSIX
lldbPluginPlatformWindows
lldbPluginObjectFileMachO
lldbPluginObjectContainerMachOArchive
lldbPluginObjectContainerBSDArchive
lldbPluginPlatformMacOSX
lldbPluginDynamicLoaderMacOSXDYLD
lldbPluginUnwindAssemblyInstEmulation
lldbPluginUnwindAssemblyX86
lldbPluginAppleObjCRuntime
lldbPluginCXXItaniumABI
lldbPluginABIMacOSX_arm
lldbPluginABIMacOSX_arm64
lldbPluginABIMacOSX_i386
lldbPluginABISysV_x86_64
lldbPluginABISysV_hexagon
lldbPluginInstructionARM
lldbPluginInstructionARM64
lldbPluginObjectFilePECOFF
lldbPluginOSPython
)
# Need to export the API in the liblldb.dll for Windows
# The lldbAPI source files are added directly in liblldb
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
list(APPEND LLDB_USED_LIBS
lldbAPI
)
endif ()
# Windows-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
list(APPEND LLDB_USED_LIBS
lldbHostWindows
lldbPluginProcessElfCore
lldbPluginJITLoaderGDB
Ws2_32
)
endif ()
# Linux-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
list(APPEND LLDB_USED_LIBS
lldbHostLinux
lldbPluginProcessLinux
lldbPluginProcessPOSIX
lldbPluginProcessElfCore
lldbPluginJITLoaderGDB
)
endif ()
# FreeBSD-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" )
list(APPEND LLDB_USED_LIBS
lldbHostFreeBSD
lldbPluginProcessFreeBSD
lldbPluginProcessPOSIX
lldbPluginProcessElfCore
lldbPluginJITLoaderGDB
)
endif ()
# Darwin-only libraries
if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
> ${LLDB_VERS_GENERATED_FILE})
set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
list(APPEND LLDB_USED_LIBS
lldbHostMacOSX
lldbPluginDynamicLoaderDarwinKernel
lldbPluginProcessMacOSXKernel
lldbPluginSymbolVendorMacOSX
lldbPluginSystemRuntimeMacOSX
lldbPluginProcessPOSIX
lldbPluginProcessElfCore
lldbPluginJITLoaderGDB
)
endif()
set( CLANG_USED_LIBS
clangAnalysis
clangAST
clangBasic
clangCodeGen
clangDriver
clangEdit
clangFrontend
clangLex
clangParse
clangRewrite
clangRewriteFrontend
clangSema
clangSerialization
)
set(LLDB_SYSTEM_LIBS)
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
list(APPEND LLDB_SYSTEM_LIBS edit panel ncurses)
endif()
# On FreeBSD backtrace() is provided by libexecinfo, not libc.
if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
list(APPEND LLDB_SYSTEM_LIBS execinfo)
endif()
if (NOT LLDB_DISABLE_PYTHON)
list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
endif()
list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
set( LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
jit
interpreter
asmparser
bitreader
bitwriter
codegen
ipo
selectiondag
bitreader
mc
mcjit
core
mcdisassembler
executionengine
option
)
if ( NOT LLDB_DISABLE_PYTHON )
set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
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")
endif ()
endif()
set(SHARED_LIBRARY 1)
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
add_definitions( -DEXPORT_LIBLLDB )
endif()
# Need to export the API in the liblldb.dll for Windows
# The lldbAPI source files are added directly in liblldb
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
# On Non-Windows, the corresponding file list is maintained in
# source\API\CMakeLists.txt. When editing this list, do not forget to make a
# corresponding change in that file as well (when appropriate).
add_lldb_library(liblldb
lldb.cpp
lldb-log.cpp
API/SBAddress.cpp
API/SBBlock.cpp
API/SBBreakpoint.cpp
API/SBBreakpointLocation.cpp
API/SBBroadcaster.cpp
API/SBCommandInterpreter.cpp
API/SBCommandReturnObject.cpp
API/SBCommunication.cpp
API/SBCompileUnit.cpp
API/SBData.cpp
API/SBDebugger.cpp
API/SBDeclaration.cpp
API/SBError.cpp
API/SBEvent.cpp
API/SBExpressionOptions.cpp
API/SBFileSpec.cpp
API/SBFileSpecList.cpp
API/SBFrame.cpp
API/SBFunction.cpp
API/SBHostOS.cpp
API/SBInstruction.cpp
API/SBInstructionList.cpp
API/SBLineEntry.cpp
API/SBListener.cpp
API/SBModule.cpp
API/SBModuleSpec.cpp
API/SBPlatform.cpp
API/SBProcess.cpp
API/SBQueue.cpp
API/SBQueueItem.cpp
API/SBSection.cpp
API/SBSourceManager.cpp
API/SBStream.cpp
API/SBStringList.cpp
API/SBSymbol.cpp
API/SBSymbolContext.cpp
API/SBSymbolContextList.cpp
API/SBTarget.cpp
API/SBThread.cpp
API/SBType.cpp
API/SBTypeCategory.cpp
API/SBTypeEnumMember.cpp
API/SBTypeFilter.cpp
API/SBTypeFormat.cpp
API/SBTypeNameSpecifier.cpp
API/SBTypeSummary.cpp
API/SBTypeSynthetic.cpp
API/SBUnixSignals.cpp
API/SBValue.cpp
API/SBValueList.cpp
API/SBWatchpoint.cpp
Host/Windows/getopt/GetOptInc.cpp
${LLDB_WRAP_PYTHON}
${LLDB_VERS_GENERATED_FILE}
)
else ()
add_lldb_library(liblldb
lldb.cpp
lldb-log.cpp
${LLDB_WRAP_PYTHON}
${LLDB_VERS_GENERATED_FILE}
)
endif ()
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
set_target_properties(liblldb
PROPERTIES
OUTPUT_NAME liblldb
VERSION ${LLDB_VERSION}
)
else()
set_target_properties(liblldb
PROPERTIES
OUTPUT_NAME lldb
VERSION ${LLDB_VERSION}
)
endif()
if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
add_dependencies(liblldb
swig_wrapper
${LLDB_WRAP_PYTHON}
${LLDB_VERS_GENERATED_FILE}
)
endif()
target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS})
# Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as
# such will not work on Windows.
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR}
OUTPUT_VARIABLE LLDB_REVISION)
if ( LLDB_REVISION )
string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION})
endif()
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR}
OUTPUT_VARIABLE LLDB_REPOSITORY)
if ( LLDB_REPOSITORY )
# Replace newline characters with spaces
string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY})
# Remove trailing spaces
string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY})
endif()
set_property(
SOURCE lldb.cpp
PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"")
endif ()
# FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only
# revision parsing solution in tools/clang/lib/Basic/CMakelists.txt.
if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION )
# Add a Post-Build Event to copy over Python files and create the symlink to liblldb.so for the Python API(hardlink on Windows)
if ( NOT LLDB_DISABLE_PYTHON )
add_custom_command( TARGET liblldb
POST_BUILD
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/finishSwigWrapperClasses.py --buildConfig=${CMAKE_BUILD_TYPE} "--srcRoot=${LLDB_SOURCE_DIR}" "--targetDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--cfgBldDir=${CMAKE_CURRENT_BINARY_DIR}/../scripts" "--prefix=${CMAKE_BINARY_DIR}" "--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}" -m
COMMENT "Python script sym-linking LLDB Python API")
endif ()
endif ()
install(TARGETS liblldb
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
|