llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Narayan (vortex73)

<details>
<summary>Changes</summary>

- [ ] Added Option to statically build lldb
- [ ] Packages lldb for easier package finding in other builds.

#<!-- -->98754

---
Full diff: https://github.com/llvm/llvm-project/pull/98829.diff


2 Files Affected:

- (modified) lldb/source/API/CMakeLists.txt (+110-86) 
- (added) lldb/source/API/LLDBConfig.cmake.in (+7) 


``````````diff
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 6397101609315..4f4c565850edd 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -40,92 +40,100 @@ add_custom_target(lldb-sbapi-dwarf-enums
   DEPENDS ${sb_languages_file})
 set_target_properties(lldb-sbapi-dwarf-enums PROPERTIES FOLDER 
"LLDB/Tablegenning")
 
-add_lldb_library(liblldb SHARED ${option_framework}
-  SBAddress.cpp
-  SBAddressRange.cpp
-  SBAddressRangeList.cpp
-  SBAttachInfo.cpp
-  SBBlock.cpp
-  SBBreakpoint.cpp
-  SBBreakpointLocation.cpp
-  SBBreakpointName.cpp
-  SBBreakpointOptionCommon.cpp
-  SBBroadcaster.cpp
-  SBCommandInterpreter.cpp
-  SBCommandInterpreterRunOptions.cpp
-  SBCommandReturnObject.cpp
-  SBCommunication.cpp
-  SBCompileUnit.cpp
-  SBData.cpp
-  SBDebugger.cpp
-  SBDeclaration.cpp
-  SBEnvironment.cpp
-  SBError.cpp
-  SBEvent.cpp
-  SBExecutionContext.cpp
-  SBExpressionOptions.cpp
-  SBFileSpec.cpp
-  SBFile.cpp
-  SBFileSpecList.cpp
-  SBFormat.cpp
-  SBFrame.cpp
-  SBFunction.cpp
-  SBHostOS.cpp
-  SBInstruction.cpp
-  SBInstructionList.cpp
-  SBLanguageRuntime.cpp
-  SBLaunchInfo.cpp
-  SBLineEntry.cpp
-  SBListener.cpp
-  SBMemoryRegionInfo.cpp
-  SBMemoryRegionInfoList.cpp
-  SBModule.cpp
-  SBModuleSpec.cpp
-  SBPlatform.cpp
-  SBProcess.cpp
-  SBProcessInfo.cpp
-  SBProcessInfoList.cpp
-  SBQueue.cpp
-  SBQueueItem.cpp
-  SBReproducer.cpp
-  SBScriptObject.cpp
-  SBSection.cpp
-  SBSourceManager.cpp
-  SBStatisticsOptions.cpp
-  SBStream.cpp
-  SBStringList.cpp
-  SBStructuredData.cpp
-  SBSymbol.cpp
-  SBSymbolContext.cpp
-  SBSymbolContextList.cpp
-  SBTarget.cpp
-  SBThread.cpp
-  SBThreadCollection.cpp
-  SBThreadPlan.cpp
-  SBTrace.cpp
-  SBTraceCursor.cpp
-  SBType.cpp
-  SBTypeCategory.cpp
-  SBTypeEnumMember.cpp
-  SBTypeFilter.cpp
-  SBTypeFormat.cpp
-  SBTypeNameSpecifier.cpp
-  SBTypeSummary.cpp
-  SBTypeSynthetic.cpp
-  SBValue.cpp
-  SBValueList.cpp
-  SBVariablesOptions.cpp
-  SBWatchpoint.cpp
-  SBWatchpointOptions.cpp
-  SBUnixSignals.cpp
-  SystemInitializerFull.cpp
-  ${lldb_python_wrapper}
-  ${lldb_lua_wrapper}
-
-  DEPENDS
+option(LLDB_BUILD_STATIC "Build LLDB as a Static Library" OFF)
+
+if(LLDB_BUILD_STATIC)
+    set(LLDB_LIBRARY_TYPE STATIC)
+elsE()
+    set(LLDB_LIBRARY_TYPE SHARED)
+endif()
+
+add_lldb_library(liblldb ${LLDB_LIBRARY_TYPE} ${option_framework}
+    SBAddress.cpp
+    SBAddressRange.cpp
+    SBAddressRangeList.cpp
+    SBAttachInfo.cpp
+    SBBlock.cpp
+    SBBreakpoint.cpp
+    SBBreakpointLocation.cpp
+    SBBreakpointName.cpp
+    SBBreakpointOptionCommon.cpp
+    SBBroadcaster.cpp
+    SBCommandInterpreter.cpp
+    SBCommandInterpreterRunOptions.cpp
+    SBCommandReturnObject.cpp
+    SBCommunication.cpp
+    SBCompileUnit.cpp
+    SBData.cpp
+    SBDebugger.cpp
+    SBDeclaration.cpp
+    SBEnvironment.cpp
+    SBError.cpp
+    SBEvent.cpp
+    SBExecutionContext.cpp
+    SBExpressionOptions.cpp
+    SBFileSpec.cpp
+    SBFile.cpp
+    SBFileSpecList.cpp
+    SBFormat.cpp
+    SBFrame.cpp
+    SBFunction.cpp
+    SBHostOS.cpp
+    SBInstruction.cpp
+    SBInstructionList.cpp
+    SBLanguageRuntime.cpp
+    SBLaunchInfo.cpp
+    SBLineEntry.cpp
+    SBListener.cpp
+    SBMemoryRegionInfo.cpp
+    SBMemoryRegionInfoList.cpp
+    SBModule.cpp
+    SBModuleSpec.cpp
+    SBPlatform.cpp
+    SBProcess.cpp
+    SBProcessInfo.cpp
+    SBProcessInfoList.cpp
+    SBQueue.cpp
+    SBQueueItem.cpp
+    SBReproducer.cpp
+    SBScriptObject.cpp
+    SBSection.cpp
+    SBSourceManager.cpp
+    SBStatisticsOptions.cpp
+    SBStream.cpp
+    SBStringList.cpp
+    SBStructuredData.cpp
+    SBSymbol.cpp
+    SBSymbolContext.cpp
+    SBSymbolContextList.cpp
+    SBTarget.cpp
+    SBThread.cpp
+    SBThreadCollection.cpp
+    SBThreadPlan.cpp
+    SBTrace.cpp
+    SBTraceCursor.cpp
+    SBType.cpp
+    SBTypeCategory.cpp
+    SBTypeEnumMember.cpp
+    SBTypeFilter.cpp
+    SBTypeFormat.cpp
+    SBTypeNameSpecifier.cpp
+    SBTypeSummary.cpp
+    SBTypeSynthetic.cpp
+    SBValue.cpp
+    SBValueList.cpp
+    SBVariablesOptions.cpp
+    SBWatchpoint.cpp
+    SBWatchpointOptions.cpp
+    SBUnixSignals.cpp
+    SystemInitializerFull.cpp
+    ${lldb_python_wrapper}
+    ${lldb_lua_wrapper}
+
+    DEPENDS
     lldb-sbapi-dwarf-enums
 
-  LINK_LIBS
+    LINK_LIBS
     lldbBreakpoint
     lldbCore
     lldbDataFormatters
@@ -138,10 +146,26 @@ add_lldb_library(liblldb SHARED ${option_framework}
     lldbUtility
     lldbVersion
     ${LLDB_ALL_PLUGINS}
-  LINK_COMPONENTS
+    LINK_COMPONENTS
     Support
 
-  ${option_install_prefix}
+    ${option_install_prefix}
+)
+
+install(TARGETS liblldb EXPORT LLDBTargets
+    LIBRARY DESTINATION lib
+    ARCHIVE DESTINATION lib
+    RUNTIME DESTINATION bin
+    INCLUDES DESTINATION include
+)
+
+include(CMakePackageConfigHelpers)
+
+set(LLDB_PACKAGE_PATH "/lib/cmake/clang")
+configure_package_config_file(
+  "${CMAKE_CURRENT_SOURCE_DIR}/LLDBConfig.cmake.in"
+  "${CMAKE_BINARY_DIR}${LLDB_PACKAGE_PATH}"
+  INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/lldb"
 )
 
 # lib/pythonX.Y/dist-packages/lldb/_lldb.so is a symlink to lib/liblldb.so,
diff --git a/lldb/source/API/LLDBConfig.cmake.in 
b/lldb/source/API/LLDBConfig.cmake.in
new file mode 100644
index 0000000000000..beb8625d8d7a9
--- /dev/null
+++ b/lldb/source/API/LLDBConfig.cmake.in
@@ -0,0 +1,7 @@
+@PACKAGE_INIT@
+
+include(CMakeFindDependencyMacro)
+
+find_dependency(Clang)
+
+include("${CMAKE_CURRENT_LIST_DIR}/LLDBTargets.cmake")

``````````

</details>


https://github.com/llvm/llvm-project/pull/98829
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to