Zachary Turner | 7513e82 | 2015-02-17 22:20:20 +0000 | [diff] [blame] | 1 | if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
Zachary Turner | 030b8cb | 2015-02-24 22:17:57 +0000 | [diff] [blame] | 2 | add_definitions( -DEXPORT_LIBLLDB ) |
Zachary Turner | 7513e82 | 2015-02-17 22:20:20 +0000 | [diff] [blame] | 3 | endif() |
| 4 | |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 5 | # Include this so that add_lldb_library() has the list of dependencies |
| 6 | # for liblldb to link against |
| 7 | include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) |
| 8 | |
Chris Bieneman | d3199f5 | 2016-09-21 21:02:16 +0000 | [diff] [blame] | 9 | option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off) |
| 10 | |
Chris Bieneman | 679d02f | 2016-12-15 18:18:47 +0000 | [diff] [blame] | 11 | if(LLDB_BUILD_FRAMEWORK AND CMAKE_VERSION VERSION_LESS 3.7) |
| 12 | message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7") |
| 13 | endif() |
| 14 | |
Chris Bieneman | d3199f5 | 2016-09-21 21:02:16 +0000 | [diff] [blame] | 15 | if (LLDB_BUILD_FRAMEWORK AND NOT APPLE) |
| 16 | message(FATAL_ERROR "LLDB.framework cannot be generated unless targeting Apple platforms.") |
| 17 | endif() |
| 18 | |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 19 | add_lldb_library(liblldb SHARED |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 20 | SBAddress.cpp |
Oleksiy Vyalov | 71d08b3 | 2015-02-16 00:04:19 +0000 | [diff] [blame] | 21 | SBAttachInfo.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 22 | SBBlock.cpp |
| 23 | SBBreakpoint.cpp |
| 24 | SBBreakpointLocation.cpp |
| 25 | SBBroadcaster.cpp |
| 26 | SBCommandInterpreter.cpp |
| 27 | SBCommandReturnObject.cpp |
| 28 | SBCommunication.cpp |
| 29 | SBCompileUnit.cpp |
| 30 | SBData.cpp |
| 31 | SBDebugger.cpp |
| 32 | SBDeclaration.cpp |
| 33 | SBError.cpp |
| 34 | SBEvent.cpp |
Chandler Carruth | b8a4ecb | 2014-10-01 21:33:28 +0000 | [diff] [blame] | 35 | SBExecutionContext.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 36 | SBExpressionOptions.cpp |
| 37 | SBFileSpec.cpp |
| 38 | SBFileSpecList.cpp |
| 39 | SBFrame.cpp |
| 40 | SBFunction.cpp |
| 41 | SBHostOS.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 42 | SBInstruction.cpp |
| 43 | SBInstructionList.cpp |
Ilia K | 7f83624 | 2015-04-28 12:51:16 +0000 | [diff] [blame] | 44 | SBLanguageRuntime.cpp |
Oleksiy Vyalov | 1ef7b2c | 2015-02-04 23:19:15 +0000 | [diff] [blame] | 45 | SBLaunchInfo.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 46 | SBLineEntry.cpp |
| 47 | SBListener.cpp |
Howard Hellyer | 26036843 | 2016-06-23 08:35:37 +0000 | [diff] [blame] | 48 | SBMemoryRegionInfo.cpp |
| 49 | SBMemoryRegionInfoList.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 50 | SBModule.cpp |
| 51 | SBModuleSpec.cpp |
Ed Maste | 5341404 | 2013-11-21 14:38:22 +0000 | [diff] [blame] | 52 | SBPlatform.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 53 | SBProcess.cpp |
Jason Molenda | 5e8dce4 | 2013-12-13 00:29:16 +0000 | [diff] [blame] | 54 | SBQueue.cpp |
| 55 | SBQueueItem.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 56 | SBSection.cpp |
| 57 | SBSourceManager.cpp |
| 58 | SBStream.cpp |
| 59 | SBStringList.cpp |
Todd Fiala | 7593001 | 2016-08-19 04:21:48 +0000 | [diff] [blame] | 60 | SBStructuredData.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 61 | SBSymbol.cpp |
| 62 | SBSymbolContext.cpp |
| 63 | SBSymbolContextList.cpp |
| 64 | SBTarget.cpp |
| 65 | SBThread.cpp |
Kuba Brecka | aaa0b81 | 2014-09-06 01:22:55 +0000 | [diff] [blame] | 66 | SBThreadCollection.cpp |
Todd Fiala | 8a3716b | 2014-09-30 15:58:56 +0000 | [diff] [blame] | 67 | SBThreadPlan.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 68 | SBType.cpp |
| 69 | SBTypeCategory.cpp |
Todd Fiala | 732215f | 2014-06-02 20:55:29 +0000 | [diff] [blame] | 70 | SBTypeEnumMember.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 71 | SBTypeFilter.cpp |
| 72 | SBTypeFormat.cpp |
| 73 | SBTypeNameSpecifier.cpp |
| 74 | SBTypeSummary.cpp |
| 75 | SBTypeSynthetic.cpp |
| 76 | SBValue.cpp |
| 77 | SBValueList.cpp |
Zachary Turner | 51f96ee | 2015-02-17 17:55:50 +0000 | [diff] [blame] | 78 | SBVariablesOptions.cpp |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 79 | SBWatchpoint.cpp |
Todd Fiala | 802dc402 | 2014-06-23 19:30:49 +0000 | [diff] [blame] | 80 | SBUnixSignals.cpp |
Zachary Turner | e6e2bb3 | 2015-03-31 21:03:22 +0000 | [diff] [blame] | 81 | SystemInitializerFull.cpp |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 82 | ${LLDB_WRAP_PYTHON} |
Joerg Sonnenberger | 340a175 | 2013-09-25 10:37:32 +0000 | [diff] [blame] | 83 | ) |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 84 | |
Zachary Turner | d6ef284 | 2016-10-05 17:07:16 +0000 | [diff] [blame] | 85 | if (LLVM_ENABLE_WERROR) |
| 86 | if (MSVC) |
| 87 | set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0") |
| 88 | else() |
| 89 | set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w") |
| 90 | endif() |
| 91 | endif() |
| 92 | |
Zachary Turner | 2c1f46d | 2015-07-30 20:28:07 +0000 | [diff] [blame] | 93 | # This should not be part of LLDBDependencies.cmake, because we don't |
| 94 | # want every single library taking a dependency on the script interpreters. |
| 95 | target_link_libraries(liblldb PRIVATE |
| 96 | lldbPluginScriptInterpreterNone |
| 97 | lldbPluginScriptInterpreterPython |
| 98 | ) |
| 99 | |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 100 | set_target_properties(liblldb |
| 101 | PROPERTIES |
| 102 | VERSION ${LLDB_VERSION} |
| 103 | ) |
| 104 | |
Bruce Mitchener | 3921fc7 | 2015-09-04 00:00:41 +0000 | [diff] [blame] | 105 | if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") |
Todd Fiala | d6f8406 | 2015-10-14 14:52:15 +0000 | [diff] [blame] | 106 | if (NOT LLDB_EXPORT_ALL_SYMBOLS) |
| 107 | # If we're not exporting all symbols, we'll want to explicitly set |
| 108 | # the exported symbols here. This prevents 'log enable --stack ...' |
| 109 | # from working on some systems but limits the liblldb size. |
Todd Fiala | fe68f09 | 2016-10-29 00:29:15 +0000 | [diff] [blame] | 110 | MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace") |
Todd Fiala | d6f8406 | 2015-10-14 14:52:15 +0000 | [diff] [blame] | 111 | add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports) |
| 112 | else() |
| 113 | # Don't use an explicit export. Instead, tell the linker to |
| 114 | # export all symbols. |
Todd Fiala | fe68f09 | 2016-10-29 00:29:15 +0000 | [diff] [blame] | 115 | MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and lldb_private namespaces") |
| 116 | add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports) |
Todd Fiala | d6f8406 | 2015-10-14 14:52:15 +0000 | [diff] [blame] | 117 | endif() |
Bruce Mitchener | 3921fc7 | 2015-09-04 00:00:41 +0000 | [diff] [blame] | 118 | endif() |
| 119 | |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 120 | if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) |
| 121 | # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs, |
| 122 | # so only it needs to explicitly link against ${PYTHON_LIBRARY} |
| 123 | if (MSVC AND NOT LLDB_DISABLE_PYTHON) |
| 124 | target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARY}) |
| 125 | endif() |
| 126 | else() |
| 127 | set_target_properties(liblldb |
| 128 | PROPERTIES |
| 129 | OUTPUT_NAME lldb |
| 130 | ) |
| 131 | endif() |
| 132 | |
Bruce Mitchener | 6ec5d61 | 2015-10-09 03:40:55 +0000 | [diff] [blame] | 133 | if (LLDB_WRAP_PYTHON) |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 134 | add_dependencies(liblldb swig_wrapper) |
| 135 | endif() |
Pavel Labath | 2f430a1 | 2016-08-17 11:55:50 +0000 | [diff] [blame] | 136 | target_link_libraries(liblldb PRIVATE ${LLDB_SYSTEM_LIBS}) |
Zachary Turner | 799770c | 2015-03-18 16:56:24 +0000 | [diff] [blame] | 137 | |
Chris Bieneman | d3199f5 | 2016-09-21 21:02:16 +0000 | [diff] [blame] | 138 | if(LLDB_BUILD_FRAMEWORK) |
Chris Bieneman | 9a6502f | 2016-10-14 17:09:55 +0000 | [diff] [blame] | 139 | file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h) |
Chris Bieneman | d3199f5 | 2016-09-21 21:02:16 +0000 | [diff] [blame] | 140 | set_target_properties(liblldb PROPERTIES |
| 141 | OUTPUT_NAME LLDB |
| 142 | FRAMEWORK On |
| 143 | FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} |
Chris Bieneman | 9a6502f | 2016-10-14 17:09:55 +0000 | [diff] [blame] | 144 | LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} |
| 145 | PUBLIC_HEADER "${public_headers}") |
| 146 | |
Chris Bieneman | 679d02f | 2016-12-15 18:18:47 +0000 | [diff] [blame] | 147 | add_custom_command(TARGET liblldb POST_BUILD |
| 148 | COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:liblldb>/Versions/${LLDB_FRAMEWORK_VERSION} |
| 149 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${LLDB_SOURCE_DIR}/include/lldb/API $<TARGET_FILE_DIR:liblldb>/Headers |
Chris Bieneman | b9fc472 | 2016-10-31 22:31:07 +0000 | [diff] [blame] | 150 | COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers |
Chris Bieneman | 679d02f | 2016-12-15 18:18:47 +0000 | [diff] [blame] | 151 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang |
Chris Bieneman | b9fc472 | 2016-10-31 22:31:07 +0000 | [diff] [blame] | 152 | ) |
Chris Bieneman | d3199f5 | 2016-09-21 21:02:16 +0000 | [diff] [blame] | 153 | endif() |
| 154 | |