Michael J. Spencer | ee6944f | 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 | 066de85 | 2010-09-25 20:25:25 +0000 | [diff] [blame] | 12 | add_llvm_executable(${test_name}Tests ${ARGN}) |
Oscar Fuentes | da97563 | 2010-10-28 14:38:35 +0000 | [diff] [blame] | 13 | add_dependencies(UnitTests ${test_name}Tests) |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 14 | endfunction() |
| 15 | |
Oscar Fuentes | da97563 | 2010-10-28 14:38:35 +0000 | [diff] [blame] | 16 | add_custom_target(UnitTests) |
| 17 | |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 18 | include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include) |
Michael J. Spencer | 8a806ae | 2010-10-19 18:04:19 +0000 | [diff] [blame] | 19 | add_definitions(-DGTEST_HAS_RTTI=0) |
Michael J. Spencer | ee6944f | 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 |
Dale Johannesen | a197cba | 2010-11-19 23:23:22 +0000 | [diff] [blame] | 46 | ADT/FoldingSet.cpp |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 47 | ADT/ilistTest.cpp |
| 48 | ADT/ImmutableSetTest.cpp |
Jakob Stoklund Olesen | 8dc9267 | 2010-11-19 04:47:19 +0000 | [diff] [blame] | 49 | ADT/IntervalMapTest.cpp |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 50 | ADT/SmallBitVectorTest.cpp |
| 51 | ADT/SmallStringTest.cpp |
| 52 | ADT/SmallVectorTest.cpp |
| 53 | ADT/SparseBitVectorTest.cpp |
| 54 | ADT/StringMapTest.cpp |
| 55 | ADT/StringRefTest.cpp |
| 56 | ADT/TripleTest.cpp |
| 57 | ADT/TwineTest.cpp |
Douglas Gregor | c576d3d | 2010-09-27 16:40:43 +0000 | [diff] [blame] | 58 | ) |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 59 | |
| 60 | add_llvm_unittest(Analysis |
| 61 | Analysis/ScalarEvolutionTest.cpp |
| 62 | ) |
| 63 | |
| 64 | add_llvm_unittest(ExecutionEngine |
| 65 | ExecutionEngine/ExecutionEngineTest.cpp |
| 66 | ) |
| 67 | |
NAKAMURA Takumi | 0f60ddc | 2010-11-19 03:19:42 +0000 | [diff] [blame] | 68 | set(JITTestsSources |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 69 | ExecutionEngine/JIT/JITEventListenerTest.cpp |
| 70 | ExecutionEngine/JIT/JITMemoryManagerTest.cpp |
| 71 | ExecutionEngine/JIT/JITTest.cpp |
| 72 | ExecutionEngine/JIT/MultiJITTest.cpp |
| 73 | ) |
| 74 | |
NAKAMURA Takumi | 0f60ddc | 2010-11-19 03:19:42 +0000 | [diff] [blame] | 75 | if(MSVC) |
| 76 | list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def) |
| 77 | endif() |
| 78 | |
| 79 | add_llvm_unittest(JIT ${JITTestsSources}) |
| 80 | |
Michael J. Spencer | 12647eb | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 81 | add_llvm_unittest(Transforms |
| 82 | Transforms/Utils/Cloning.cpp |
| 83 | ) |
| 84 | |
NAKAMURA Takumi | 130a2dd | 2010-11-19 03:19:32 +0000 | [diff] [blame] | 85 | set(VMCoreSources |
Michael J. Spencer | 12647eb | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 86 | VMCore/ConstantsTest.cpp |
| 87 | VMCore/DerivedTypesTest.cpp |
| 88 | VMCore/InstructionsTest.cpp |
| 89 | VMCore/MetadataTest.cpp |
| 90 | VMCore/PassManagerTest.cpp |
NAKAMURA Takumi | b08ca27 | 2010-11-14 12:37:51 +0000 | [diff] [blame] | 91 | VMCore/ValueMapTest.cpp |
Michael J. Spencer | 12647eb | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 92 | VMCore/VerifierTest.cpp |
| 93 | ) |
| 94 | |
NAKAMURA Takumi | 130a2dd | 2010-11-19 03:19:32 +0000 | [diff] [blame] | 95 | # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug. |
| 96 | # See issue#331418 in Visual Studio. |
| 97 | if(MSVC AND MSVC_VERSION LESS 1600) |
| 98 | list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp) |
| 99 | endif() |
| 100 | |
| 101 | add_llvm_unittest(VMCore ${VMCoreSources}) |
| 102 | |
Michael J. Spencer | 12647eb | 2010-10-11 21:22:34 +0000 | [diff] [blame] | 103 | set(LLVM_LINK_COMPONENTS |
| 104 | System |
| 105 | Support |
| 106 | Core |
| 107 | ) |
| 108 | |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 109 | add_llvm_unittest(Support |
| 110 | Support/AllocatorTest.cpp |
| 111 | Support/Casting.cpp |
| 112 | Support/CommandLineTest.cpp |
| 113 | Support/ConstantRangeTest.cpp |
Michael J. Spencer | 5e0b2bf | 2010-10-21 20:28:21 +0000 | [diff] [blame] | 114 | Support/EndianTest.cpp |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 115 | Support/LeakDetectorTest.cpp |
| 116 | Support/MathExtrasTest.cpp |
| 117 | Support/raw_ostream_test.cpp |
| 118 | Support/RegexTest.cpp |
Michael J. Spencer | 4c099b8 | 2010-10-11 21:56:16 +0000 | [diff] [blame] | 119 | Support/SwapByteOrderTest.cpp |
Michael J. Spencer | 5e0b2bf | 2010-10-21 20:28:21 +0000 | [diff] [blame] | 120 | Support/System.cpp |
Michael J. Spencer | ee6944f | 2010-09-24 09:01:13 +0000 | [diff] [blame] | 121 | Support/TypeBuilderTest.cpp |
| 122 | Support/ValueHandleTest.cpp |
| 123 | ) |