[llvm] Llvm static unittest (PR #145448)
Andrew Rogers via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 23 22:52:25 PDT 2025
https://github.com/andrurogerz updated https://github.com/llvm/llvm-project/pull/145448
>From 07feb8c0b6176614befc3f7356b54d41ac32aecb Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 17:43:33 -0700
Subject: [PATCH 1/7] [llvm] add a version of LLVMTestingSupport which links
against static libs
---
llvm/lib/Testing/Support/CMakeLists.txt | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/llvm/lib/Testing/Support/CMakeLists.txt b/llvm/lib/Testing/Support/CMakeLists.txt
index 6955271239ca6..425427b433f14 100644
--- a/llvm/lib/Testing/Support/CMakeLists.txt
+++ b/llvm/lib/Testing/Support/CMakeLists.txt
@@ -20,6 +20,23 @@ add_llvm_library(LLVMTestingSupport
target_link_libraries(LLVMTestingSupport PRIVATE llvm_gtest)
+add_llvm_library(LLVMTestingSupportStatic
+ Error.cpp
+ SupportHelpers.cpp
+
+ ${BUILDTREE_ONLY}
+
+ ADDITIONAL_HEADER_DIRS
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/Testing/Support
+
+ LINK_COMPONENTS
+ Support
+
+ DISABLE_LLVM_LINK_LLVM_DYLIB
+ )
+
+target_link_libraries(LLVMTestingSupportStatic PRIVATE llvm_gtest)
+
# This is to avoid the error in gtest-death-test-internal.h
# (150,16): error: 'Create' overrides a member function but
# is not marked 'override' [-Werror,-Wsuggest-override]
>From d1c1161bb44083dc5f43139fa699a39770cd9c59 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 17:45:01 -0700
Subject: [PATCH 2/7] [llvm] make CodeGentests link against static libs
---
llvm/unittests/CodeGen/CMakeLists.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/unittests/CodeGen/CMakeLists.txt b/llvm/unittests/CodeGen/CMakeLists.txt
index 8b025219c46cf..9d3b8fc837a61 100644
--- a/llvm/unittests/CodeGen/CMakeLists.txt
+++ b/llvm/unittests/CodeGen/CMakeLists.txt
@@ -48,8 +48,10 @@ add_llvm_unittest(CodeGenTests
TestAsmPrinter.cpp
MLRegAllocDevelopmentFeatures.cpp
X86MCInstLowerTest.cpp
+
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
add_subdirectory(GlobalISel)
-target_link_libraries(CodeGenTests PRIVATE LLVMTestingSupport)
+target_link_libraries(CodeGenTests PRIVATE LLVMTestingSupportStatic)
>From d2393402c436c335915a8e17881075e802c87a5f Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 17:45:52 -0700
Subject: [PATCH 3/7] [llvm] make DebugInfoLogicalViewTests and
DebugInfoDWARFTests link against static libs
---
llvm/unittests/DebugInfo/DWARF/CMakeLists.txt | 4 +++-
llvm/unittests/DebugInfo/LogicalView/CMakeLists.txt | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/llvm/unittests/DebugInfo/DWARF/CMakeLists.txt b/llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
index 0c5b3f28ca3d5..a8b3c7cf6a012 100644
--- a/llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
+++ b/llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
@@ -28,6 +28,8 @@ add_llvm_unittest(DebugInfoDWARFTests
DWARFFormValueTest.cpp
DWARFListTableTest.cpp
DWARFLocationExpressionTest.cpp
+
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
-target_link_libraries(DebugInfoDWARFTests PRIVATE LLVMTestingSupport)
+target_link_libraries(DebugInfoDWARFTests PRIVATE LLVMTestingSupportStatic)
diff --git a/llvm/unittests/DebugInfo/LogicalView/CMakeLists.txt b/llvm/unittests/DebugInfo/LogicalView/CMakeLists.txt
index 42a4b72229483..0d7d8c1d52254 100644
--- a/llvm/unittests/DebugInfo/LogicalView/CMakeLists.txt
+++ b/llvm/unittests/DebugInfo/LogicalView/CMakeLists.txt
@@ -22,6 +22,8 @@ add_llvm_unittest_with_input_files(DebugInfoLogicalViewTests
LogicalElementsTest.cpp
StringPoolTest.cpp
WarningInternalTest.cpp
+
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
-target_link_libraries(DebugInfoLogicalViewTests PRIVATE LLVMTestingSupport)
+target_link_libraries(DebugInfoLogicalViewTests PRIVATE LLVMTestingSupportStatic)
>From 02468e1e67c287b6a41f509b18241748ecdc73b5 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 17:46:32 -0700
Subject: [PATCH 4/7] [llvm] make FileCheckTests link against static libs
---
llvm/unittests/FileCheck/CMakeLists.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/unittests/FileCheck/CMakeLists.txt b/llvm/unittests/FileCheck/CMakeLists.txt
index 7fe4f0c009d02..10de51cbe1d43 100644
--- a/llvm/unittests/FileCheck/CMakeLists.txt
+++ b/llvm/unittests/FileCheck/CMakeLists.txt
@@ -5,6 +5,8 @@ set(LLVM_LINK_COMPONENTS
add_llvm_unittest(FileCheckTests
FileCheckTest.cpp
+
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
-target_link_libraries(FileCheckTests PRIVATE LLVMTestingSupport)
+target_link_libraries(FileCheckTests PRIVATE LLVMTestingSupportStatic)
>From 7c5d27ff205064ffb8fa4ad2a26abf744f0d698f Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 18:32:26 -0700
Subject: [PATCH 5/7] [llvm] make TableGenTests link against static libs
---
llvm/unittests/TableGen/CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/unittests/TableGen/CMakeLists.txt b/llvm/unittests/TableGen/CMakeLists.txt
index 57b237306b19c..854f6c0f9b162 100644
--- a/llvm/unittests/TableGen/CMakeLists.txt
+++ b/llvm/unittests/TableGen/CMakeLists.txt
@@ -13,6 +13,8 @@ add_llvm_unittest(TableGenTests
AutomataTest.cpp
CodeExpanderTest.cpp
ParserEntryPointTest.cpp
+
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
target_link_libraries(TableGenTests PRIVATE LLVMTableGenCommon LLVMTableGen)
>From a1eecbadb12b6225ed292d2efd96f05e139b2e84 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 18:33:01 -0700
Subject: [PATCH 6/7] [llvm] make VectorizeTests link against static libs
---
llvm/unittests/Transforms/Vectorize/CMakeLists.txt | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/unittests/Transforms/Vectorize/CMakeLists.txt b/llvm/unittests/Transforms/Vectorize/CMakeLists.txt
index 53eeff28c185f..4bed42e46cc2d 100644
--- a/llvm/unittests/Transforms/Vectorize/CMakeLists.txt
+++ b/llvm/unittests/Transforms/Vectorize/CMakeLists.txt
@@ -15,4 +15,6 @@ add_llvm_unittest(VectorizeTests
VPlanPatternMatchTest.cpp
VPlanSlpTest.cpp
VPlanVerifierTest.cpp
+
+ DISABLE_LLVM_LINK_LLVM_DYLIB
)
>From 797761398cf427fa988a6e4e09ee04d0ad03b90f Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 23 Jun 2025 18:34:51 -0700
Subject: [PATCH 7/7] [llvm] make llvm-mca link against Passes lib
---
llvm/unittests/tools/llvm-mca/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/llvm/unittests/tools/llvm-mca/CMakeLists.txt b/llvm/unittests/tools/llvm-mca/CMakeLists.txt
index 9c69509b4b54d..26b00f8f1fd73 100644
--- a/llvm/unittests/tools/llvm-mca/CMakeLists.txt
+++ b/llvm/unittests/tools/llvm-mca/CMakeLists.txt
@@ -1,6 +1,7 @@
set(LLVM_LINK_COMPONENTS
MC
MCA
+ Passes
Support
TargetParser
)
More information about the llvm-commits
mailing list