diff options
| author | Pavel Labath <labath@google.com> | 2017-10-31 13:23:19 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2017-10-31 13:23:19 +0000 |
| commit | f753bfeeec449dcd0e56bfa98b359598e4798b1f (patch) | |
| tree | b90980fac499ccab6a8020ad07b487abe7647c34 /lldb | |
| parent | d1089e5cea535741b728e4582b0456612f626db9 (diff) | |
| download | bcm5719-llvm-f753bfeeec449dcd0e56bfa98b359598e4798b1f.tar.gz bcm5719-llvm-f753bfeeec449dcd0e56bfa98b359598e4798b1f.zip | |
Fix LLVM_LINK_LLVM_DYLIB build (pr35053)
Summary:
r316368 broke this build when it introduced a reference to a pthread
function to the Utility module. This caused cmake to generate an
incorrect link line (wrong order of libs) because it did not see the
dependency from Utility to the system libraries. Instead these libraries
were being manually added to each final target.
This changes moves the dependency management from the individual targets
to the lldbUtility module, which is consistent with how llvm does it.
The final targets will pick up these libraries as they will be a part of
the link interface of the module.
Technically, some of these dependencies could go into the host module,
as that's where most of the os-specific code is, but I did not try to
investigate which ones.
Reviewers: zturner, sylvestre.ledru
Subscribers: lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D39246
llvm-svn: 316997
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/cmake/LLDBDependencies.cmake | 52 | ||||
| -rw-r--r-- | lldb/scripts/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | lldb/source/API/CMakeLists.txt | 17 | ||||
| -rw-r--r-- | lldb/source/Utility/CMakeLists.txt | 44 | ||||
| -rw-r--r-- | lldb/tools/argdumper/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | lldb/tools/driver/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | lldb/tools/intel-features/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | lldb/tools/lldb-server/CMakeLists.txt | 35 | ||||
| -rw-r--r-- | lldb/unittests/CMakeLists.txt | 4 |
9 files changed, 56 insertions, 108 deletions
diff --git a/lldb/cmake/LLDBDependencies.cmake b/lldb/cmake/LLDBDependencies.cmake deleted file mode 100644 index 55ce3790856..00000000000 --- a/lldb/cmake/LLDBDependencies.cmake +++ /dev/null @@ -1,52 +0,0 @@ -set(LLDB_SYSTEM_LIBS) - -# Windows-only libraries -if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) - list(APPEND LLDB_SYSTEM_LIBS - ws2_32 - rpcrt4 - ) -endif () - -if (NOT LLDB_DISABLE_LIBEDIT) - list(APPEND LLDB_SYSTEM_LIBS edit) -endif() -if (NOT LLDB_DISABLE_CURSES) - list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES}) - if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO) - list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS}) - endif() -endif() - -if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB ) - list(APPEND LLDB_SYSTEM_LIBS atomic) -endif() - -list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY}) - -if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC) - list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES}) -endif() - -list(APPEND LLDB_SYSTEM_LIBS ${system_libs}) - -if (LLVM_BUILD_STATIC) - if (NOT LLDB_DISABLE_PYTHON) - list(APPEND LLDB_SYSTEM_LIBS python2.7 util) - endif() - if (NOT LLDB_DISABLE_CURSES) - list(APPEND LLDB_SYSTEM_LIBS gpm) - endif() -endif() - -if ( NOT LLDB_DISABLE_PYTHON ) - set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1) - if (CLANG_CL) - set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES COMPILE_FLAGS -Wno-unused-function) - endif() - if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND - NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") - set_property(SOURCE ${LLDB_WRAP_PYTHON} - APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual") - endif () -endif() diff --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt index fad841b37c0..1fe34115244 100644 --- a/lldb/scripts/CMakeLists.txt +++ b/lldb/scripts/CMakeLists.txt @@ -48,10 +48,10 @@ add_custom_command( --swigExecutable=${SWIG_EXECUTABLE} VERBATIM COMMENT "Python script building LLDB Python wrapper") -set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1) +add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON}) + set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldb.py PROPERTIES GENERATED 1) -add_custom_target(swig_wrapper ALL DEPENDS ${LLDB_WRAP_PYTHON}) # Install the LLDB python module install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR}) diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index 939229aaa3f..c96e59be5a4 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -2,10 +2,6 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) add_definitions( -DEXPORT_LIBLLDB ) endif() -# Include this so that add_lldb_library() has the list of dependencies -# 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) @@ -112,9 +108,17 @@ if (LLVM_ENABLE_WERROR) set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING PROPERTY COMPILE_FLAGS " -w") endif() endif() +set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1) +if (CLANG_CL) + set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING + PROPERTY COMPILE_FLAGS " -Wno-unused-function") +endif() +if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND + NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") + set_property(SOURCE ${LLDB_WRAP_PYTHON} APPEND_STRING + PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual") +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 lldbPluginScriptInterpreterNone lldbPluginScriptInterpreterPython @@ -156,7 +160,6 @@ endif() if (LLDB_WRAP_PYTHON) add_dependencies(liblldb swig_wrapper) endif() -target_link_libraries(liblldb PRIVATE ${LLDB_SYSTEM_LIBS}) if(LLDB_BUILD_FRAMEWORK) file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt index 1457c01bc1d..ef2a6b872bd 100644 --- a/lldb/source/Utility/CMakeLists.txt +++ b/lldb/source/Utility/CMakeLists.txt @@ -1,3 +1,44 @@ +set(LLDB_SYSTEM_LIBS) + +# Windows-only libraries +if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) + list(APPEND LLDB_SYSTEM_LIBS + ws2_32 + rpcrt4 + ) +endif () + +if (NOT LLDB_DISABLE_LIBEDIT) + list(APPEND LLDB_SYSTEM_LIBS edit) +endif() +if (NOT LLDB_DISABLE_CURSES) + list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES}) + if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO) + list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS}) + endif() +endif() + +if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB ) + list(APPEND LLDB_SYSTEM_LIBS atomic) +endif() + +list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY}) + +if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC) + list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES}) +endif() + +list(APPEND LLDB_SYSTEM_LIBS ${system_libs}) + +if (LLVM_BUILD_STATIC) + if (NOT LLDB_DISABLE_PYTHON) + list(APPEND LLDB_SYSTEM_LIBS python2.7 util) + endif() + if (NOT LLDB_DISABLE_CURSES) + list(APPEND LLDB_SYSTEM_LIBS gpm) + endif() +endif() + add_lldb_library(lldbUtility Baton.cpp Connection.cpp @@ -38,7 +79,8 @@ add_lldb_library(lldbUtility VMRange.cpp LINK_LIBS - # lldbUtility cannot have any dependencies + ${LLDB_SYSTEM_LIBS} + # lldbUtility does not depend on other LLDB libraries LINK_COMPONENTS BinaryFormat diff --git a/lldb/tools/argdumper/CMakeLists.txt b/lldb/tools/argdumper/CMakeLists.txt index a0561f12aea..9b22103bc8a 100644 --- a/lldb/tools/argdumper/CMakeLists.txt +++ b/lldb/tools/argdumper/CMakeLists.txt @@ -1,9 +1,6 @@ -include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) - add_lldb_tool(lldb-argdumper INCLUDE_IN_FRAMEWORK argdumper.cpp LINK_LIBS lldbUtility ) - diff --git a/lldb/tools/driver/CMakeLists.txt b/lldb/tools/driver/CMakeLists.txt index 6384d5a92c2..1fac2e5d168 100644 --- a/lldb/tools/driver/CMakeLists.txt +++ b/lldb/tools/driver/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) - if ((CMAKE_SYSTEM_NAME MATCHES "Windows") OR (CMAKE_SYSTEM_NAME MATCHES "NetBSD" )) # These targets do not have getopt support, so they rely on the one provided by diff --git a/lldb/tools/intel-features/CMakeLists.txt b/lldb/tools/intel-features/CMakeLists.txt index 8c286574c66..b5316540fdf 100644 --- a/lldb/tools/intel-features/CMakeLists.txt +++ b/lldb/tools/intel-features/CMakeLists.txt @@ -1,5 +1,3 @@ -include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) - # Flags to control each individual feature option(LLDB_BUILD_INTEL_MPX "Enable Building of Intel(R) Memory Protection Extensions" ON) option(LLDB_BUILD_INTEL_PT "Enable Building of Intel(R) Processor Trace Tool" OFF) @@ -63,7 +61,6 @@ add_lldb_library(lldbIntelFeatures SHARED # Add link dependencies for python wrapper if (NOT LLDB_DISABLE_PYTHON AND LLDB_BUILD_INTEL_PT) add_dependencies(lldbIntelFeatures intel-features-swig_wrapper) - target_link_libraries(lldbIntelFeatures PRIVATE ${LLDB_SYSTEM_LIBS}) endif() install(TARGETS lldbIntelFeatures diff --git a/lldb/tools/lldb-server/CMakeLists.txt b/lldb/tools/lldb-server/CMakeLists.txt index f8c57cb9488..bc3606ddce7 100644 --- a/lldb/tools/lldb-server/CMakeLists.txt +++ b/lldb/tools/lldb-server/CMakeLists.txt @@ -24,41 +24,6 @@ endif () include_directories(../../source) -set(LLDB_SYSTEM_LIBS) -if (NOT LLDB_DISABLE_LIBEDIT) - list(APPEND LLDB_SYSTEM_LIBS edit) -endif() -if (NOT LLDB_DISABLE_CURSES) - list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES}) - if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO) - list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS}) - endif() -endif() - -if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB ) - list(APPEND LLDB_SYSTEM_LIBS atomic) -endif() - -# On FreeBSD/NetBSD backtrace() is provided by libexecinfo, not libc. -if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD") - list(APPEND LLDB_SYSTEM_LIBS execinfo) -endif() - -if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC) - list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES}) -endif() - -list(APPEND LLDB_SYSTEM_LIBS ${system_libs}) - -if (LLVM_BUILD_STATIC) - if (NOT LLDB_DISABLE_PYTHON) - list(APPEND LLDB_SYSTEM_LIBS python2.7 util) - endif() - if (NOT LLDB_DISABLE_CURSES) - list(APPEND LLDB_SYSTEM_LIBS gpm) - endif() -endif() - set(LLDB_PLUGINS) if(CMAKE_SYSTEM_NAME MATCHES "Linux|Android") diff --git a/lldb/unittests/CMakeLists.txt b/lldb/unittests/CMakeLists.txt index 73fdfcf1e56..bee0259a46c 100644 --- a/lldb/unittests/CMakeLists.txt +++ b/lldb/unittests/CMakeLists.txt @@ -11,8 +11,6 @@ else () list(APPEND LLVM_COMPILE_FLAGS -include ${LLDB_GTEST_COMMON_INCLUDE}) endif () -include(${LLDB_PROJECT_ROOT}/cmake/LLDBDependencies.cmake) - if (LLDB_BUILT_STANDALONE) # Build the gtest library needed for unittests, if we have LLVM sources # handy. @@ -46,7 +44,7 @@ function(add_lldb_unittest test_name) POST_BUILD COMMAND "${CMAKE_COMMAND}" -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/Inputs) - target_link_libraries(${test_name} ${ARG_LINK_LIBS} ${LLDB_SYSTEM_LIBS}) + target_link_libraries(${test_name} ${ARG_LINK_LIBS}) endfunction() function(add_unittest_inputs test_name inputs) |

