diff options
Diffstat (limited to 'source/API/CMakeLists.txt')
-rw-r--r-- | source/API/CMakeLists.txt | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt index 2ed42cac062e..7e1e66bee3b2 100644 --- a/source/API/CMakeLists.txt +++ b/source/API/CMakeLists.txt @@ -6,6 +6,16 @@ endif() # for liblldb to link against include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) +option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off) + +if(LLDB_BUILD_FRAMEWORK AND CMAKE_VERSION VERSION_LESS 3.7) + message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7") +endif() + +if (LLDB_BUILD_FRAMEWORK AND NOT APPLE) + message(FATAL_ERROR "LLDB.framework cannot be generated unless targeting Apple platforms.") +endif() + add_lldb_library(liblldb SHARED SBAddress.cpp SBAttachInfo.cpp @@ -47,6 +57,7 @@ add_lldb_library(liblldb SHARED SBSourceManager.cpp SBStream.cpp SBStringList.cpp + SBStructuredData.cpp SBSymbol.cpp SBSymbolContext.cpp SBSymbolContextList.cpp @@ -71,6 +82,14 @@ add_lldb_library(liblldb SHARED ${LLDB_WRAP_PYTHON} ) +if (LLVM_ENABLE_WERROR) + if (MSVC) + set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " /W0") + else() + set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w") + endif() +endif() + # This should not be part of LLDBDependencies.cmake, because we don't # want every single library taking a dependency on the script interpreters. target_link_libraries(liblldb PRIVATE @@ -88,16 +107,13 @@ if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") # If we're not exporting all symbols, we'll want to explicitly set # the exported symbols here. This prevents 'log enable --stack ...' # from working on some systems but limits the liblldb size. - MESSAGE("-- Symbols (liblldb): only exporting liblldb.exports symbols") + MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb namespace") add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb.exports) else() # Don't use an explicit export. Instead, tell the linker to # export all symbols. - MESSAGE("-- Symbols (liblldb): exporting all symbols") - # Darwin linker doesn't need this extra step. - if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") - lldb_append_link_flags(liblldb "-Wl,--export-dynamic") - endif() + MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and lldb_private namespaces") + add_llvm_symbol_exports(liblldb ${CMAKE_CURRENT_SOURCE_DIR}/liblldb-private.exports) endif() endif() @@ -117,5 +133,22 @@ endif() if (LLDB_WRAP_PYTHON) add_dependencies(liblldb swig_wrapper) endif() -target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS}) +target_link_libraries(liblldb PRIVATE ${LLDB_SYSTEM_LIBS}) + +if(LLDB_BUILD_FRAMEWORK) + file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h) + set_target_properties(liblldb PROPERTIES + OUTPUT_NAME LLDB + FRAMEWORK On + FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR} + PUBLIC_HEADER "${public_headers}") + + add_custom_command(TARGET liblldb POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:liblldb>/Versions/${LLDB_FRAMEWORK_VERSION} + COMMAND ${CMAKE_COMMAND} -E copy_directory ${LLDB_SOURCE_DIR}/include/lldb/API $<TARGET_FILE_DIR:liblldb>/Headers + COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}/LLDB.framework/Headers + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang + ) +endif() |