| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 1 | include_directories(.) |
| 2 | |
| 3 | if ( CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
| 4 | include_directories( |
| 5 | Plugins/Process/Linux |
| 6 | Plugins/Process/POSIX |
| 7 | ) |
| 8 | endif () |
| 9 | |
| 10 | if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" ) |
| 11 | include_directories( |
| 12 | Plugins/Process/FreeBSD |
| 13 | Plugins/Process/POSIX |
| 14 | ) |
| 15 | endif () |
| 16 | |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 17 | # Need to export the API in the liblldb.dll for Windows |
| 18 | # The lldbAPI source files are added directly in liblldb |
| 19 | if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 20 | add_subdirectory(API) |
| 21 | endif () |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 22 | add_subdirectory(Breakpoint) |
| 23 | add_subdirectory(Commands) |
| 24 | add_subdirectory(Core) |
| 25 | add_subdirectory(DataFormatters) |
| 26 | add_subdirectory(Expression) |
| 27 | add_subdirectory(Host) |
| 28 | add_subdirectory(Interpreter) |
| 29 | add_subdirectory(Plugins) |
| 30 | add_subdirectory(Symbol) |
| 31 | add_subdirectory(Target) |
| 32 | add_subdirectory(Utility) |
| 33 | |
| 34 | set( LLDB_USED_LIBS |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 35 | lldbBreakpoint |
| 36 | lldbCommands |
| 37 | lldbDataFormatters |
| 38 | lldbHostCommon |
| 39 | lldbCore |
| 40 | lldbExpression |
| 41 | lldbInterpreter |
| 42 | lldbSymbol |
| 43 | lldbTarget |
| 44 | lldbUtility |
| 45 | |
| 46 | # Plugins |
| 47 | lldbPluginDisassemblerLLVM |
| 48 | lldbPluginSymbolFileDWARF |
| 49 | lldbPluginSymbolFileSymtab |
| 50 | lldbPluginDynamicLoaderStatic |
| 51 | lldbPluginDynamicLoaderPosixDYLD |
| 52 | |
| 53 | lldbPluginObjectFileMachO |
| 54 | lldbPluginObjectFileELF |
| 55 | lldbPluginSymbolVendorELF |
| 56 | lldbPluginObjectContainerBSDArchive |
| 57 | lldbPluginObjectContainerMachOArchive |
| 58 | lldbPluginProcessGDBRemote |
| 59 | lldbPluginProcessMachCore |
| 60 | lldbPluginProcessUtility |
| 61 | lldbPluginPlatformGDB |
| 62 | lldbPluginPlatformFreeBSD |
| 63 | lldbPluginPlatformLinux |
| 64 | lldbPluginPlatformPOSIX |
| Deepak Panickal | a0154f9 | 2013-10-15 12:32:12 +0000 | [diff] [blame] | 65 | lldbPluginPlatformWindows |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 66 | lldbPluginObjectFileMachO |
| 67 | lldbPluginObjectContainerMachOArchive |
| 68 | lldbPluginObjectContainerBSDArchive |
| 69 | lldbPluginPlatformMacOSX |
| 70 | lldbPluginDynamicLoaderMacOSXDYLD |
| 71 | lldbPluginUnwindAssemblyInstEmulation |
| 72 | lldbPluginUnwindAssemblyX86 |
| 73 | lldbPluginAppleObjCRuntime |
| 74 | lldbPluginCXXItaniumABI |
| 75 | lldbPluginABIMacOSX_arm |
| 76 | lldbPluginABIMacOSX_i386 |
| 77 | lldbPluginABISysV_x86_64 |
| 78 | lldbPluginInstructionARM |
| 79 | lldbPluginObjectFilePECOFF |
| 80 | lldbPluginOSPython |
| 81 | ) |
| 82 | |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 83 | # Need to export the API in the liblldb.dll for Windows |
| 84 | # The lldbAPI source files are added directly in liblldb |
| 85 | if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 86 | list(APPEND LLDB_USED_LIBS |
| 87 | lldbAPI |
| 88 | ) |
| 89 | endif () |
| 90 | |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 91 | # Windows-only libraries |
| 92 | if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 93 | list(APPEND LLDB_USED_LIBS |
| 94 | lldbHostWindows |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 95 | Ws2_32 |
| 96 | ) |
| 97 | endif () |
| 98 | |
| 99 | # Linux-only libraries |
| 100 | if ( CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
| 101 | list(APPEND LLDB_USED_LIBS |
| 102 | lldbHostLinux |
| 103 | lldbPluginProcessLinux |
| 104 | lldbPluginProcessPOSIX |
| 105 | lldbPluginProcessElfCore |
| Andrew MacPherson | 17220c1 | 2014-03-05 10:12:43 +0000 | [diff] [blame^] | 106 | lldbPluginJITLoaderGDB |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 107 | ) |
| 108 | endif () |
| 109 | |
| 110 | # FreeBSD-only libraries |
| 111 | if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" ) |
| 112 | list(APPEND LLDB_USED_LIBS |
| 113 | lldbHostFreeBSD |
| 114 | lldbPluginProcessFreeBSD |
| 115 | lldbPluginProcessPOSIX |
| 116 | lldbPluginProcessElfCore |
| 117 | ) |
| 118 | endif () |
| 119 | |
| 120 | # Darwin-only libraries |
| 121 | if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) |
| 122 | set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) |
| 123 | add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} |
| 124 | COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl |
| Todd Fiala | 5000e28 | 2014-01-18 08:05:32 +0000 | [diff] [blame] | 125 | ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 126 | > ${LLDB_VERS_GENERATED_FILE}) |
| 127 | |
| 128 | set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) |
| 129 | list(APPEND LLDB_USED_LIBS |
| 130 | lldbHostMacOSX |
| 131 | lldbPluginDynamicLoaderDarwinKernel |
| 132 | lldbPluginProcessMacOSXKernel |
| 133 | lldbPluginSymbolVendorMacOSX |
| Jason Molenda | a7b5afa | 2013-11-15 00:17:32 +0000 | [diff] [blame] | 134 | lldbPluginSystemRuntimeMacOSX |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 135 | ) |
| 136 | endif() |
| 137 | |
| 138 | set( CLANG_USED_LIBS |
| 139 | clangAnalysis |
| 140 | clangAST |
| 141 | clangBasic |
| 142 | clangCodeGen |
| 143 | clangDriver |
| 144 | clangEdit |
| 145 | clangFrontend |
| 146 | clangLex |
| 147 | clangParse |
| 148 | clangRewriteCore |
| 149 | clangRewriteFrontend |
| 150 | clangSema |
| 151 | clangSerialization |
| 152 | ) |
| 153 | |
| Sylvestre Ledru | f0f2d58 | 2013-11-15 14:15:10 +0000 | [diff] [blame] | 154 | set(LLDB_SYSTEM_LIBS) |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 155 | if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") |
| Todd Fiala | 86dccb3 | 2014-02-26 17:44:00 +0000 | [diff] [blame] | 156 | list(APPEND LLDB_SYSTEM_LIBS edit panel ncurses) |
| Sylvestre Ledru | f0f2d58 | 2013-11-15 14:15:10 +0000 | [diff] [blame] | 157 | endif() |
| Ed Maste | 0121e43 | 2014-02-26 18:21:42 +0000 | [diff] [blame] | 158 | # On FreeBSD backtrace() is provided by libexecinfo, not libc. |
| 159 | if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") |
| 160 | list(APPEND LLDB_SYSTEM_LIBS execinfo) |
| 161 | endif() |
| 162 | |
| Sylvestre Ledru | f0f2d58 | 2013-11-15 14:15:10 +0000 | [diff] [blame] | 163 | if (NOT LLDB_DISABLE_PYTHON) |
| 164 | list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES}) |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 165 | endif() |
| 166 | |
| 167 | set( LLVM_LINK_COMPONENTS |
| 168 | ${LLVM_TARGETS_TO_BUILD} |
| 169 | jit |
| 170 | interpreter |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 171 | asmparser |
| 172 | bitreader |
| 173 | bitwriter |
| 174 | codegen |
| 175 | ipo |
| 176 | selectiondag |
| 177 | bitreader |
| 178 | mc |
| 179 | mcjit |
| 180 | core |
| 181 | mcdisassembler |
| 182 | executionengine |
| Peter Collingbourne | 19676ac | 2013-11-11 04:46:09 +0000 | [diff] [blame] | 183 | option |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 184 | ) |
| 185 | |
| Deepak Panickal | a0154f9 | 2013-10-15 12:32:12 +0000 | [diff] [blame] | 186 | |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 187 | if ( NOT LLDB_DISABLE_PYTHON ) |
| 188 | set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1) |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 189 | set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp) |
| 190 | endif() |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 191 | set(SHARED_LIBRARY 1) |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 192 | |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 193 | if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 194 | add_definitions( -DEXPORT_LIBLLDB ) |
| 195 | endif() |
| 196 | |
| 197 | # Need to export the API in the liblldb.dll for Windows |
| 198 | # The lldbAPI source files are added directly in liblldb |
| 199 | if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 200 | add_lldb_library(liblldb |
| 201 | lldb.cpp |
| 202 | lldb-log.cpp |
| 203 | API/SBAddress.cpp |
| 204 | API/SBBlock.cpp |
| 205 | API/SBBreakpoint.cpp |
| 206 | API/SBBreakpointLocation.cpp |
| 207 | API/SBBroadcaster.cpp |
| 208 | API/SBCommandInterpreter.cpp |
| 209 | API/SBCommandReturnObject.cpp |
| 210 | API/SBCommunication.cpp |
| 211 | API/SBCompileUnit.cpp |
| 212 | API/SBData.cpp |
| 213 | API/SBDebugger.cpp |
| 214 | API/SBDeclaration.cpp |
| 215 | API/SBError.cpp |
| 216 | API/SBEvent.cpp |
| 217 | API/SBExpressionOptions.cpp |
| 218 | API/SBFileSpec.cpp |
| 219 | API/SBFileSpecList.cpp |
| 220 | API/SBFrame.cpp |
| 221 | API/SBFunction.cpp |
| 222 | API/SBHostOS.cpp |
| 223 | API/SBInstruction.cpp |
| 224 | API/SBInstructionList.cpp |
| 225 | API/SBLineEntry.cpp |
| 226 | API/SBListener.cpp |
| 227 | API/SBModule.cpp |
| 228 | API/SBModuleSpec.cpp |
| 229 | API/SBPlatform.cpp |
| 230 | API/SBProcess.cpp |
| 231 | API/SBQueue.cpp |
| 232 | API/SBQueueItem.cpp |
| 233 | API/SBSection.cpp |
| 234 | API/SBSourceManager.cpp |
| 235 | API/SBStream.cpp |
| 236 | API/SBStringList.cpp |
| 237 | API/SBSymbol.cpp |
| 238 | API/SBSymbolContext.cpp |
| 239 | API/SBSymbolContextList.cpp |
| 240 | API/SBTarget.cpp |
| 241 | API/SBThread.cpp |
| 242 | API/SBType.cpp |
| 243 | API/SBTypeCategory.cpp |
| 244 | API/SBTypeFilter.cpp |
| 245 | API/SBTypeFormat.cpp |
| 246 | API/SBTypeNameSpecifier.cpp |
| 247 | API/SBTypeSummary.cpp |
| 248 | API/SBTypeSynthetic.cpp |
| 249 | API/SBValue.cpp |
| 250 | API/SBValueList.cpp |
| 251 | API/SBWatchpoint.cpp |
| 252 | Host/Windows/getopt/GetOptInc.cpp |
| 253 | ${LLDB_WRAP_PYTHON} |
| 254 | ${LLDB_VERS_GENERATED_FILE} |
| 255 | ) |
| 256 | else () |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 257 | add_lldb_library(liblldb |
| 258 | lldb.cpp |
| 259 | lldb-log.cpp |
| 260 | ${LLDB_WRAP_PYTHON} |
| 261 | ${LLDB_VERS_GENERATED_FILE} |
| 262 | ) |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 263 | endif () |
| 264 | |
| 265 | if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 266 | set_target_properties(liblldb |
| 267 | PROPERTIES |
| 268 | OUTPUT_NAME liblldb |
| 269 | VERSION ${LLDB_VERSION} |
| 270 | ) |
| 271 | else() |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 272 | set_target_properties(liblldb |
| 273 | PROPERTIES |
| 274 | OUTPUT_NAME lldb |
| 275 | VERSION ${LLDB_VERSION} |
| 276 | ) |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 277 | endif() |
| 278 | |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 279 | if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE) |
| 280 | add_dependencies(liblldb |
| Deepak Panickal | 627f4ae | 2014-03-03 15:50:36 +0000 | [diff] [blame] | 281 | swig_wrapper |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 282 | ${LLDB_WRAP_PYTHON} |
| 283 | ${LLDB_VERS_GENERATED_FILE} |
| 284 | ) |
| 285 | endif() |
| 286 | target_link_libraries(liblldb ${LLDB_SYSTEM_LIBS}) |
| 287 | |
| 288 | # Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as |
| 289 | # such will not work on Windows. |
| 290 | if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 291 | execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR} |
| 292 | OUTPUT_VARIABLE LLDB_REVISION) |
| 293 | if ( LLDB_REVISION ) |
| 294 | string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION}) |
| 295 | endif() |
| 296 | |
| 297 | execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR} |
| 298 | OUTPUT_VARIABLE LLDB_REPOSITORY) |
| 299 | if ( LLDB_REPOSITORY ) |
| 300 | # Replace newline characters with spaces |
| 301 | string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY}) |
| 302 | |
| 303 | # Remove trailing spaces |
| 304 | string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY}) |
| 305 | endif() |
| 306 | |
| 307 | set_property( |
| 308 | SOURCE lldb.cpp |
| 309 | PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"") |
| 310 | endif () |
| 311 | # FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only |
| 312 | # revision parsing solution in tools/clang/lib/Basic/CMakelists.txt. |
| 313 | |
| 314 | |
| 315 | install(TARGETS liblldb |
| 316 | RUNTIME DESTINATION bin |
| Deepak Panickal | a0154f9 | 2013-10-15 12:32:12 +0000 | [diff] [blame] | 317 | LIBRARY DESTINATION lib |
| 318 | ARCHIVE DESTINATION lib) |