Use installed llvm_gtest
This patch is required with LLVM 16.0.0-2.
This commit is contained in:
parent
e345a067bc
commit
9fda8c667b
@ -1,47 +0,0 @@
|
|||||||
From 515de0163e1e9653023418c5d5d832d45f98025b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tom Stellard <tstellar@redhat.com>
|
|
||||||
Date: Tue, 14 Feb 2023 12:10:42 -0300
|
|
||||||
Subject: [PATCH] CMake: Check for gtest headers even if lit.py is not present
|
|
||||||
|
|
||||||
This makes it possible to build the unittests even withotu a full
|
|
||||||
checkout of the llvm source tree.
|
|
||||||
---
|
|
||||||
lld/CMakeLists.txt | 15 +++++++++------
|
|
||||||
1 file changed, 9 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
|
|
||||||
index 3d6225646fe6..f86ac98957c4 100644
|
|
||||||
--- a/lld/CMakeLists.txt
|
|
||||||
+++ b/lld/CMakeLists.txt
|
|
||||||
@@ -66,6 +66,15 @@ if(LLD_BUILT_STANDALONE)
|
|
||||||
set(LLVM_UTILS_PROVIDED ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
+ # Check for gtest
|
|
||||||
+ set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/utils/unittest)
|
|
||||||
+ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
|
|
||||||
+ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
+ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
|
|
||||||
+ add_subdirectory(${UNITTEST_DIR} utils/unittest)
|
|
||||||
+ endif()
|
|
||||||
+
|
|
||||||
+ # Check for lit
|
|
||||||
if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
|
|
||||||
# Note: path not really used, except for checking if lit was found
|
|
||||||
set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
|
|
||||||
@@ -75,12 +84,6 @@ if(LLD_BUILT_STANDALONE)
|
|
||||||
set(LLVM_UTILS_PROVIDED ON)
|
|
||||||
set(LLD_TEST_DEPS FileCheck not)
|
|
||||||
endif()
|
|
||||||
- set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
|
|
||||||
- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
|
|
||||||
- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
|
|
||||||
- add_subdirectory(${UNITTEST_DIR} third-party/unittest)
|
|
||||||
- endif()
|
|
||||||
else()
|
|
||||||
# Seek installed Lit.
|
|
||||||
find_program(LLVM_LIT
|
|
||||||
--
|
|
||||||
2.39.1
|
|
||||||
|
|
37
0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch
Normal file
37
0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 56464ba865b7df5bf3edb9be7dc3b6a0fbe21e21 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
||||||
|
Date: Mon, 13 Mar 2023 18:22:31 +0100
|
||||||
|
Subject: [PATCH] [lld] Use installed llvm_gtest in standalone builds
|
||||||
|
|
||||||
|
Use the installed llvm_gtest library instead of rebuilding it locally
|
||||||
|
when standalone builds are used. This change is now required
|
||||||
|
as otherwise the build fails due to duplicate llvm_gtest target.
|
||||||
|
This is based on 82169103958583d3320b3a9a1e6542e8d32ef8da in clang.
|
||||||
|
|
||||||
|
Differential Revision: https://reviews.llvm.org/D145964
|
||||||
|
---
|
||||||
|
lld/CMakeLists.txt | 8 +++-----
|
||||||
|
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
|
||||||
|
index 3d6225646fe6..1e9e47393196 100644
|
||||||
|
--- a/lld/CMakeLists.txt
|
||||||
|
+++ b/lld/CMakeLists.txt
|
||||||
|
@@ -75,11 +75,9 @@ if(LLD_BUILT_STANDALONE)
|
||||||
|
set(LLVM_UTILS_PROVIDED ON)
|
||||||
|
set(LLD_TEST_DEPS FileCheck not)
|
||||||
|
endif()
|
||||||
|
- set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
|
||||||
|
- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
|
||||||
|
- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||||
|
- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
|
||||||
|
- add_subdirectory(${UNITTEST_DIR} third-party/unittest)
|
||||||
|
+
|
||||||
|
+ if (NOT TARGET llvm_gtest)
|
||||||
|
+ message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest or disable tests with -DLLVM_INCLUDE_TESTS=OFF")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# Seek installed Lit.
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
8
lld.spec
8
lld.spec
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
Name: %{pkg_name}
|
Name: %{pkg_name}
|
||||||
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}
|
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: The LLVM Linker
|
Summary: The LLVM Linker
|
||||||
|
|
||||||
License: Apache-2.0 WITH LLVM-exception OR NCSA
|
License: Apache-2.0 WITH LLVM-exception OR NCSA
|
||||||
@ -41,7 +41,8 @@ Source4: release-keys.asc
|
|||||||
|
|
||||||
ExcludeArch: s390x
|
ExcludeArch: s390x
|
||||||
|
|
||||||
Patch0: 0001-PATCH-lld-CMake-Check-for-gtest-headers-even-if-lit..patch
|
# Backport from LLVM 17.
|
||||||
|
Patch2: 0001-lld-Use-installed-llvm_gtest-in-standalone-builds.patch
|
||||||
|
|
||||||
# Bundle libunwind header need during build for MachO support
|
# Bundle libunwind header need during build for MachO support
|
||||||
Patch1: 0002-PATCH-lld-Import-compact_unwind_encoding.h-from-libu.patch
|
Patch1: 0002-PATCH-lld-Import-compact_unwind_encoding.h-from-libu.patch
|
||||||
@ -191,6 +192,9 @@ fi
|
|||||||
%{install_libdir}/liblld*.so.*
|
%{install_libdir}/liblld*.so.*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Mar 24 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.0-2
|
||||||
|
- Use installed llvm_gtest
|
||||||
|
|
||||||
* Tue Mar 21 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.0-1
|
* Tue Mar 21 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.0-1
|
||||||
- Update to LLVM 16.0.0
|
- Update to LLVM 16.0.0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user