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