[PATCH] D70179: [cmake] Explicitly mark libraries defined in lib/ as "Component Libraries"

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 06:53:33 PST 2019


tstellar created this revision.
tstellar added reviewers: beanz, smeenai, compnerd, phosek.
Herald added subscribers: sameer.abuasal, pzheng, s.egerton, lenary, Jim, dang, jsji, jocewei, PkmX, dexonsmith, the_o, brucehoult, MartinMosbeck, rogfer01, steven_wu, atanasyan, edward-jones, zzheng, MaskRay, jrtc27, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar, asb, fedor.sergeev, aheejin, hiraditya, jgravelle-google, sbc100, mehdi_amini, mgorny, nhaehnle, jvesely, nemanjai, sdardis, dylanmckay, jyknight, dschuff, arsenm, jholewinski.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70179

Files:
  llvm/cmake/modules/AddLLVM.cmake
  llvm/cmake/modules/LLVM-Config.cmake
  llvm/lib/Analysis/CMakeLists.txt
  llvm/lib/AsmParser/CMakeLists.txt
  llvm/lib/BinaryFormat/CMakeLists.txt
  llvm/lib/Bitcode/Reader/CMakeLists.txt
  llvm/lib/Bitcode/Writer/CMakeLists.txt
  llvm/lib/Bitstream/Reader/CMakeLists.txt
  llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt
  llvm/lib/CodeGen/CMakeLists.txt
  llvm/lib/CodeGen/GlobalISel/CMakeLists.txt
  llvm/lib/CodeGen/MIRParser/CMakeLists.txt
  llvm/lib/CodeGen/SelectionDAG/CMakeLists.txt
  llvm/lib/DebugInfo/CodeView/CMakeLists.txt
  llvm/lib/DebugInfo/DWARF/CMakeLists.txt
  llvm/lib/DebugInfo/GSYM/CMakeLists.txt
  llvm/lib/DebugInfo/MSF/CMakeLists.txt
  llvm/lib/DebugInfo/PDB/CMakeLists.txt
  llvm/lib/DebugInfo/Symbolize/CMakeLists.txt
  llvm/lib/Demangle/CMakeLists.txt
  llvm/lib/ExecutionEngine/CMakeLists.txt
  llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
  llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
  llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
  llvm/lib/ExecutionEngine/MCJIT/CMakeLists.txt
  llvm/lib/ExecutionEngine/OProfileJIT/CMakeLists.txt
  llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
  llvm/lib/ExecutionEngine/OrcError/CMakeLists.txt
  llvm/lib/ExecutionEngine/PerfJITEvents/CMakeLists.txt
  llvm/lib/ExecutionEngine/RuntimeDyld/CMakeLists.txt
  llvm/lib/FuzzMutate/CMakeLists.txt
  llvm/lib/IR/CMakeLists.txt
  llvm/lib/IRReader/CMakeLists.txt
  llvm/lib/LTO/CMakeLists.txt
  llvm/lib/LineEditor/CMakeLists.txt
  llvm/lib/Linker/CMakeLists.txt
  llvm/lib/MC/CMakeLists.txt
  llvm/lib/MC/MCDisassembler/CMakeLists.txt
  llvm/lib/MC/MCParser/CMakeLists.txt
  llvm/lib/MCA/CMakeLists.txt
  llvm/lib/Object/CMakeLists.txt
  llvm/lib/ObjectYAML/CMakeLists.txt
  llvm/lib/Option/CMakeLists.txt
  llvm/lib/Passes/CMakeLists.txt
  llvm/lib/ProfileData/CMakeLists.txt
  llvm/lib/ProfileData/Coverage/CMakeLists.txt
  llvm/lib/Remarks/CMakeLists.txt
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/TableGen/CMakeLists.txt
  llvm/lib/Target/AArch64/AsmParser/CMakeLists.txt
  llvm/lib/Target/AArch64/Disassembler/CMakeLists.txt
  llvm/lib/Target/AArch64/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/AArch64/TargetInfo/CMakeLists.txt
  llvm/lib/Target/AArch64/Utils/CMakeLists.txt
  llvm/lib/Target/AMDGPU/AsmParser/CMakeLists.txt
  llvm/lib/Target/AMDGPU/Disassembler/CMakeLists.txt
  llvm/lib/Target/AMDGPU/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/AMDGPU/TargetInfo/CMakeLists.txt
  llvm/lib/Target/AMDGPU/Utils/CMakeLists.txt
  llvm/lib/Target/ARC/Disassembler/CMakeLists.txt
  llvm/lib/Target/ARC/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/ARC/TargetInfo/CMakeLists.txt
  llvm/lib/Target/ARM/AsmParser/CMakeLists.txt
  llvm/lib/Target/ARM/Disassembler/CMakeLists.txt
  llvm/lib/Target/ARM/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/ARM/TargetInfo/CMakeLists.txt
  llvm/lib/Target/ARM/Utils/CMakeLists.txt
  llvm/lib/Target/AVR/AsmParser/CMakeLists.txt
  llvm/lib/Target/AVR/Disassembler/CMakeLists.txt
  llvm/lib/Target/AVR/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/AVR/TargetInfo/CMakeLists.txt
  llvm/lib/Target/BPF/AsmParser/CMakeLists.txt
  llvm/lib/Target/BPF/Disassembler/CMakeLists.txt
  llvm/lib/Target/BPF/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/BPF/TargetInfo/CMakeLists.txt
  llvm/lib/Target/CMakeLists.txt
  llvm/lib/Target/Hexagon/AsmParser/CMakeLists.txt
  llvm/lib/Target/Hexagon/Disassembler/CMakeLists.txt
  llvm/lib/Target/Hexagon/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/Hexagon/TargetInfo/CMakeLists.txt
  llvm/lib/Target/Lanai/AsmParser/CMakeLists.txt
  llvm/lib/Target/Lanai/Disassembler/CMakeLists.txt
  llvm/lib/Target/Lanai/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/Lanai/TargetInfo/CMakeLists.txt
  llvm/lib/Target/MSP430/AsmParser/CMakeLists.txt
  llvm/lib/Target/MSP430/Disassembler/CMakeLists.txt
  llvm/lib/Target/MSP430/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/MSP430/TargetInfo/CMakeLists.txt
  llvm/lib/Target/Mips/AsmParser/CMakeLists.txt
  llvm/lib/Target/Mips/Disassembler/CMakeLists.txt
  llvm/lib/Target/Mips/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/Mips/TargetInfo/CMakeLists.txt
  llvm/lib/Target/NVPTX/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/NVPTX/TargetInfo/CMakeLists.txt
  llvm/lib/Target/PowerPC/AsmParser/CMakeLists.txt
  llvm/lib/Target/PowerPC/Disassembler/CMakeLists.txt
  llvm/lib/Target/PowerPC/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/PowerPC/TargetInfo/CMakeLists.txt
  llvm/lib/Target/RISCV/AsmParser/CMakeLists.txt
  llvm/lib/Target/RISCV/Disassembler/CMakeLists.txt
  llvm/lib/Target/RISCV/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/RISCV/TargetInfo/CMakeLists.txt
  llvm/lib/Target/RISCV/Utils/CMakeLists.txt
  llvm/lib/Target/Sparc/AsmParser/CMakeLists.txt
  llvm/lib/Target/Sparc/Disassembler/CMakeLists.txt
  llvm/lib/Target/Sparc/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/Sparc/TargetInfo/CMakeLists.txt
  llvm/lib/Target/SystemZ/AsmParser/CMakeLists.txt
  llvm/lib/Target/SystemZ/Disassembler/CMakeLists.txt
  llvm/lib/Target/SystemZ/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/SystemZ/TargetInfo/CMakeLists.txt
  llvm/lib/Target/WebAssembly/AsmParser/CMakeLists.txt
  llvm/lib/Target/WebAssembly/Disassembler/CMakeLists.txt
  llvm/lib/Target/WebAssembly/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/WebAssembly/TargetInfo/CMakeLists.txt
  llvm/lib/Target/X86/AsmParser/CMakeLists.txt
  llvm/lib/Target/X86/Disassembler/CMakeLists.txt
  llvm/lib/Target/X86/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/X86/TargetInfo/CMakeLists.txt
  llvm/lib/Target/X86/Utils/CMakeLists.txt
  llvm/lib/Target/XCore/Disassembler/CMakeLists.txt
  llvm/lib/Target/XCore/MCTargetDesc/CMakeLists.txt
  llvm/lib/Target/XCore/TargetInfo/CMakeLists.txt
  llvm/lib/TextAPI/CMakeLists.txt
  llvm/lib/ToolDrivers/llvm-dlltool/CMakeLists.txt
  llvm/lib/ToolDrivers/llvm-lib/CMakeLists.txt
  llvm/lib/Transforms/AggressiveInstCombine/CMakeLists.txt
  llvm/lib/Transforms/CFGuard/CMakeLists.txt
  llvm/lib/Transforms/Coroutines/CMakeLists.txt
  llvm/lib/Transforms/IPO/CMakeLists.txt
  llvm/lib/Transforms/InstCombine/CMakeLists.txt
  llvm/lib/Transforms/Instrumentation/CMakeLists.txt
  llvm/lib/Transforms/ObjCARC/CMakeLists.txt
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Utils/CMakeLists.txt
  llvm/lib/Transforms/Vectorize/CMakeLists.txt
  llvm/lib/WindowsManifest/CMakeLists.txt
  llvm/lib/XRay/CMakeLists.txt
  llvm/tools/llvm-shlib/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70179.229086.patch
Type: text/x-patch
Size: 54948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191113/be6f0006/attachment-0001.bin>


More information about the llvm-commits mailing list