1 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
2 add_definitions( -DEXPORT_LIBLLDB )
5 get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
8 get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
9 set(lldb_python_wrapper ${lldb_bindings_dir}/LLDBWrapPython.cpp)
13 get_target_property(lldb_bindings_dir swig_wrapper_lua BINARY_DIR)
14 set(lldb_lua_wrapper ${lldb_bindings_dir}/LLDBWrapLua.cpp)
17 if(LLDB_BUILD_FRAMEWORK)
18 set(option_install_prefix INSTALL_PREFIX ${LLDB_FRAMEWORK_INSTALL_DIR})
19 set(option_framework FRAMEWORK)
22 add_lldb_library(liblldb SHARED ${option_framework}
27 SBBreakpointLocation.cpp
29 SBBreakpointOptionCommon.cpp
31 SBCommandInterpreter.cpp
32 SBCommandReturnObject.cpp
40 SBExecutionContext.cpp
41 SBExpressionOptions.cpp
54 SBMemoryRegionInfo.cpp
55 SBMemoryRegionInfoList.cpp
71 SBSymbolContextList.cpp
74 SBThreadCollection.cpp
83 SBTypeNameSpecifier.cpp
88 SBVariablesOptions.cpp
91 SystemInitializerFull.cpp
92 ${lldb_python_wrapper}
111 ${option_install_prefix}
114 # lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,
115 # which depends on lib/libLLVM*.so (BUILD_SHARED_LIBS) or lib/libLLVM-10git.so
116 # (LLVM_LINK_LLVM_DYLIB). Add an additional rpath $ORIGIN/../../../../lib so
117 # that _lldb.so can be loaded from Python.
118 if(LLDB_ENABLE_PYTHON AND (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB) AND UNIX AND NOT APPLE)
119 set_property(TARGET liblldb APPEND PROPERTY INSTALL_RPATH "\$ORIGIN/../../../../lib${LLVM_LIBDIR_SUFFIX}")
123 set_source_files_properties(SBReproducer.cpp PROPERTIES COMPILE_FLAGS /bigobj)
126 if(lldb_python_wrapper)
127 add_dependencies(liblldb swig_wrapper)
130 set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
132 set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
135 set_source_files_properties(${lldb_python_wrapper} PROPERTIES GENERATED ON)
137 set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
138 PROPERTY COMPILE_FLAGS " -Wno-unused-function")
140 if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
141 NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
142 set_property(SOURCE ${lldb_python_wrapper} APPEND_STRING
143 PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
148 add_dependencies(liblldb swig_wrapper_lua)
149 target_include_directories(liblldb PRIVATE ${LUA_INCLUDE_DIR})
152 set_property(SOURCE ${lldb_lua_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0")
154 set_property(SOURCE ${lldb_lua_wrapper} APPEND_STRING PROPERTY COMPILE_FLAGS " -w")
157 set_source_files_properties(${lldb_lua_wrapper} PROPERTIES GENERATED ON)
160 set_target_properties(liblldb
162 VERSION ${LLDB_VERSION}
165 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
166 if (NOT LLDB_EXPORT_ALL_SYMBOLS)
167 # If we're not exporting all symbols, we'll want to explicitly set
168 # the exported symbols here. This prevents 'log enable --stack ...'
169 # from working on some systems but limits the liblldb size.
170 MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace")
171 add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports)
173 # Don't use an explicit export. Instead, tell the linker to
174 # export all symbols.
175 MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and lldb_private namespaces")
176 add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports)
178 set_target_properties(liblldb_exports PROPERTIES FOLDER "lldb misc")
181 if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
182 # Only MSVC has the ABI compatibility problem and avoids using FindPythonLibs,
183 # so only it needs to explicitly link against ${PYTHON_LIBRARIES}
184 if (MSVC AND LLDB_ENABLE_PYTHON)
185 target_link_libraries(liblldb PRIVATE ${PYTHON_LIBRARIES})
188 set_target_properties(liblldb
194 if (NOT LLDB_BUILT_STANDALONE)
195 add_dependencies(liblldb clang-resource-headers)
198 if(LLDB_BUILD_FRAMEWORK)
199 include(LLDBFramework)