1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00
llvm-mirror/unittests/tools/llvm-exegesis/CMakeLists.txt
Tom Stellard ffb4271d86 Merge all the llvm-exegesis unit tests into a single binary
These tests access private symbols in the backends, so they cannot link
against libLLVM.so and must be statically linked.  Linking these tests
can be slow and with debug builds the resulting binaries use a lot of
disk space.

By merging them into a single test binary means we now only need to
statically link 1 test instead of 6, which helps reduce the build
times and saves disk space.

Reviewed By: courbet

Differential Revision: https://reviews.llvm.org/D106464
2021-07-26 22:07:07 -07:00

66 lines
1.6 KiB
CMake

set(exegesis_includes
${LLVM_MAIN_SRC_DIR}/tools/llvm-exegesis/lib
)
set(LLVM_LINK_COMPONENTS
MC
MCParser
Object
Support
Symbolize
)
set(exegesis_sources
BenchmarkRunnerTest.cpp
ClusteringTest.cpp
PerfHelperTest.cpp
RegisterValueTest.cpp
SnippetGeneratorTest.cpp
)
set(exegesis_link_libraries LLVMExegesis)
function(add_llvm_exegesis_unittest_includes)
set(exegesis_includes ${exegesis_includes} ${ARGV} PARENT_SCOPE)
endfunction()
function(add_llvm_exegesis_unittest_sources)
set(sources ${ARGV})
list(TRANSFORM sources PREPEND "${CMAKE_CURRENT_LIST_DIR}/")
set(exegesis_sources ${exegesis_sources} ${sources} PARENT_SCOPE)
endfunction()
function(add_llvm_exegesis_unittest_link_components comps)
set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} ${ARGV} PARENT_SCOPE)
endfunction()
function(add_llvm_exegesis_unittest_link_libraries libs)
set(exegesis_link_libraries ${exegesis_link_libraries} ${ARGV} PARENT_SCOPE)
endfunction()
if(LLVM_TARGETS_TO_BUILD MATCHES "X86")
include(X86/CMakeLists.txt)
endif()
if(LLVM_TARGETS_TO_BUILD MATCHES "ARM")
include(ARM/CMakeLists.txt)
endif()
if(LLVM_TARGETS_TO_BUILD MATCHES "AArch64")
include(AArch64/CMakeLists.txt)
endif()
if(LLVM_TARGETS_TO_BUILD MATCHES "PowerPC")
include(PowerPC/CMakeLists.txt)
endif()
if(LLVM_TARGETS_TO_BUILD MATCHES "Mips")
include(Mips/CMakeLists.txt)
endif()
include_directories(${exegesis_includes})
list(REMOVE_DUPLICATES LLVM_LINK_COMPONENTS)
add_llvm_target_unittest(LLVMExegesisTests
${exegesis_sources}
)
target_link_libraries(LLVMExegesisTests PRIVATE ${exegesis_link_libraries})