Add a Briggs and Torczon sparse set implementation.
[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   set_target_properties(${test_name}Tests PROPERTIES FOLDER "Tests")
16 endfunction()
17
18 add_custom_target(UnitTests)
19 set_target_properties(UnitTests PROPERTIES FOLDER "Tests")
20
21 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
22 add_definitions(-DGTEST_HAS_RTTI=0)
23 if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
24   llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
25 elseif( MSVC )
26   llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")
27 endif()
28
29 if (NOT LLVM_ENABLE_THREADS)
30   add_definitions(-DGTEST_HAS_PTHREAD=0)
31 endif()
32
33 if(SUPPORTS_NO_VARIADIC_MACROS_FLAG)
34   add_definitions("-Wno-variadic-macros")
35 endif()
36
37 set(LLVM_LINK_COMPONENTS
38   jit
39   interpreter
40   nativecodegen
41   BitWriter
42   BitReader
43   AsmParser
44   Core
45   Support
46   )
47
48 set(LLVM_USED_LIBS
49   gtest
50   gtest_main
51   LLVMSupport # gtest needs it for raw_ostream.
52   )
53
54 add_llvm_unittest(ADT
55   ADT/APFloatTest.cpp
56   ADT/APIntTest.cpp
57   ADT/BitVectorTest.cpp
58   ADT/DAGDeltaAlgorithmTest.cpp
59   ADT/DeltaAlgorithmTest.cpp
60   ADT/DenseMapTest.cpp
61   ADT/DenseSetTest.cpp
62   ADT/FoldingSet.cpp
63   ADT/HashingTest.cpp
64   ADT/ilistTest.cpp
65   ADT/ImmutableSetTest.cpp
66   ADT/IntEqClassesTest.cpp
67   ADT/IntervalMapTest.cpp
68   ADT/IntrusiveRefCntPtrTest.cpp
69   ADT/PackedVectorTest.cpp
70   ADT/SmallBitVectorTest.cpp
71   ADT/SmallStringTest.cpp
72   ADT/SmallVectorTest.cpp
73   ADT/SparseBitVectorTest.cpp
74   ADT/SparseSetTest.cpp
75   ADT/StringMapTest.cpp
76   ADT/StringRefTest.cpp
77   ADT/TripleTest.cpp
78   ADT/TwineTest.cpp
79   ADT/VariadicFunctionTest.cpp
80  )
81
82 add_llvm_unittest(Analysis
83   Analysis/ScalarEvolutionTest.cpp
84   )
85
86 add_llvm_unittest(ExecutionEngine
87   ExecutionEngine/ExecutionEngineTest.cpp
88   )
89
90 set(JITTestsSources
91   ExecutionEngine/JIT/JITEventListenerTest.cpp
92   ExecutionEngine/JIT/JITMemoryManagerTest.cpp
93   ExecutionEngine/JIT/JITTest.cpp
94   ExecutionEngine/JIT/MultiJITTest.cpp
95   )
96
97 if(MSVC)
98   list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def)
99 endif()
100
101 add_llvm_unittest(ExecutionEngine/JIT ${JITTestsSources})
102
103 if(MINGW OR CYGWIN)
104   set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols)
105 endif()
106
107 add_llvm_unittest(Transforms/Utils
108   Transforms/Utils/Cloning.cpp
109   )
110
111 set(VMCoreSources
112   VMCore/ConstantsTest.cpp
113   VMCore/InstructionsTest.cpp
114   VMCore/MetadataTest.cpp
115   VMCore/PassManagerTest.cpp
116   VMCore/ValueMapTest.cpp
117   VMCore/VerifierTest.cpp
118   )
119
120 # MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug.
121 # See issue#331418 in Visual Studio.
122 if(MSVC AND MSVC_VERSION LESS 1600)
123   list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp)
124 endif()
125
126 add_llvm_unittest(VMCore ${VMCoreSources})
127
128 add_llvm_unittest(Bitcode
129   Bitcode/BitReaderTest.cpp
130   )
131
132 set(LLVM_LINK_COMPONENTS
133   Support
134   Core
135   )
136
137 add_llvm_unittest(Support
138   Support/AllocatorTest.cpp
139   Support/Casting.cpp
140   Support/CommandLineTest.cpp
141   Support/ConstantRangeTest.cpp
142   Support/EndianTest.cpp
143   Support/JSONParserTest.cpp
144   Support/LeakDetectorTest.cpp
145   Support/MathExtrasTest.cpp
146   Support/Path.cpp
147   Support/raw_ostream_test.cpp
148   Support/RegexTest.cpp
149   Support/SwapByteOrderTest.cpp
150   Support/TimeValue.cpp
151   Support/TypeBuilderTest.cpp
152   Support/ValueHandleTest.cpp
153   )