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

llvm-svn: 249806
This commit is contained in:
Bruce Mitchener 2015-10-09 03:40:55 +00:00
parent 1825fac3c9
commit 6ec5d61bda
4 changed files with 26 additions and 17 deletions

View File

@ -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

View File

@ -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})

View File

@ -14,10 +14,33 @@ include_directories(
)
endif ()
add_lldb_library(lldbBase
lldb.cpp
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
${lldbBase_SOURCES}
)
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_dependencies(lldbBase lldbGeneratedVersion)
endif()
add_subdirectory(Breakpoint)
add_subdirectory(Commands)
add_subdirectory(Core)

View File

@ -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