| 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 | |
| 17 | add_subdirectory(API) |
| 18 | add_subdirectory(Breakpoint) |
| 19 | add_subdirectory(Commands) |
| 20 | add_subdirectory(Core) |
| 21 | add_subdirectory(DataFormatters) |
| 22 | add_subdirectory(Expression) |
| 23 | add_subdirectory(Host) |
| 24 | add_subdirectory(Interpreter) |
| 25 | add_subdirectory(Plugins) |
| 26 | add_subdirectory(Symbol) |
| 27 | add_subdirectory(Target) |
| 28 | add_subdirectory(Utility) |
| 29 | |
| 30 | set( LLDB_USED_LIBS |
| 31 | lldbAPI |
| 32 | lldbBreakpoint |
| 33 | lldbCommands |
| 34 | lldbDataFormatters |
| 35 | lldbHostCommon |
| 36 | lldbCore |
| 37 | lldbExpression |
| 38 | lldbInterpreter |
| 39 | lldbSymbol |
| 40 | lldbTarget |
| 41 | lldbUtility |
| 42 | |
| 43 | # Plugins |
| 44 | lldbPluginDisassemblerLLVM |
| 45 | lldbPluginSymbolFileDWARF |
| 46 | lldbPluginSymbolFileSymtab |
| 47 | lldbPluginDynamicLoaderStatic |
| 48 | lldbPluginDynamicLoaderPosixDYLD |
| 49 | |
| 50 | lldbPluginObjectFileMachO |
| 51 | lldbPluginObjectFileELF |
| 52 | lldbPluginSymbolVendorELF |
| 53 | lldbPluginObjectContainerBSDArchive |
| 54 | lldbPluginObjectContainerMachOArchive |
| 55 | lldbPluginProcessGDBRemote |
| 56 | lldbPluginProcessMachCore |
| 57 | lldbPluginProcessUtility |
| 58 | lldbPluginPlatformGDB |
| 59 | lldbPluginPlatformFreeBSD |
| 60 | lldbPluginPlatformLinux |
| 61 | lldbPluginPlatformPOSIX |
| Deepak Panickal | a0154f9 | 2013-10-15 12:32:12 +0000 | [diff] [blame] | 62 | lldbPluginPlatformWindows |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 63 | lldbPluginObjectFileMachO |
| 64 | lldbPluginObjectContainerMachOArchive |
| 65 | lldbPluginObjectContainerBSDArchive |
| 66 | lldbPluginPlatformMacOSX |
| 67 | lldbPluginDynamicLoaderMacOSXDYLD |
| 68 | lldbPluginUnwindAssemblyInstEmulation |
| 69 | lldbPluginUnwindAssemblyX86 |
| 70 | lldbPluginAppleObjCRuntime |
| 71 | lldbPluginCXXItaniumABI |
| 72 | lldbPluginABIMacOSX_arm |
| 73 | lldbPluginABIMacOSX_i386 |
| 74 | lldbPluginABISysV_x86_64 |
| 75 | lldbPluginInstructionARM |
| 76 | lldbPluginObjectFilePECOFF |
| 77 | lldbPluginOSPython |
| 78 | ) |
| 79 | |
| 80 | # Windows-only libraries |
| 81 | if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 82 | list(APPEND LLDB_USED_LIBS |
| 83 | lldbHostWindows |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 84 | Ws2_32 |
| 85 | ) |
| 86 | endif () |
| 87 | |
| 88 | # Linux-only libraries |
| 89 | if ( CMAKE_SYSTEM_NAME MATCHES "Linux" ) |
| 90 | list(APPEND LLDB_USED_LIBS |
| 91 | lldbHostLinux |
| 92 | lldbPluginProcessLinux |
| 93 | lldbPluginProcessPOSIX |
| 94 | lldbPluginProcessElfCore |
| 95 | ) |
| 96 | endif () |
| 97 | |
| 98 | # FreeBSD-only libraries |
| 99 | if ( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" ) |
| 100 | list(APPEND LLDB_USED_LIBS |
| 101 | lldbHostFreeBSD |
| 102 | lldbPluginProcessFreeBSD |
| 103 | lldbPluginProcessPOSIX |
| 104 | lldbPluginProcessElfCore |
| 105 | ) |
| 106 | endif () |
| 107 | |
| 108 | # Darwin-only libraries |
| 109 | if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" ) |
| 110 | set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c) |
| 111 | add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE} |
| 112 | COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl |
| Todd Fiala | 5000e28 | 2014-01-18 08:05:32 +0000 | [diff] [blame^] | 113 | ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 114 | > ${LLDB_VERS_GENERATED_FILE}) |
| 115 | |
| 116 | set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1) |
| 117 | list(APPEND LLDB_USED_LIBS |
| 118 | lldbHostMacOSX |
| 119 | lldbPluginDynamicLoaderDarwinKernel |
| 120 | lldbPluginProcessMacOSXKernel |
| 121 | lldbPluginSymbolVendorMacOSX |
| Jason Molenda | a7b5afa | 2013-11-15 00:17:32 +0000 | [diff] [blame] | 122 | lldbPluginSystemRuntimeMacOSX |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 123 | ) |
| 124 | endif() |
| 125 | |
| 126 | set( CLANG_USED_LIBS |
| 127 | clangAnalysis |
| 128 | clangAST |
| 129 | clangBasic |
| 130 | clangCodeGen |
| 131 | clangDriver |
| 132 | clangEdit |
| 133 | clangFrontend |
| 134 | clangLex |
| 135 | clangParse |
| 136 | clangRewriteCore |
| 137 | clangRewriteFrontend |
| 138 | clangSema |
| 139 | clangSerialization |
| 140 | ) |
| 141 | |
| Sylvestre Ledru | f0f2d58 | 2013-11-15 14:15:10 +0000 | [diff] [blame] | 142 | set(LLDB_SYSTEM_LIBS) |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 143 | if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") |
| Sylvestre Ledru | f0f2d58 | 2013-11-15 14:15:10 +0000 | [diff] [blame] | 144 | list(APPEND LLDB_SYSTEM_LIBS edit) |
| 145 | endif() |
| 146 | if (NOT LLDB_DISABLE_PYTHON) |
| 147 | list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES}) |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 148 | endif() |
| 149 | |
| 150 | set( LLVM_LINK_COMPONENTS |
| 151 | ${LLVM_TARGETS_TO_BUILD} |
| 152 | jit |
| 153 | interpreter |
| 154 | nativecodegen |
| 155 | asmparser |
| 156 | bitreader |
| 157 | bitwriter |
| 158 | codegen |
| 159 | ipo |
| 160 | selectiondag |
| 161 | bitreader |
| 162 | mc |
| 163 | mcjit |
| 164 | core |
| 165 | mcdisassembler |
| 166 | executionengine |
| Peter Collingbourne | 19676ac | 2013-11-11 04:46:09 +0000 | [diff] [blame] | 167 | option |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 168 | ) |
| 169 | |
| 170 | set_source_files_properties(${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp PROPERTIES GENERATED 1) |
| Deepak Panickal | a0154f9 | 2013-10-15 12:32:12 +0000 | [diff] [blame] | 171 | |
| 172 | if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") |
| 173 | set(SHARED_LIBRARY 1) |
| 174 | endif() |
| Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 175 | |
| 176 | if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows") |
| 177 | set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp) |
| 178 | endif() |
| 179 | |
| 180 | add_lldb_library(liblldb |
| 181 | lldb.cpp |
| 182 | lldb-log.cpp |
| 183 | ${LLDB_WRAP_PYTHON} |
| 184 | ${LLDB_VERS_GENERATED_FILE} |
| 185 | ) |
| 186 | set_target_properties(liblldb |
| 187 | PROPERTIES |
| 188 | OUTPUT_NAME lldb |
| 189 | VERSION ${LLDB_VERSION} |
| 190 | ) |
| 191 | if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE) |
| 192 | add_dependencies(liblldb |
| 193 | ${LLDB_WRAP_PYTHON} |
| 194 | ${LLDB_VERS_GENERATED_FILE} |
| 195 | ) |
| 196 | endif() |
| 197 | target_link_libraries(liblldb ${LLDB_SYSTEM_LIBS}) |
| 198 | |
| 199 | # Determine LLDB revision and repository. GetSourceVersion and GetRepositoryPath are shell-scripts, and as |
| 200 | # such will not work on Windows. |
| 201 | if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 202 | execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLDB_SOURCE_DIR} |
| 203 | OUTPUT_VARIABLE LLDB_REVISION) |
| 204 | if ( LLDB_REVISION ) |
| 205 | string(REGEX REPLACE "(\r?\n)+$" "" LLDB_REVISION ${LLDB_REVISION}) |
| 206 | endif() |
| 207 | |
| 208 | execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLDB_SOURCE_DIR} |
| 209 | OUTPUT_VARIABLE LLDB_REPOSITORY) |
| 210 | if ( LLDB_REPOSITORY ) |
| 211 | # Replace newline characters with spaces |
| 212 | string(REGEX REPLACE "(\r?\n)+" " " LLDB_REPOSITORY ${LLDB_REPOSITORY}) |
| 213 | |
| 214 | # Remove trailing spaces |
| 215 | string(REGEX REPLACE "(\ )+$" "" LLDB_REPOSITORY ${LLDB_REPOSITORY}) |
| 216 | endif() |
| 217 | |
| 218 | set_property( |
| 219 | SOURCE lldb.cpp |
| 220 | PROPERTY COMPILE_DEFINITIONS "LLDB_REVISION=\"${LLDB_REVISION}\"" "LLDB_REPOSITORY=\"${LLDB_REPOSITORY}\"") |
| 221 | endif () |
| 222 | # FIXME: implement svn/git revision and repository parsing solution on Windows. There is an SVN-only |
| 223 | # revision parsing solution in tools/clang/lib/Basic/CMakelists.txt. |
| 224 | |
| 225 | |
| 226 | install(TARGETS liblldb |
| 227 | RUNTIME DESTINATION bin |
| Deepak Panickal | a0154f9 | 2013-10-15 12:32:12 +0000 | [diff] [blame] | 228 | LIBRARY DESTINATION lib |
| 229 | ARCHIVE DESTINATION lib) |