From ab411801b82783eb7f652701ccfce81b16cf1811 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 14 Nov 2019 05:39:58 +0000 Subject: [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries" Summary: Most libraries are defined in the lib/ directory but there are also a few libraries defined in tools/ e.g. libLLVM, libLTO. I'm defining "Component Libraries" as libraries defined in lib/ that may be included in libLLVM.so. Explicitly marking the libraries in lib/ as component libraries allows us to remove some fragile checks that attempt to differentiate between lib/ libraries and tools/ libraires: 1. In tools/llvm-shlib, because llvm_map_components_to_libnames(LIB_NAMES "all") returned a list of all libraries defined in the whole project, there was custom code needed to filter out libraries defined in tools/, none of which should be included in libLLVM.so. This code assumed that any library defined as static was from lib/ and everything else should be excluded. With this change, llvm_map_components_to_libnames(LIB_NAMES, "all") only returns libraries that have been added to the LLVM_COMPONENT_LIBS global cmake property, so this custom filtering logic can be removed. Doing this also fixes the build with BUILD_SHARED_LIBS=ON and LLVM_BUILD_LLVM_DYLIB=ON. 2. There was some code in llvm_add_library that assumed that libraries defined in lib/ would not have LLVM_LINK_COMPONENTS or ARG_LINK_COMPONENTS set. This is only true because libraries defined lib lib/ use LLVMBuild.txt and don't set these values. This code has been fixed now to check if the library has been explicitly marked as a component library, which should now make it easier to remove LLVMBuild at some point in the future. I have tested this patch on Windows, MacOS and Linux with release builds and the following combinations of CMake options: - "" (No options) - -DLLVM_BUILD_LLVM_DYLIB=ON - -DLLVM_LINK_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_BUILD_LLVM_DYLIB=ON - -DBUILD_SHARED_LIBS=ON -DLLVM_LINK_LLVM_DYLIB=ON Reviewers: beanz, smeenai, compnerd, phosek Reviewed By: beanz Subscribers: wuzish, jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, mgorny, mehdi_amini, sbc100, jgravelle-google, hiraditya, aheejin, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, steven_wu, rogfer01, MartinMosbeck, brucehoult, the_o, dexonsmith, PkmX, jocewei, jsji, dang, Jim, lenary, s.egerton, pzheng, sameer.abuasal, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D70179 --- llvm/lib/ExecutionEngine/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/MCJIT/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/OProfileJIT/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/Orc/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/PerfJITEvents/CMakeLists.txt | 2 +- llvm/lib/ExecutionEngine/RuntimeDyld/CMakeLists.txt | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'llvm/lib/ExecutionEngine') diff --git a/llvm/lib/ExecutionEngine/CMakeLists.txt b/llvm/lib/ExecutionEngine/CMakeLists.txt index c5445fbc16d..9b5dd44e079 100644 --- a/llvm/lib/ExecutionEngine/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/CMakeLists.txt @@ -1,6 +1,6 @@ -add_llvm_library(LLVMExecutionEngine +add_llvm_component_library(LLVMExecutionEngine ExecutionEngine.cpp ExecutionEngineBindings.cpp GDBRegistrationListener.cpp diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt index e6c33b2ecc2..70446e32a6d 100644 --- a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt @@ -7,7 +7,7 @@ endif() set(LLVM_INTEL_JIT_LIBS ${LLVM_PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS}) -add_llvm_library(LLVMIntelJITEvents +add_llvm_component_library(LLVMIntelJITEvents IntelJITEventListener.cpp jitprofiling.c diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt index 7456b3dbe90..b8adea5b7a9 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt @@ -6,7 +6,7 @@ if( FFI_INCLUDE_PATH ) include_directories( ${FFI_INCLUDE_PATH} ) endif() -add_llvm_library(LLVMInterpreter +add_llvm_component_library(LLVMInterpreter Execution.cpp ExternalFunctions.cpp Interpreter.cpp diff --git a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt index af4efadd6ba..d5a886b2f5a 100644 --- a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt @@ -1,4 +1,4 @@ -add_llvm_library(LLVMJITLink +add_llvm_component_library(LLVMJITLink JITLink.cpp JITLinkGeneric.cpp JITLinkMemoryManager.cpp diff --git a/llvm/lib/ExecutionEngine/MCJIT/CMakeLists.txt b/llvm/lib/ExecutionEngine/MCJIT/CMakeLists.txt index b1e2bc3d635..77066cac4d8 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/MCJIT/CMakeLists.txt @@ -1,4 +1,4 @@ -add_llvm_library(LLVMMCJIT +add_llvm_component_library(LLVMMCJIT MCJIT.cpp DEPENDS diff --git a/llvm/lib/ExecutionEngine/OProfileJIT/CMakeLists.txt b/llvm/lib/ExecutionEngine/OProfileJIT/CMakeLists.txt index d585136eb0a..9bbf2d61b1c 100644 --- a/llvm/lib/ExecutionEngine/OProfileJIT/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/OProfileJIT/CMakeLists.txt @@ -1,7 +1,7 @@ include_directories( ${LLVM_OPROFILE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ) -add_llvm_library(LLVMOProfileJIT +add_llvm_component_library(LLVMOProfileJIT OProfileJITEventListener.cpp OProfileWrapper.cpp ) diff --git a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt index 4a18f884744..e3a7a67c8a0 100644 --- a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt @@ -1,4 +1,4 @@ -add_llvm_library(LLVMOrcJIT +add_llvm_component_library(LLVMOrcJIT CompileOnDemandLayer.cpp CompileUtils.cpp Core.cpp diff --git a/llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt b/llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt index 7273a33030e..bd968d55e67 100644 --- a/llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt @@ -1,4 +1,4 @@ -add_llvm_library(LLVMOrcError +add_llvm_component_library(LLVMOrcError OrcError.cpp RPCError.cpp ADDITIONAL_HEADER_DIRS diff --git a/llvm/lib/ExecutionEngine/PerfJITEvents/CMakeLists.txt b/llvm/lib/ExecutionEngine/PerfJITEvents/CMakeLists.txt index 136cc429d02..e0b8200f119 100644 --- a/llvm/lib/ExecutionEngine/PerfJITEvents/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/PerfJITEvents/CMakeLists.txt @@ -1,4 +1,4 @@ -add_llvm_library(LLVMPerfJITEvents +add_llvm_component_library(LLVMPerfJITEvents PerfJITEventListener.cpp ) diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/CMakeLists.txt b/llvm/lib/ExecutionEngine/RuntimeDyld/CMakeLists.txt index 3fa7ee6bb71..86a6dba12e2 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/CMakeLists.txt @@ -1,4 +1,4 @@ -add_llvm_library(LLVMRuntimeDyld +add_llvm_component_library(LLVMRuntimeDyld JITSymbol.cpp RTDyldMemoryManager.cpp RuntimeDyld.cpp -- cgit v1.2.3