diff options
-rwxr-xr-x | cmake/modules/AddLLVM.cmake | 8 | ||||
-rw-r--r-- | cmake/modules/LLVMProcessSources.cmake | 7 | ||||
-rw-r--r-- | unittests/ADT/CMakeLists.txt | 32 | ||||
-rw-r--r-- | unittests/Analysis/CMakeLists.txt | 7 | ||||
-rw-r--r-- | unittests/Bitcode/CMakeLists.txt | 8 | ||||
-rw-r--r-- | unittests/CMakeLists.txt | 155 | ||||
-rw-r--r-- | unittests/ExecutionEngine/CMakeLists.txt | 11 | ||||
-rw-r--r-- | unittests/ExecutionEngine/JIT/CMakeLists.txt | 55 | ||||
-rw-r--r-- | unittests/Support/CMakeLists.txt | 29 | ||||
-rw-r--r-- | unittests/Transforms/CMakeLists.txt | 1 | ||||
-rw-r--r-- | unittests/Transforms/Utils/CMakeLists.txt | 8 | ||||
-rw-r--r-- | unittests/VMCore/CMakeLists.txt | 27 |
12 files changed, 193 insertions, 155 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index f32a6d3c87..96246fafe4 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -149,14 +149,12 @@ macro(add_llvm_external_project name) endmacro(add_llvm_external_project) # Generic support for adding a unittest. -function(add_unittest test_suite test_dirname) - string(REGEX MATCH "([^/]+)$" test_name ${test_dirname}) +function(add_unittest test_suite test_name) if (CMAKE_BUILD_TYPE) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}/${test_dirname}/${CMAKE_BUILD_TYPE}) + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}) else() - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}/${test_dirname}) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) endif() if( NOT LLVM_BUILD_TESTS ) set(EXCLUDE_FROM_ALL ON) diff --git a/cmake/modules/LLVMProcessSources.cmake b/cmake/modules/LLVMProcessSources.cmake index 641f1b33e1..bb11e9cad6 100644 --- a/cmake/modules/LLVMProcessSources.cmake +++ b/cmake/modules/LLVMProcessSources.cmake @@ -81,10 +81,13 @@ function(llvm_check_source_file_list) file(GLOB globbed *.cpp) foreach(g ${globbed}) get_filename_component(fn ${g} NAME) - list(FIND listed ${fn} idx) + list(FIND LLVM_OPTIONAL_SOURCES ${fn} idx) if( idx LESS 0 ) - message(SEND_ERROR "Found unknown source file ${g} + list(FIND listed ${fn} idx) + if( idx LESS 0 ) + message(SEND_ERROR "Found unknown source file ${g} Please update ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt\n") + endif() endif() endforeach() endfunction(llvm_check_source_file_list) diff --git a/unittests/ADT/CMakeLists.txt b/unittests/ADT/CMakeLists.txt new file mode 100644 index 0000000000..690ff78414 --- /dev/null +++ b/unittests/ADT/CMakeLists.txt @@ -0,0 +1,32 @@ +set(LLVM_LINK_COMPONENTS + Support + ) + +add_llvm_unittest(ADTTests + APFloatTest.cpp + APIntTest.cpp + BitVectorTest.cpp + DAGDeltaAlgorithmTest.cpp + DeltaAlgorithmTest.cpp + DenseMapTest.cpp + DenseSetTest.cpp + FoldingSet.cpp + HashingTest.cpp + ilistTest.cpp + ImmutableSetTest.cpp + IntEqClassesTest.cpp + IntervalMapTest.cpp + IntrusiveRefCntPtrTest.cpp + PackedVectorTest.cpp + SCCIteratorTest.cpp + SmallPtrSetTest.cpp + SmallStringTest.cpp + SmallVectorTest.cpp + SparseBitVectorTest.cpp + SparseSetTest.cpp + StringMapTest.cpp + StringRefTest.cpp + TripleTest.cpp + TwineTest.cpp + VariadicFunctionTest.cpp + ) diff --git a/unittests/Analysis/CMakeLists.txt b/unittests/Analysis/CMakeLists.txt new file mode 100644 index 0000000000..7991a4101c --- /dev/null +++ b/unittests/Analysis/CMakeLists.txt @@ -0,0 +1,7 @@ +set(LLVM_LINK_COMPONENTS + Analysis + ) + +add_llvm_unittest(AnalysisTests + ScalarEvolutionTest.cpp + ) diff --git a/unittests/Bitcode/CMakeLists.txt b/unittests/Bitcode/CMakeLists.txt new file mode 100644 index 0000000000..d8f5fe1f19 --- /dev/null +++ b/unittests/Bitcode/CMakeLists.txt @@ -0,0 +1,8 @@ +set(LLVM_LINK_COMPONENTS + BitReader + BitWriter + ) + +add_llvm_unittest(BitcodeTests + BitReaderTest.cpp + ) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 00fd79687c..84bd44439e 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -5,151 +5,10 @@ function(add_llvm_unittest test_dirname) add_unittest(UnitTests ${test_dirname} ${ARGN}) endfunction() -set(LLVM_LINK_COMPONENTS - jit - interpreter - nativecodegen - BitWriter - BitReader - AsmParser - Core - Support - ) - -add_llvm_unittest(ADTTests - ADT/APFloatTest.cpp - ADT/APIntTest.cpp - ADT/BitVectorTest.cpp - ADT/DAGDeltaAlgorithmTest.cpp - ADT/DeltaAlgorithmTest.cpp - ADT/DenseMapTest.cpp - ADT/DenseSetTest.cpp - ADT/FoldingSet.cpp - ADT/HashingTest.cpp - ADT/ilistTest.cpp - ADT/ImmutableSetTest.cpp - ADT/IntEqClassesTest.cpp - ADT/IntervalMapTest.cpp - ADT/IntrusiveRefCntPtrTest.cpp - ADT/PackedVectorTest.cpp - ADT/SCCIteratorTest.cpp - ADT/SmallPtrSetTest.cpp - ADT/SmallStringTest.cpp - ADT/SmallVectorTest.cpp - ADT/SparseBitVectorTest.cpp - ADT/SparseSetTest.cpp - ADT/StringMapTest.cpp - ADT/StringRefTest.cpp - ADT/TripleTest.cpp - ADT/TwineTest.cpp - ADT/VariadicFunctionTest.cpp - ) - -add_llvm_unittest(AnalysisTests - Analysis/ScalarEvolutionTest.cpp - ) - -add_llvm_unittest(ExecutionEngineTests - ExecutionEngine/ExecutionEngineTest.cpp - ) - -if( LLVM_USE_INTEL_JITEVENTS ) - include_directories( ${LLVM_INTEL_JITEVENTS_INCDIR} ) - link_directories( ${LLVM_INTEL_JITEVENTS_LIBDIR} ) - set(ProfileTestSources - ExecutionEngine/JIT/IntelJITEventListenerTest.cpp - ) - set(LLVM_LINK_COMPONENTS - ${LLVM_LINK_COMPONENTS} - IntelJITEvents - ) -endif( LLVM_USE_INTEL_JITEVENTS ) - -if( LLVM_USE_OPROFILE ) - set(ProfileTestSources - ${ProfileTestSources} - ExecutionEngine/JIT/OProfileJITEventListenerTest.cpp - ) - set(LLVM_LINK_COMPONENTS - ${LLVM_LINK_COMPONENTS} - OProfileJIT - ) -endif( LLVM_USE_OPROFILE ) - -set(JITTestsSources - ExecutionEngine/JIT/JITEventListenerTest.cpp - ExecutionEngine/JIT/JITMemoryManagerTest.cpp - ExecutionEngine/JIT/JITTest.cpp - ExecutionEngine/JIT/MultiJITTest.cpp - ${ProfileTestSources} - ) - -if(MSVC) - list(APPEND JITTestsSources ExecutionEngine/JIT/JITTests.def) -endif() - -add_llvm_unittest(ExecutionEngine/JITTests - ${JITTestsSources} - ) - -if(MINGW OR CYGWIN) - set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols) -endif() - -add_llvm_unittest(Transforms/UtilsTests - Transforms/Utils/Cloning.cpp - ) - -set(VMCoreSources - VMCore/ConstantsTest.cpp - VMCore/DominatorTreeTest.cpp - VMCore/InstructionsTest.cpp - VMCore/MetadataTest.cpp - VMCore/PassManagerTest.cpp - VMCore/ValueMapTest.cpp - VMCore/VerifierTest.cpp - ) - -# MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug. -# See issue#331418 in Visual Studio. -if(MSVC AND MSVC_VERSION LESS 1600) - list(REMOVE_ITEM VMCoreSources VMCore/ValueMapTest.cpp) -endif() - -add_llvm_unittest(VMCoreTests - ${VMCoreSources} - ) - -add_llvm_unittest(BitcodeTests - Bitcode/BitReaderTest.cpp - ) - -set(LLVM_LINK_COMPONENTS - Support - Core - ) - -add_llvm_unittest(SupportTests - Support/AlignOfTest.cpp - Support/AllocatorTest.cpp - Support/BlockFrequencyTest.cpp - Support/Casting.cpp - Support/CommandLineTest.cpp - Support/ConstantRangeTest.cpp - Support/DataExtractorTest.cpp - Support/EndianTest.cpp - Support/IntegersSubsetTest.cpp - Support/IRBuilderTest.cpp - Support/LeakDetectorTest.cpp - Support/ManagedStatic.cpp - Support/MathExtrasTest.cpp - Support/MDBuilderTest.cpp - Support/Path.cpp - Support/raw_ostream_test.cpp - Support/RegexTest.cpp - Support/SwapByteOrderTest.cpp - Support/TimeValue.cpp - Support/TypeBuilderTest.cpp - Support/ValueHandleTest.cpp - Support/YAMLParserTest.cpp - ) +add_subdirectory(ADT) +add_subdirectory(Analysis) +add_subdirectory(ExecutionEngine) +add_subdirectory(Bitcode) +add_subdirectory(Support) +add_subdirectory(Transforms) +add_subdirectory(VMCore) diff --git a/unittests/ExecutionEngine/CMakeLists.txt b/unittests/ExecutionEngine/CMakeLists.txt new file mode 100644 index 0000000000..5ca99046be --- /dev/null +++ b/unittests/ExecutionEngine/CMakeLists.txt @@ -0,0 +1,11 @@ +set(LLVM_LINK_COMPONENTS + jit + interpreter + nativecodegen + ) + +add_llvm_unittest(ExecutionEngineTests + ExecutionEngineTest.cpp + ) + +add_subdirectory(JIT) diff --git a/unittests/ExecutionEngine/JIT/CMakeLists.txt b/unittests/ExecutionEngine/JIT/CMakeLists.txt new file mode 100644 index 0000000000..a9821a12fc --- /dev/null +++ b/unittests/ExecutionEngine/JIT/CMakeLists.txt @@ -0,0 +1,55 @@ +set(LLVM_LINK_COMPONENTS + jit + interpreter + nativecodegen + ) + +# HACK: Declare a couple of source files as optionally compiled to satisfy the +# missing-file-checker in LLVM's weird CMake build. +set(LLVM_OPTIONAL_SOURCES + IntelJITEventListenerTest.cpp + OProfileJITEventListenerTest.cpp + ) + +if( LLVM_USE_INTEL_JITEVENTS ) + include_directories( ${LLVM_INTEL_JITEVENTS_INCDIR} ) + link_directories( ${LLVM_INTEL_JITEVENTS_LIBDIR} ) + set(ProfileTestSources + IntelJITEventListenerTest.cpp + ) + set(LLVM_LINK_COMPONENTS + ${LLVM_LINK_COMPONENTS} + IntelJITEvents + ) +endif( LLVM_USE_INTEL_JITEVENTS ) + +if( LLVM_USE_OPROFILE ) + set(ProfileTestSources + ${ProfileTestSources} + OProfileJITEventListenerTest.cpp + ) + set(LLVM_LINK_COMPONENTS + ${LLVM_LINK_COMPONENTS} + OProfileJIT + ) +endif( LLVM_USE_OPROFILE ) + +set(JITTestsSources + JITEventListenerTest.cpp + JITMemoryManagerTest.cpp + JITTest.cpp + MultiJITTest.cpp + ${ProfileTestSources} + ) + +if(MSVC) + list(APPEND JITTestsSources JITTests.def) +endif() + +add_llvm_unittest(ExecutionEngine/JITTests + ${JITTestsSources} + ) + +if(MINGW OR CYGWIN) + set_property(TARGET JITTests PROPERTY LINK_FLAGS -Wl,--export-all-symbols) +endif() diff --git a/unittests/Support/CMakeLists.txt b/unittests/Support/CMakeLists.txt new file mode 100644 index 0000000000..6053994d0c --- /dev/null +++ b/unittests/Support/CMakeLists.txt @@ -0,0 +1,29 @@ +set(LLVM_LINK_COMPONENTS + Support + Core + ) + +add_llvm_unittest(SupportTests + AlignOfTest.cpp + AllocatorTest.cpp + BlockFrequencyTest.cpp + Casting.cpp + CommandLineTest.cpp + ConstantRangeTest.cpp + DataExtractorTest.cpp + EndianTest.cpp + IntegersSubsetTest.cpp + IRBuilderTest.cpp + LeakDetectorTest.cpp + ManagedStatic.cpp + MathExtrasTest.cpp + MDBuilderTest.cpp + Path.cpp + raw_ostream_test.cpp + RegexTest.cpp + SwapByteOrderTest.cpp + TimeValue.cpp + TypeBuilderTest.cpp + ValueHandleTest.cpp + YAMLParserTest.cpp + ) diff --git a/unittests/Transforms/CMakeLists.txt b/unittests/Transforms/CMakeLists.txt new file mode 100644 index 0000000000..e3ce185e0d --- /dev/null +++ b/unittests/Transforms/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(Utils) diff --git a/unittests/Transforms/Utils/CMakeLists.txt b/unittests/Transforms/Utils/CMakeLists.txt new file mode 100644 index 0000000000..365bfbb0bf --- /dev/null +++ b/unittests/Transforms/Utils/CMakeLists.txt @@ -0,0 +1,8 @@ +set(LLVM_LINK_COMPONENTS + TransformUtils + ) + +add_llvm_unittest(UtilsTests + Cloning.cpp + Local.cpp + ) diff --git a/unittests/VMCore/CMakeLists.txt b/unittests/VMCore/CMakeLists.txt new file mode 100644 index 0000000000..04eabf0b9e --- /dev/null +++ b/unittests/VMCore/CMakeLists.txt @@ -0,0 +1,27 @@ +set(LLVM_LINK_COMPONENTS + asmparser + analysis + core + ipa + target + ) + +set(VMCoreSources + ConstantsTest.cpp + DominatorTreeTest.cpp + InstructionsTest.cpp + MetadataTest.cpp + PassManagerTest.cpp + ValueMapTest.cpp + VerifierTest.cpp + ) + +# MSVC9 and 8 cannot compile ValueMapTest.cpp due to their bug. +# See issue#331418 in Visual Studio. +if(MSVC AND MSVC_VERSION LESS 1600) + list(REMOVE_ITEM VMCoreSources ValueMapTest.cpp) +endif() + +add_llvm_unittest(VMCoreTests + ${VMCoreSources} + ) |