Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 1 | function(add_llvm_unittest test_name) |
| 2 | if (CMAKE_BUILD_TYPE) |
| 3 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY |
| 4 | ${LLVM_BINARY_DIR}/unittests/${test_name}/${CMAKE_BUILD_TYPE}) |
| 5 | else() |
| 6 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY |
| 7 | ${LLVM_BINARY_DIR}/unittests/${test_name}) |
| 8 | endif() |
| 9 | if( NOT LLVM_BUILD_TESTS ) |
| 10 | set(EXCLUDE_FROM_ALL ON) |
| 11 | endif() |
Oscar Fuentes | 46d8a93 | 2010-09-25 20:25:25 +0000 | [diff] [blame] | 12 | add_llvm_executable(${test_name}Tests ${ARGN}) |
Oscar Fuentes | b1f9380 | 2010-10-28 14:38:35 +0000 | [diff] [blame] | 13 | add_dependencies(UnitTests ${test_name}Tests) |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 14 | endfunction() |
| 15 | |
Oscar Fuentes | b1f9380 | 2010-10-28 14:38:35 +0000 | [diff] [blame] | 16 | add_custom_target(UnitTests) |
| 17 | |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 18 | include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include) |
Michael J. Spencer | 58efb6d | 2010-10-19 18:04:19 +0000 | [diff] [blame] | 19 | add_definitions(-DGTEST_HAS_RTTI=0) |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 20 | |
| 21 | set(LLVM_LINK_COMPONENTS |
| 22 | jit |
| 23 | interpreter |
| 24 | nativecodegen |
| 25 | BitWriter |
| 26 | BitReader |
| 27 | AsmParser |
| 28 | Core |
| 29 | System |
| 30 | Support |
| 31 | ) |
| 32 | |
| 33 | set(LLVM_USED_LIBS |
| 34 | gtest |
| 35 | gtest_main |
| 36 | ) |
| 37 | |
| 38 | add_llvm_unittest(ADT |
| 39 | ADT/APFloatTest.cpp |
| 40 | ADT/APIntTest.cpp |
| 41 | ADT/BitVectorTest.cpp |
| 42 | ADT/DAGDeltaAlgorithmTest.cpp |
| 43 | ADT/DeltaAlgorithmTest.cpp |
| 44 | ADT/DenseMapTest.cpp |
| 45 | ADT/DenseSetTest.cpp |
| 46 | ADT/ilistTest.cpp |
| 47 | ADT/ImmutableSetTest.cpp |
| 48 | ADT/SmallBitVectorTest.cpp |
| 49 | ADT/SmallStringTest.cpp |
| 50 | ADT/SmallVectorTest.cpp |
| 51 | ADT/SparseBitVectorTest.cpp |
| 52 | ADT/StringMapTest.cpp |
| 53 | ADT/StringRefTest.cpp |
| 54 | ADT/TripleTest.cpp |
| 55 | ADT/TwineTest.cpp |
Douglas Gregor | cc27715 | 2010-09-27 16:40:43 +0000 | [diff] [blame] | 56 | ) |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 57 | |
| 58 | add_llvm_unittest(Analysis |
| 59 | Analysis/ScalarEvolutionTest.cpp |
| 60 | ) |
| 61 | |
| 62 | add_llvm_unittest(ExecutionEngine |
| 63 | ExecutionEngine/ExecutionEngineTest.cpp |
| 64 | ) |
| 65 | |
NAKAMURA Takumi | 1818edb | 2010-11-19 03:19:42 +0000 | [diff] [blame] | 66 | set(JITTestsSources |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 67 | ExecutionEngine/JIT/JITEventListenerTest.cpp |
| 68 | ExecutionEngine/JIT/JITMemoryManagerTest.cpp |
| 69 | ExecutionEngine/JIT/JITTest.cpp |
| 70 | ExecutionEngine/JIT/MultiJITTest.cpp |
| 71 | ) |
| 72 | |
NAKAMURA Takumi | 1818edb | 2010-11-19 03:19:42 +0000 | [diff] [blame] | 73 | if(MSVC) |
| 74 | list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def) |
| 75 | endif() |
| 76 | |
| 77 | add_llvm_unittest(JIT ${JITTestsSources}) |
| 78 | |
Michael J. Spencer | 8827889 | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 79 | add_llvm_unittest(Transforms |
| 80 | Transforms/Utils/Cloning.cpp |
| 81 | ) |
| 82 | |
NAKAMURA Takumi | 7a953ba | 2010-11-19 03:19:32 +0000 | [diff] [blame] | 83 | set(VMCoreSources |
Michael J. Spencer | 8827889 | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 84 | VMCore/ConstantsTest.cpp |
| 85 | VMCore/DerivedTypesTest.cpp |
| 86 | VMCore/InstructionsTest.cpp |
| 87 | VMCore/MetadataTest.cpp |
| 88 | VMCore/PassManagerTest.cpp |
NAKAMURA Takumi | dddfdc8 | 2010-11-14 12:37:51 +0000 | [diff] [blame] | 89 | VMCore/ValueMapTest.cpp |
Michael J. Spencer | 8827889 | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 90 | VMCore/VerifierTest.cpp |
| 91 | ) |
| 92 | |
NAKAMURA Takumi | 7a953ba | 2010-11-19 03:19:32 +0000 | [diff] [blame] | 93 | # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug. |
| 94 | # See issue#331418 in Visual Studio. |
| 95 | if(MSVC AND MSVC_VERSION LESS 1600) |
| 96 | list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp) |
| 97 | endif() |
| 98 | |
| 99 | add_llvm_unittest(VMCore ${VMCoreSources}) |
| 100 | |
Michael J. Spencer | 8827889 | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 101 | set(LLVM_LINK_COMPONENTS |
| 102 | System |
| 103 | Support |
| 104 | Core |
| 105 | ) |
| 106 | |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 107 | add_llvm_unittest(Support |
| 108 | Support/AllocatorTest.cpp |
| 109 | Support/Casting.cpp |
| 110 | Support/CommandLineTest.cpp |
| 111 | Support/ConstantRangeTest.cpp |
Michael J. Spencer | b550b66 | 2010-10-21 20:28:21 +0000 | [diff] [blame] | 112 | Support/EndianTest.cpp |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 113 | Support/LeakDetectorTest.cpp |
| 114 | Support/MathExtrasTest.cpp |
| 115 | Support/raw_ostream_test.cpp |
| 116 | Support/RegexTest.cpp |
Michael J. Spencer | ded95b7 | 2010-10-11 21:56:16 +0000 | [diff] [blame] | 117 | Support/SwapByteOrderTest.cpp |
Michael J. Spencer | b550b66 | 2010-10-21 20:28:21 +0000 | [diff] [blame] | 118 | Support/System.cpp |
Michael J. Spencer | 10d274d | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 119 | Support/TypeBuilderTest.cpp |
| 120 | Support/ValueHandleTest.cpp |
| 121 | ) |