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