Add ADT/IntEqClasses.h as a light-weight implementation of EquivalenceClasses.h.
[oota-llvm.git] / unittests / CMakeLists.txt
1 function(add_llvm_unittest test_dirname)
2   string(REGEX MATCH "([^/]+)$" test_name ${test_dirname})
3   if (CMAKE_BUILD_TYPE)
4     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
5       ${LLVM_BINARY_DIR}/unittests/${test_dirname}/${CMAKE_BUILD_TYPE})
6   else()
7     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
8       ${LLVM_BINARY_DIR}/unittests/${test_dirname})
9   endif()
10   if( NOT LLVM_BUILD_TESTS )
11     set(EXCLUDE_FROM_ALL ON)
12   endif()
13   add_llvm_executable(${test_name}Tests ${ARGN})
14   add_dependencies(UnitTests ${test_name}Tests)
15 endfunction()
16
17 add_custom_target(UnitTests)
18
19 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
20 add_definitions(-DGTEST_HAS_RTTI=0)
21 if (NOT LLVM_ENABLE_THREADS)
22   add_definitions(-DGTEST_HAS_PTHREAD=0)
23 endif()
24
25 if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
26   add_definitions("-Wno-variadic-macros")
27 endif()
28
29 set(LLVM_LINK_COMPONENTS
30   jit
31   interpreter
32   nativecodegen
33   BitWriter
34   BitReader
35   AsmParser
36   Core
37   Support
38   )
39
40 set(LLVM_USED_LIBS
41   gtest
42   gtest_main
43   LLVMSupport # gtest needs it for raw_ostream.
44   )
45
46 add_llvm_unittest(ADT
47   ADT/APFloatTest.cpp
48   ADT/APIntTest.cpp
49   ADT/BitVectorTest.cpp
50   ADT/DAGDeltaAlgorithmTest.cpp
51   ADT/DeltaAlgorithmTest.cpp
52   ADT/DenseMapTest.cpp
53   ADT/DenseSetTest.cpp
54   ADT/FoldingSet.cpp
55   ADT/ilistTest.cpp
56   ADT/ImmutableSetTest.cpp
57   ADT/IntEqClassesTest.cpp
58   ADT/IntervalMapTest.cpp
59   ADT/SmallBitVectorTest.cpp
60   ADT/SmallStringTest.cpp
61   ADT/SmallVectorTest.cpp
62   ADT/SparseBitVectorTest.cpp
63   ADT/StringMapTest.cpp
64   ADT/StringRefTest.cpp
65   ADT/TripleTest.cpp
66   ADT/TwineTest.cpp
67  )
68
69 add_llvm_unittest(Analysis
70   Analysis/ScalarEvolutionTest.cpp
71   )
72
73 add_llvm_unittest(ExecutionEngine
74   ExecutionEngine/ExecutionEngineTest.cpp
75   )
76
77 set(JITTestsSources
78   ExecutionEngine/JIT/JITEventListenerTest.cpp
79   ExecutionEngine/JIT/JITMemoryManagerTest.cpp
80   ExecutionEngine/JIT/JITTest.cpp
81   ExecutionEngine/JIT/MultiJITTest.cpp
82   )
83
84 if(MSVC)
85   list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
86 endif()
87
88 add_llvm_unittest(ExecutionEngine/JIT ${JITTestsSources})
89
90 if(MINGW)
91   set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
92 endif()
93
94 add_llvm_unittest(Transforms/Utils
95   Transforms/Utils/Cloning.cpp
96   )
97
98 set(VMCoreSources
99   VMCore/ConstantsTest.cpp
100   VMCore/DerivedTypesTest.cpp
101   VMCore/InstructionsTest.cpp
102   VMCore/MetadataTest.cpp
103   VMCore/PassManagerTest.cpp
104   VMCore/ValueMapTest.cpp
105   VMCore/VerifierTest.cpp
106   )
107
108 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
109 # See issue#331418 in Visual Studio.
110 if(MSVC AND MSVC_VERSION LESS 1600)
111   list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
112 endif()
113
114 add_llvm_unittest(VMCore ${VMCoreSources})
115
116 set(LLVM_LINK_COMPONENTS
117   Support
118   Core
119   )
120
121 add_llvm_unittest(Support
122   Support/AllocatorTest.cpp
123   Support/Casting.cpp
124   Support/CommandLineTest.cpp
125   Support/ConstantRangeTest.cpp
126   Support/EndianTest.cpp
127   Support/LeakDetectorTest.cpp
128   Support/MathExtrasTest.cpp
129   Support/Path.cpp
130   Support/raw_ostream_test.cpp
131   Support/RegexTest.cpp
132   Support/SwapByteOrderTest.cpp
133   Support/TimeValue.cpp
134   Support/TypeBuilderTest.cpp
135   Support/ValueHandleTest.cpp
136   )