[all-commits] [llvm/llvm-project] ab4118: [cmake] Explicitly mark libraries defined in lib/ ...

tstellar via All-commits all-commits at lists.llvm.org
Thu Nov 21 10:48:48 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ab411801b82783eb7f652701ccfce81b16cf1811
      https://github.com/llvm/llvm-project/commit/ab411801b82783eb7f652701ccfce81b16cf1811
  Author: Tom Stellard <tstellar at redhat.com>
  Date:   2019-11-21 (Thu, 21 Nov 2019)

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

  Log Message:
  -----------
  [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




More information about the All-commits mailing list