Skip to content

[llvm] update a few llvm unit tests to link statically #145448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions llvm/lib/Testing/Support/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion llvm/unittests/CodeGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 3 additions & 1 deletion llvm/unittests/DebugInfo/DWARF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 3 additions & 1 deletion llvm/unittests/DebugInfo/LogicalView/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 3 additions & 1 deletion llvm/unittests/FileCheck/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions llvm/unittests/TableGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 2 additions & 0 deletions llvm/unittests/Transforms/Vectorize/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ add_llvm_unittest(VectorizeTests
VPlanPatternMatchTest.cpp
VPlanSlpTest.cpp
VPlanVerifierTest.cpp

DISABLE_LLVM_LINK_LLVM_DYLIB
)