llvm: introduce [build/link]_llvm_dylib (#27450)

Apart from building a single dylib for LLVM, users should also be able
to link tools against it.
This commit is contained in:
Harmen Stoppels 2021-11-18 04:10:59 +01:00 committed by GitHub
parent d24d13559b
commit 40a6ac62d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View file

@ -119,7 +119,7 @@ spack:
- libnrm
- libquo
- libunwind
- llvm +all_targets +clang +compiler-rt +libcxx +lld +lldb +llvm_dylib +flang ~cuda
- llvm +all_targets +clang +compiler-rt +libcxx +lld +lldb +build_llvm_dylib +flang ~cuda
- loki
- mercury
- metall

View file

@ -130,7 +130,7 @@ spack:
- libnrm
- libquo
- libunwind
- llvm +all_targets +clang +compiler-rt +libcxx +lld +lldb +llvm_dylib +flang ~cuda
- llvm +all_targets +clang +compiler-rt +libcxx +lld +lldb +build_llvm_dylib +flang ~cuda
- loki
- mercury
- metall

View file

@ -123,11 +123,16 @@ class Llvm(CMakePackage, CudaPackage):
"less memory to build, less stable",
)
variant(
"llvm_dylib",
"build_llvm_dylib",
default=False,
description="Build LLVM shared library, containing all "
"components in a single shared library",
)
variant(
"link_llvm_dylib",
default=False,
description="Link LLVM tools against the LLVM shared library",
)
variant(
"all_targets",
default=False,
@ -190,7 +195,8 @@ class Llvm(CMakePackage, CudaPackage):
depends_on("gmp", when="@:3.6 +polly")
depends_on("isl", when="@:3.6 +polly")
conflicts("+llvm_dylib", when="+shared_libs")
conflicts("+build_llvm_dylib", when="+shared_libs")
conflicts("+link_llvm_dylib", when="~build_llvm_dylib")
conflicts("+lldb", when="~clang")
conflicts("+libcxx", when="~clang")
conflicts("+internal_unwind", when="~clang")
@ -552,9 +558,12 @@ def cmake_args(self):
projects.append("polly")
cmake_args.append(define("LINK_POLLY_INTO_TOOLS", True))
cmake_args.append(from_variant("BUILD_SHARED_LIBS", "shared_libs"))
cmake_args.append(from_variant("LLVM_BUILD_LLVM_DYLIB", "llvm_dylib"))
cmake_args.append(from_variant("LLVM_USE_SPLIT_DWARF", "split_dwarf"))
cmake_args.extend([
from_variant("BUILD_SHARED_LIBS", "shared_libs"),
from_variant("LLVM_BUILD_LLVM_DYLIB", "build_llvm_dylib"),
from_variant("LLVM_LINK_LLVM_DYLIB", "link_llvm_dylib"),
from_variant("LLVM_USE_SPLIT_DWARF", "split_dwarf")
])
# By default on Linux, libc++.so is a linker script, and CMake tries to add the
# CMAKE_INSTALL_RPATH to it, which fails, causing installation to fail. The