Make cmake files no longer depend on static libs (rhbz 1388200)
This commit is contained in:
parent
4d11f51b66
commit
4b6a509a38
@ -0,0 +1,86 @@
|
||||
From a5f39924a3466eb12d764993aaa8c1c308f92925 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Stellard <tstellar@redhat.com>
|
||||
Date: Sat, 29 Apr 2017 02:03:23 +0000
|
||||
Subject: [PATCH] CMake: Split static library exports into their own export
|
||||
file
|
||||
|
||||
Summary:
|
||||
This is to better support distros which split the static libraries into
|
||||
their own package.
|
||||
|
||||
The current problem is that any project the includes LLVMConfig.cmake
|
||||
will fail to configure unless the static libraries are installed. This
|
||||
is because LLVMConfig.cmake includes LLVMExports.cmake, which throws an
|
||||
error if it can't find files linked to one of the exported targets.
|
||||
|
||||
This patch resolves the problem by putting the static library targets
|
||||
into their own export file, LLVMStaticExports.cmake. This file
|
||||
is optionally included by LLVMConfig.cmake, so distros can put this
|
||||
new file in their static library package to make LLVMConfig.cmake
|
||||
no longer depend on these libraries when they are not installed.
|
||||
|
||||
Reviewers: beanz, mgorny, chapuni
|
||||
|
||||
Subscribers: llvm-commits
|
||||
|
||||
Differential Revision: https://reviews.llvm.org/D32668
|
||||
---
|
||||
cmake/modules/AddLLVM.cmake | 6 +++++-
|
||||
cmake/modules/CMakeLists.txt | 3 +++
|
||||
cmake/modules/LLVMConfig.cmake.in | 2 ++
|
||||
3 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
|
||||
index b3c7746..7d9d253 100644
|
||||
--- a/cmake/modules/AddLLVM.cmake
|
||||
+++ b/cmake/modules/AddLLVM.cmake
|
||||
@@ -587,7 +587,11 @@ macro(add_llvm_library name)
|
||||
|
||||
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
|
||||
NOT LLVM_DISTRIBUTION_COMPONENTS)
|
||||
- set(export_to_llvmexports EXPORT LLVMExports)
|
||||
+ if (ARG_SHARED)
|
||||
+ set(export_to_llvmexports EXPORT LLVMExports)
|
||||
+ else()
|
||||
+ set(export_to_llvmexports EXPORT LLVMStaticExports)
|
||||
+ endif()
|
||||
set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
|
||||
endif()
|
||||
|
||||
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
|
||||
index ac4b0b7..f77c905 100644
|
||||
--- a/cmake/modules/CMakeLists.txt
|
||||
+++ b/cmake/modules/CMakeLists.txt
|
||||
@@ -91,6 +91,7 @@ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
|
||||
set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
|
||||
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
|
||||
set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
|
||||
+set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake")
|
||||
configure_file(
|
||||
LLVMConfig.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
||||
@@ -107,6 +108,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
if(llvm_has_exports)
|
||||
install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
||||
COMPONENT cmake-exports)
|
||||
+ install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
||||
+ COMPONENT cmake-exports)
|
||||
endif()
|
||||
|
||||
install(FILES
|
||||
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
|
||||
index c30c92b..f0f17b2 100644
|
||||
--- a/cmake/modules/LLVMConfig.cmake.in
|
||||
+++ b/cmake/modules/LLVMConfig.cmake.in
|
||||
@@ -73,6 +73,8 @@ if(NOT TARGET LLVMSupport)
|
||||
set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
|
||||
include("@LLVM_CONFIG_EXPORTS_FILE@")
|
||||
@llvm_config_include_buildtree_only_exports@
|
||||
+
|
||||
+ include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL)
|
||||
endif()
|
||||
|
||||
include(${LLVM_CMAKE_DIR}/LLVM-Config.cmake)
|
||||
--
|
||||
2.9.3
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
Name: llvm
|
||||
Version: 4.0.0
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: The Low Level Virtual Machine
|
||||
|
||||
License: NCSA
|
||||
@ -18,6 +18,7 @@ Source0: http://llvm.org/releases/%{version}/%{name}-%{version}.src.tar.xz
|
||||
Patch0: llvm-3.7.1-cmake-s390.patch
|
||||
Patch1: 0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
|
||||
Patch2: rust-lang-llvm-pr67.patch
|
||||
Patch3: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch
|
||||
|
||||
BuildRequires: cmake
|
||||
BuildRequires: zlib-devel
|
||||
@ -187,14 +188,19 @@ fi
|
||||
%{_includedir}/llvm-c
|
||||
%{_libdir}/libLLVM.so
|
||||
%{_libdir}/cmake/llvm
|
||||
%exclude %{_libdir}/cmake/llvm/LLVMStaticExports.cmake
|
||||
|
||||
%files doc
|
||||
%doc %{_pkgdocdir}/html
|
||||
|
||||
%files static
|
||||
%{_libdir}/*.a
|
||||
%{_libdir}/cmake/llvm/LLVMStaticExports.cmake
|
||||
|
||||
%changelog
|
||||
* Mon May 01 2017 Tom Stellard <tstellar@redhat.com> - 4.0.0-4
|
||||
- Make cmake files no longer depend on static libs (rhbz 1388200)
|
||||
|
||||
* Tue Apr 18 2017 Josh Stone <jistone@redhat.com> - 4.0.0-3
|
||||
- Fix computeKnownBits for ARMISD::CMOV (rust-lang/llvm#67)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user