[Lldb-commits] [lldb] r249806 - Fix handling of LLDB_VERS_GENERATED_FILE.

Bruce Mitchener via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 8 20:40:55 PDT 2015


Author: brucem
Date: Thu Oct  8 22:40:55 2015
New Revision: 249806

URL: http://llvm.org/viewvc/llvm-project?rev=249806&view=rev
Log:
Fix handling of LLDB_VERS_GENERATED_FILE.

Summary:
This is Darwin only.

The symbol defined by ${LLDB_VERS_GENERATED_FILE} is used by
source/lldb.cpp, so anything that uses lldb.cpp (which is in
lldbBase) should also have the generated symbol. This means
that the entire process can be centralized within source/CMakeLists.txt
where lldbBase is constructed.

Additionally, the custom command should have dependencies on the
project file as well as the generation script so that if either
changes, the version file is correctly re-generated and everything
is re-linked appropriately.

* cmake/LLDBDependencies.cmake: Remove everything related to
  the generated version file from here.

* source/CMakeLists.txt: On Darwin, add the generated version
  file to the sources that make up lldbBase.  Also, create a
  custom target and make lldbBase depend on it to re-generate
  the generated file as needed.

* source/API/CMakeLists.txt: Don't need to build the generated
  version file here or use it to control linking against swig_wrapper.

* tools/lldb-server/CMakeLists.txt: Likewise.

Reviewers: dawn, sas, clayborg, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13552

Modified:
    lldb/trunk/cmake/LLDBDependencies.cmake
    lldb/trunk/source/API/CMakeLists.txt
    lldb/trunk/source/CMakeLists.txt
    lldb/trunk/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/cmake/LLDBDependencies.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/LLDBDependencies.cmake?rev=249806&r1=249805&r2=249806&view=diff
==============================================================================
--- lldb/trunk/cmake/LLDBDependencies.cmake (original)
+++ lldb/trunk/cmake/LLDBDependencies.cmake Thu Oct  8 22:40:55 2015
@@ -104,13 +104,6 @@ endif ()
 
 # Darwin-only libraries
 if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
-  set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
-  add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
-    COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
-            ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
-            > ${LLDB_VERS_GENERATED_FILE})
-
-  set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
   list(APPEND LLDB_USED_LIBS
     lldbPluginDynamicLoaderDarwinKernel
     lldbPluginObjectFileMachO

Modified: lldb/trunk/source/API/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/CMakeLists.txt?rev=249806&r1=249805&r2=249806&view=diff
==============================================================================
--- lldb/trunk/source/API/CMakeLists.txt (original)
+++ lldb/trunk/source/API/CMakeLists.txt Thu Oct  8 22:40:55 2015
@@ -67,7 +67,6 @@ add_lldb_library(liblldb SHARED
   SBUnixSignals.cpp
   SystemInitializerFull.cpp
   ${LLDB_WRAP_PYTHON}
-  ${LLDB_VERS_GENERATED_FILE}
   )
 
 # This should not be part of LLDBDependencies.cmake, because we don't
@@ -99,7 +98,7 @@ else()
     )
 endif()
 
-if (LLDB_WRAP_PYTHON OR LLDB_VERS_GENERATED_FILE)
+if (LLDB_WRAP_PYTHON)
   add_dependencies(liblldb swig_wrapper)
 endif()
 target_link_libraries(liblldb ${cmake_2_8_12_PRIVATE} ${LLDB_SYSTEM_LIBS})

Modified: lldb/trunk/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/CMakeLists.txt?rev=249806&r1=249805&r2=249806&view=diff
==============================================================================
--- lldb/trunk/source/CMakeLists.txt (original)
+++ lldb/trunk/source/CMakeLists.txt Thu Oct  8 22:40:55 2015
@@ -14,10 +14,33 @@ include_directories(
   )
 endif ()
 
+set(lldbBase_SOURCES
+    lldb.cpp
+  )
+
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  set(LLDB_VERS_GENERATED_FILE ${LLDB_BINARY_DIR}/source/LLDB_vers.c)
+  add_custom_command(OUTPUT ${LLDB_VERS_GENERATED_FILE}
+    COMMAND ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
+            ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj liblldb_core
+            > ${LLDB_VERS_GENERATED_FILE}
+    DEPENDS ${LLDB_SOURCE_DIR}/scripts/generate-vers.pl
+            ${LLDB_SOURCE_DIR}/lldb.xcodeproj/project.pbxproj)
+  set_source_files_properties(${LLDB_VERS_GENERATED_FILE} PROPERTIES GENERATED 1)
+  # Add this to lldbBase since lldb.cpp uses the symbol defined here.
+  list(APPEND lldbBase_SOURCES ${LLDB_VERS_GENERATED_FILE})
+  add_custom_target(lldbGeneratedVersion
+    DEPENDS ${LLDB_VERS_GENERATED_FILE})
+endif()
+
 add_lldb_library(lldbBase
-  lldb.cpp
+  ${lldbBase_SOURCES}
   )
 
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+  add_dependencies(lldbBase lldbGeneratedVersion)
+endif()
+
 add_subdirectory(Breakpoint)
 add_subdirectory(Commands)
 add_subdirectory(Core)

Modified: lldb/trunk/tools/lldb-server/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/CMakeLists.txt?rev=249806&r1=249805&r2=249806&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/tools/lldb-server/CMakeLists.txt Thu Oct  8 22:40:55 2015
@@ -34,14 +34,8 @@ else()
     lldb-platform.cpp
     lldb-server.cpp
     LLDBServerUtilities.cpp
-    ../../source/lldb.cpp
-    ${LLDB_VERS_GENERATED_FILE}
     )
 
-  if (LLDB_VERS_GENERATED_FILE)
-    add_dependencies(lldb-server swig_wrapper)
-  endif()
-
   # The Darwin linker doesn't understand --start-group/--end-group.
   if (LLDB_LINKER_SUPPORTS_GROUPS)
     target_link_libraries(lldb-server




More information about the lldb-commits mailing list