From e933e7203c357169a89e3f7102d8680ee47fbf4c Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 26 Apr 2023 10:42:41 -0700 Subject: [PATCH] Add missing files Resolves: rhbz#2178800 --- 0001-llvm-Add-install-targets-for-gtest.patch | 32 +++++++++++++ ...-party-Add-install-targets-for-gtest.patch | 47 +++++++++++++++++++ D145763.diff | 21 +++++++++ 3 files changed, 100 insertions(+) create mode 100644 0001-llvm-Add-install-targets-for-gtest.patch create mode 100644 0201-third-party-Add-install-targets-for-gtest.patch create mode 100644 D145763.diff diff --git a/0001-llvm-Add-install-targets-for-gtest.patch b/0001-llvm-Add-install-targets-for-gtest.patch new file mode 100644 index 0000000..e84c444 --- /dev/null +++ b/0001-llvm-Add-install-targets-for-gtest.patch @@ -0,0 +1,32 @@ +From 8cc3870f09d728d9017c72eba9520117a4283fee Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 17 Nov 2022 09:01:10 +0000 +Subject: Add install targets for gtest + +Stand-alone builds need an installed version of gtest in order to run +the unittests. + +Differential Revision: https://reviews.llvm.org/D137890 +--- + llvm/CMakeLists.txt | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt +index 60e1f29620af..d91338532815 100644 +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt +@@ -693,6 +693,11 @@ option(LLVM_BUILD_TESTS + "Build LLVM unit tests. If OFF, just generate build targets." OFF) + option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) + ++option(LLVM_INSTALL_GTEST ++ "Install the llvm gtest library. This should be on if you want to do ++ stand-alone builds of the other projects and run their unit tests." OFF) ++ ++ + option(LLVM_BUILD_BENCHMARKS "Add LLVM benchmark targets to the list of default + targets. If OFF, benchmarks still could be built using Benchmarks target." OFF) + option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." ON) +-- +2.34.3 + diff --git a/0201-third-party-Add-install-targets-for-gtest.patch b/0201-third-party-Add-install-targets-for-gtest.patch new file mode 100644 index 0000000..5c86130 --- /dev/null +++ b/0201-third-party-Add-install-targets-for-gtest.patch @@ -0,0 +1,47 @@ +From 8cc3870f09d728d9017c72eba9520117a4283fee Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 17 Nov 2022 09:01:10 +0000 +Subject: Add install targets for gtest + +Stand-alone builds need an installed version of gtest in order to run +the unittests. + +Differential Revision: https://reviews.llvm.org/D137890 +--- + third-party/unittest/CMakeLists.txt | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/third-party/unittest/CMakeLists.txt b/third-party/unittest/CMakeLists.txt +index 0e54e0e57c35..1d2a52730d7d 100644 +--- a/third-party/unittest/CMakeLists.txt ++++ b/third-party/unittest/CMakeLists.txt +@@ -65,12 +65,25 @@ if (NOT LLVM_ENABLE_THREADS) + endif () + + target_include_directories(llvm_gtest +- PUBLIC googletest/include googlemock/include ++ PUBLIC $ ++ $ ++ $ ++ $ + PRIVATE googletest googlemock + ) + + add_subdirectory(UnitTestMain) + ++if (LLVM_INSTALL_GTEST) ++export(TARGETS llvm_gtest llvm_gtest_main LLVMTestingSupport FILE LLVMGTestConfig.cmake) ++install(TARGETS llvm_gtest llvm_gtest_main LLVMTestingSupport EXPORT LLVMGTestConfig ++ ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT llvm_gtest) ++ install(EXPORT LLVMGTestConfig DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} COMPONENT llvm_gtest) ++ add_llvm_install_targets(install-llvm_gtest COMPONENT llvm_gtest DEPENDS llvm_gtest LLVMGTestConfig.cmake) ++ install(DIRECTORY googletest/include/gtest/ DESTINATION include/llvm-gtest/gtest/ COMPONENT llvm_gtest) ++ install(DIRECTORY googlemock/include/gmock/ DESTINATION include/llvm-gmock/gmock/ COMPONENT llvm_gtest) ++endif() ++ + # When LLVM_LINK_LLVM_DYLIB is enabled, libLLVM.so is added to the interface + # link libraries for gtest and gtest_main. This means that any target, like + # unittests for example, that links against gtest will be forced to link +-- +2.34.3 + diff --git a/D145763.diff b/D145763.diff new file mode 100644 index 0000000..79de2d7 --- /dev/null +++ b/D145763.diff @@ -0,0 +1,21 @@ +diff --git a/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg b/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg +--- a/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg ++++ b/llvm/test/tools/llvm-exegesis/PowerPC/lit.local.cfg +@@ -1,3 +1,6 @@ + if not ('PowerPC' in config.root.targets): + # We need support for PowerPC. + config.unsupported = True ++elif not ('powerpc' in config.root.host_triple): ++ # We need to be running on an PPC host. ++ config.unsupported = True +diff --git a/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg b/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg +--- a/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg ++++ b/llvm/test/tools/llvm-exegesis/X86/lit.local.cfg +@@ -1,3 +1,6 @@ + if not ('X86' in config.root.targets): + # We need support for X86. + config.unsupported = True ++elif not ('x86_64' in config.root.host_triple): ++ # We need to be running on an X86 host. ++ config.unsupported = True +