Hi,

Included is a CMake patch for building lldb.
This version is in sync with the Makefile based build but there are some limitations and differences:

Limitations:
- Linux build only
- Python SWIG wrapper is not generated automatically
- LLDB_vers.c is not generated
- Dependencies between libraries are not yet set

Differences:
- Library link order allows driver to link without code changes, could be propagated to the Makefile

Thanks,
Pawel


Index: scripts/CMakeLists.txt
===================================================================
--- scripts/CMakeLists.txt      (revision 0)
+++ scripts/CMakeLists.txt      (revision 0)
@@ -0,0 +1,13 @@
+
+set(LLVM_NO_RTTI 1)
+
+add_custom_command(
+  OUTPUT ${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp
+  DEPENDS ${LLDB_SOURCE_DIR}/scripts/lldb.swig
+  COMMAND swig -c++ -shadow -python -I${LLDB_SOURCE_DIR}/include -I./. -outdir 
${LLDB_SOURCE_DIR}/scripts/Python  -o 
${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp 
${LLDB_SOURCE_DIR}/scripts/lldb.swig
+  COMMENT "Building lldb pyhton wrapper")
+set_source_files_properties(${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp 
PROPERTIES GENERATED 1)
+
+ADD_CUSTOM_TARGET(swig_wrapper ALL echo
+      DEPENDS ${LLDB_SOURCE_DIR}/source/LLDBWrapPython.cpp
+    )
Index: source/CMakeLists.txt
===================================================================
--- source/CMakeLists.txt       (revision 0)
+++ source/CMakeLists.txt       (revision 0)
@@ -0,0 +1,19 @@
+
+add_subdirectory(API)
+add_subdirectory(Breakpoint)
+add_subdirectory(Commands)
+add_subdirectory(Core)
+add_subdirectory(Expression)
+add_subdirectory(Host)
+add_subdirectory(Interpreter)
+add_subdirectory(Plugins)
+add_subdirectory(Symbol)
+add_subdirectory(Target)
+add_subdirectory(Utility)
+
+
+add_lldb_library(lldbInitAndLog
+  lldb.cpp
+  lldb-log.cpp
+  LLDBWrapPython.cpp
+  )
\ No newline at end of file
Index: source/Expression/CMakeLists.txt
===================================================================
--- source/Expression/CMakeLists.txt    (revision 0)
+++ source/Expression/CMakeLists.txt    (revision 0)
@@ -0,0 +1,15 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbExpression
+  ClangASTSource.cpp
+  ClangExpression.cpp
+  ClangExpressionDeclMap.cpp
+  ClangExpressionVariable.cpp
+  ClangFunction.cpp
+  ClangResultSynthesizer.cpp
+  ClangStmtVisitor.cpp
+  DWARFExpression.cpp
+  IRForTarget.cpp
+  IRToDWARF.cpp
+  RecordingMemoryManager.cpp
+  )
Index: source/Commands/CMakeLists.txt
===================================================================
--- source/Commands/CMakeLists.txt      (revision 0)
+++ source/Commands/CMakeLists.txt      (revision 0)
@@ -0,0 +1,39 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbCommands
+  CommandCompletions.cpp
+  CommandObjectAlias.cpp
+  CommandObjectAppend.cpp
+  CommandObjectApropos.cpp
+  CommandObjectArgs.cpp
+  CommandObjectBreakpointCommand.cpp
+  CommandObjectBreakpoint.cpp
+  CommandObjectCall.cpp
+  CommandObjectCrossref.cpp
+  CommandObjectDelete.cpp
+  CommandObjectDisassemble.cpp
+  CommandObjectExpression.cpp
+  CommandObjectFile.cpp
+  CommandObjectFrame.cpp
+  CommandObjectHelp.cpp
+  CommandObjectImage.cpp
+  CommandObjectInfo.cpp
+  CommandObjectLog.cpp
+  CommandObjectMemory.cpp
+  CommandObjectMultiword.cpp
+  CommandObjectProcess.cpp
+  CommandObjectQuit.cpp
+  CommandObjectRegister.cpp
+  CommandObjectSelect.cpp
+  CommandObjectSet.cpp
+  CommandObjectSettings.cpp
+  CommandObjectShow.cpp
+  CommandObjectSource.cpp
+  CommandObjectSourceFile.cpp
+  CommandObjectSyntax.cpp
+  CommandObjectTarget.cpp
+  CommandObjectThread.cpp
+  CommandObjectUnalias.cpp
+  CommandObjectVariable.cpp
+  )
+
Index: source/Plugins/CMakeLists.txt
===================================================================
--- source/Plugins/CMakeLists.txt       (revision 0)
+++ source/Plugins/CMakeLists.txt       (revision 0)
@@ -0,0 +1,8 @@
+add_subdirectory(ABI)
+add_subdirectory(Disassembler)
+#add_subdirectory(DynamicLoader)
+add_subdirectory(ObjectContainer)
+add_subdirectory(ObjectFile)
+#add_subdirectory(Process)
+add_subdirectory(SymbolFile)
+add_subdirectory(SymbolVendor)
\ No newline at end of file
Index: source/Plugins/SymbolVendor/CMakeLists.txt
===================================================================
--- source/Plugins/SymbolVendor/CMakeLists.txt  (revision 0)
+++ source/Plugins/SymbolVendor/CMakeLists.txt  (revision 0)
@@ -0,0 +1 @@
+#add_subdirectory(MacOSX)
\ No newline at end of file
Index: source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt
===================================================================
--- source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt   (revision 0)
+++ source/Plugins/SymbolVendor/MacOSX/CMakeLists.txt   (revision 0)
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginSymbolVendorMacOSX
+  SymbolVendorMacOSX.cpp
+  )
Index: source/Plugins/SymbolFile/CMakeLists.txt
===================================================================
--- source/Plugins/SymbolFile/CMakeLists.txt    (revision 0)
+++ source/Plugins/SymbolFile/CMakeLists.txt    (revision 0)
@@ -0,0 +1,2 @@
+add_subdirectory(DWARF)
+add_subdirectory(Symtab)
\ No newline at end of file
Index: source/Plugins/SymbolFile/Symtab/CMakeLists.txt
===================================================================
--- source/Plugins/SymbolFile/Symtab/CMakeLists.txt     (revision 0)
+++ source/Plugins/SymbolFile/Symtab/CMakeLists.txt     (revision 0)
@@ -0,0 +1,6 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginSymbolFileSymtab
+  SymbolFileSymtab.cpp
+  )
+
Index: source/Plugins/SymbolFile/DWARF/CMakeLists.txt
===================================================================
--- source/Plugins/SymbolFile/DWARF/CMakeLists.txt      (revision 0)
+++ source/Plugins/SymbolFile/DWARF/CMakeLists.txt      (revision 0)
@@ -0,0 +1,26 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginSymbolFileDWARF
+  DWARFAbbreviationDeclaration.cpp
+  DWARFCompileUnit.cpp
+  DWARFDebugAbbrev.cpp
+  DWARFDebugAranges.cpp
+  DWARFDebugArangeSet.cpp
+  DWARFDebugInfo.cpp
+  DWARFDebugInfoEntry.cpp
+  DWARFDebugLine.cpp
+  DWARFDebugMacinfo.cpp
+  DWARFDebugMacinfoEntry.cpp
+  DWARFDebugPubnames.cpp
+  DWARFDebugPubnamesSet.cpp
+  DWARFDebugRanges.cpp
+  DWARFDefines.c
+  DWARFDIECollection.cpp
+  DWARFFormValue.cpp
+  DWARFLocationDescription.cpp
+  DWARFLocationList.cpp
+  LogChannelDWARF.cpp
+  SymbolFileDWARF.cpp
+  SymbolFileDWARFDebugMap.cpp
+  )
+
Index: source/Plugins/ObjectFile/CMakeLists.txt
===================================================================
--- source/Plugins/ObjectFile/CMakeLists.txt    (revision 0)
+++ source/Plugins/ObjectFile/CMakeLists.txt    (revision 0)
@@ -0,0 +1 @@
+add_subdirectory(ELF)
\ No newline at end of file
Index: source/Plugins/ObjectFile/ELF/CMakeLists.txt
===================================================================
--- source/Plugins/ObjectFile/ELF/CMakeLists.txt        (revision 0)
+++ source/Plugins/ObjectFile/ELF/CMakeLists.txt        (revision 0)
@@ -0,0 +1,6 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginObjectFileELF
+  ObjectFileELF.cpp
+  )
+
Index: source/Plugins/ObjectContainer/CMakeLists.txt
===================================================================
--- source/Plugins/ObjectContainer/CMakeLists.txt       (revision 0)
+++ source/Plugins/ObjectContainer/CMakeLists.txt       (revision 0)
@@ -0,0 +1 @@
+add_subdirectory(BSD-Archive)
\ No newline at end of file
Index: source/Plugins/ObjectContainer/BSD-Archive/CMakeLists.txt
===================================================================
--- source/Plugins/ObjectContainer/BSD-Archive/CMakeLists.txt   (revision 0)
+++ source/Plugins/ObjectContainer/BSD-Archive/CMakeLists.txt   (revision 0)
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginObjectContainerBSDArchive
+  ObjectContainerBSDArchive.cpp
+  )
Index: source/Plugins/ABI/CMakeLists.txt
===================================================================
--- source/Plugins/ABI/CMakeLists.txt   (revision 0)
+++ source/Plugins/ABI/CMakeLists.txt   (revision 0)
@@ -0,0 +1 @@
+add_subdirectory(SysV-x86_64)
Index: source/Plugins/ABI/SysV-x86_64/CMakeLists.txt
===================================================================
--- source/Plugins/ABI/SysV-x86_64/CMakeLists.txt       (revision 0)
+++ source/Plugins/ABI/SysV-x86_64/CMakeLists.txt       (revision 0)
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginABISysV_x86_64
+  ABISysV_x86_64.cpp
+  )
Index: source/Plugins/Disassembler/CMakeLists.txt
===================================================================
--- source/Plugins/Disassembler/CMakeLists.txt  (revision 0)
+++ source/Plugins/Disassembler/CMakeLists.txt  (revision 0)
@@ -0,0 +1 @@
+add_subdirectory(llvm)
\ No newline at end of file
Index: source/Plugins/Disassembler/llvm/CMakeLists.txt
===================================================================
--- source/Plugins/Disassembler/llvm/CMakeLists.txt     (revision 0)
+++ source/Plugins/Disassembler/llvm/CMakeLists.txt     (revision 0)
@@ -0,0 +1,5 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginDisassemblerLLVM
+  DisassemblerLLVM.cpp
+  )
Index: source/Plugins/Process/CMakeLists.txt
===================================================================
--- source/Plugins/Process/CMakeLists.txt       (revision 0)
+++ source/Plugins/Process/CMakeLists.txt       (revision 0)
@@ -0,0 +1 @@
+add_subdirectory(gdb-remote)
\ No newline at end of file
Index: source/Plugins/Process/gdb-remote/CMakeLists.txt
===================================================================
--- source/Plugins/Process/gdb-remote/CMakeLists.txt    (revision 0)
+++ source/Plugins/Process/gdb-remote/CMakeLists.txt    (revision 0)
@@ -0,0 +1,12 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbPluginProcessGDBRemote
+  GDBRemoteCommunication.cpp
+  GDBRemoteRegisterContext.cpp
+  GDBServer.cpp
+  GDBServerLog.cpp
+  ProcessGDBRemote.cpp
+  ProcessGDBRemoteLog.cpp
+  ThreadGDBRemote.cpp
+  )
+
Index: source/Interpreter/CMakeLists.txt
===================================================================
--- source/Interpreter/CMakeLists.txt   (revision 0)
+++ source/Interpreter/CMakeLists.txt   (revision 0)
@@ -0,0 +1,15 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbInterpreter
+  Args.cpp
+  CommandInterpreter.cpp
+  CommandObject.cpp
+  CommandObjectRegexCommand.cpp
+  CommandObjectScript.cpp
+  CommandReturnObject.cpp
+  Options.cpp
+  ScriptInterpreter.cpp
+  ScriptInterpreterNone.cpp
+  ScriptInterpreterPython.cpp
+  StateVariable.cpp
+  )
Index: source/Utility/CMakeLists.txt
===================================================================
--- source/Utility/CMakeLists.txt       (revision 0)
+++ source/Utility/CMakeLists.txt       (revision 0)
@@ -0,0 +1,8 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbUtility
+  PseudoTerminal.cpp
+  SharingPtr.cpp
+  StringExtractor.cpp
+  StringExtractorGDBRemote.cpp
+  )
Index: source/Symbol/CMakeLists.txt
===================================================================
--- source/Symbol/CMakeLists.txt        (revision 0)
+++ source/Symbol/CMakeLists.txt        (revision 0)
@@ -0,0 +1,22 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbSymbol
+  Block.cpp
+  ClangASTContext.cpp
+  CompileUnit.cpp
+  Declaration.cpp
+  DWARFCallFrameInfo.cpp
+  Function.cpp
+  LineEntry.cpp
+  LineTable.cpp
+  ObjectFile.cpp
+  SymbolContext.cpp
+  Symbol.cpp
+  SymbolFile.cpp
+  SymbolVendor.cpp
+  Symtab.cpp
+  Type.cpp
+  TypeList.cpp
+  Variable.cpp
+  VariableList.cpp
+  )
Index: source/Target/CMakeLists.txt
===================================================================
--- source/Target/CMakeLists.txt        (revision 0)
+++ source/Target/CMakeLists.txt        (revision 0)
@@ -0,0 +1,33 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbTarget
+  ABI.cpp
+  ExecutionContext.cpp
+  ObjCObjectPrinter.cpp
+  PathMappingList.cpp
+  Process.cpp
+  RegisterContext.cpp
+  StackFrame.cpp
+  StackFrameList.cpp
+  StackID.cpp
+  Target.cpp
+  TargetList.cpp
+  Thread.cpp
+  ThreadList.cpp
+  ThreadPlanBase.cpp
+  ThreadPlanCallFunction.cpp
+  ThreadPlan.cpp
+  ThreadPlanRunToAddress.cpp
+  ThreadPlanShouldStopHere.cpp
+  ThreadPlanStepInRange.cpp
+  ThreadPlanStepInstruction.cpp
+  ThreadPlanStepOut.cpp
+  ThreadPlanStepOverBreakpoint.cpp
+  ThreadPlanStepOverRange.cpp
+  ThreadPlanStepRange.cpp
+  ThreadPlanStepThrough.cpp
+  ThreadPlanStepUntil.cpp
+  ThreadSpec.cpp
+  UnixSignals.cpp 
+  )
+
Index: source/Core/CMakeLists.txt
===================================================================
--- source/Core/CMakeLists.txt  (revision 0)
+++ source/Core/CMakeLists.txt  (revision 0)
@@ -0,0 +1,57 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbCore
+  Address.cpp
+  AddressRange.cpp
+  AddressResolver.cpp
+  AddressResolverFileLine.cpp
+  AddressResolverName.cpp
+  ArchSpec.cpp
+  Baton.cpp
+  Broadcaster.cpp
+  Communication.cpp
+  Connection.cpp
+  ConnectionFileDescriptor.cpp
+  ConstString.cpp
+  DataBufferHeap.cpp
+  DataBufferMemoryMap.cpp
+  DataExtractor.cpp
+  Debugger.cpp
+  Disassembler.cpp
+  DynamicLoader.cpp
+  Error.cpp
+  Event.cpp
+  FileSpec.cpp
+  FileSpecList.cpp
+  Flags.cpp
+  InputReader.cpp
+  Language.cpp
+  Listener.cpp
+  Log.cpp
+  Mangled.cpp
+  ModuleChild.cpp
+  Module.cpp
+  ModuleList.cpp
+  PluginManager.cpp
+  RegularExpression.cpp
+  Scalar.cpp
+  SearchFilter.cpp
+  Section.cpp
+  SourceManager.cpp
+  State.cpp
+  Stream.cpp
+  StreamFile.cpp
+  StreamString.cpp
+  StringList.cpp
+  Timer.cpp
+  TTYState.cpp
+  UserID.cpp
+  UUID.cpp
+  Value.cpp
+  ValueObjectChild.cpp
+  ValueObject.cpp
+  ValueObjectList.cpp
+  ValueObjectRegister.cpp
+  ValueObjectVariable.cpp
+  VMRange.cpp
+  )
Index: source/API/CMakeLists.txt
===================================================================
--- source/API/CMakeLists.txt   (revision 0)
+++ source/API/CMakeLists.txt   (revision 0)
@@ -0,0 +1,38 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbAPI
+  SBAddress.cpp
+  SBBlock.cpp
+  SBBreakpoint.cpp
+  SBBreakpointLocation.cpp
+  SBBroadcaster.cpp
+  SBCommandContext.cpp
+  SBCommandInterpreter.cpp
+  SBCommandReturnObject.cpp
+  SBCommunication.cpp
+  SBCompileUnit.cpp
+  SBDebugger.cpp
+  SBError.cpp
+  SBEvent.cpp
+  SBFileSpec.cpp
+  SBFrame.cpp
+  SBFunction.cpp
+  SBHostOS.cpp
+  SBInputReader.cpp
+  SBInstruction.cpp
+  SBInstructionList.cpp
+  SBLineEntry.cpp
+  SBListener.cpp
+  SBModule.cpp
+  SBProcess.cpp
+  SBSourceManager.cpp
+  SBStringList.cpp
+  SBSymbolContext.cpp
+  SBSymbol.cpp
+  SBTarget.cpp
+  SBThread.cpp
+  SBType.cpp
+  SBValue.cpp
+  SBValueList.cpp
+  )
+  
Index: source/Host/CMakeLists.txt
===================================================================
--- source/Host/CMakeLists.txt  (revision 0)
+++ source/Host/CMakeLists.txt  (revision 0)
@@ -0,0 +1 @@
+add_subdirectory(linux)
Index: source/Host/linux/CMakeLists.txt
===================================================================
--- source/Host/linux/CMakeLists.txt    (revision 0)
+++ source/Host/linux/CMakeLists.txt    (revision 0)
@@ -0,0 +1,9 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbHostLinux
+  Condition.cpp
+  Host.cpp
+  Mutex.cpp
+  Symbols.cpp
+  TimeValue.cpp
+  )
Index: source/Breakpoint/CMakeLists.txt
===================================================================
--- source/Breakpoint/CMakeLists.txt    (revision 0)
+++ source/Breakpoint/CMakeLists.txt    (revision 0)
@@ -0,0 +1,22 @@
+set(LLVM_NO_RTTI 1)
+
+add_lldb_library(lldbBreakpoint
+  Breakpoint.cpp
+  BreakpointID.cpp
+  BreakpointIDList.cpp
+  BreakpointList.cpp
+  BreakpointLocationCollection.cpp
+  BreakpointLocation.cpp
+  BreakpointLocationList.cpp
+  BreakpointOptions.cpp
+  BreakpointResolverAddress.cpp
+  BreakpointResolver.cpp
+  BreakpointResolverFileLine.cpp
+  BreakpointResolverName.cpp
+  BreakpointSite.cpp
+  BreakpointSiteList.cpp
+  StoppointCallbackContext.cpp
+  Stoppoint.cpp
+  StoppointLocation.cpp
+  WatchpointLocation.cpp
+  )
Index: tools/CMakeLists.txt
===================================================================
--- tools/CMakeLists.txt        (revision 0)
+++ tools/CMakeLists.txt        (revision 0)
@@ -0,0 +1,2 @@
+#add_subdirectory(debugserver)
+add_subdirectory(driver)
Index: tools/driver/CMakeLists.txt
===================================================================
--- tools/driver/CMakeLists.txt (revision 0)
+++ tools/driver/CMakeLists.txt (revision 0)
@@ -0,0 +1,60 @@
+set(LLVM_NO_RTTI 1)
+
+set( LLVM_USED_LIBS
+  lldbAPI
+  lldbInterpreter
+  lldbInitAndLog
+  lldbAPI
+  lldbPluginDisassemblerLLVM
+  lldbPluginObjectFileELF
+  lldbPluginObjectContainerBSDArchive
+  lldbPluginSymbolFileDWARF
+  lldbPluginSymbolFileSymtab
+#  lldbPluginSymbolVendorMacOSX
+  lldbTarget
+  lldbCommands
+  lldbBreakpoint
+  lldbCore
+  lldbSymbol
+  lldbExpression
+  lldbUtility
+  lldbHostLinux
+  clangFrontend
+  clangDriver
+  clangCodeGen
+  clangSema
+  clangChecker
+  clangAnalysis
+  clangRewrite
+  clangAST
+  clangParse
+  clangLex
+  clangBasic
+  EnhancedDisassembly
+  edit
+  python2.6
+)
+
+set( LLVM_LINK_COMPONENTS
+  ${LLVM_TARGETS_TO_BUILD}
+  jit
+  interpreter
+  nativecodegen
+  asmparser
+  bitreader
+  bitwriter
+  codegen
+  ipo
+  selectiondag
+  bitreader
+  mc
+  core
+  )
+
+add_lldb_executable(lldb
+  Driver.cpp
+  IOChannel.cpp
+  )
+
+install(TARGETS lldb
+  RUNTIME DESTINATION bin)

_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to