[llvm-commits] [llvm] r114725 - in /llvm/trunk: CMakeLists.txt test/CMakeLists.txt unittests/CMakeLists.txt utils/unittest/CMakeLists.txt utils/unittest/googletest/include/gtest/internal/gtest-port.h

Michael J. Spencer bigcheesegs at gmail.com
Fri Sep 24 02:01:13 PDT 2010


Author: mspencer
Date: Fri Sep 24 04:01:13 2010
New Revision: 114725

URL: http://llvm.org/viewvc/llvm-project?rev=114725&view=rev
Log:
CMake: Build unittests.

Added:
    llvm/trunk/unittests/CMakeLists.txt
    llvm/trunk/utils/unittest/CMakeLists.txt
Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/test/CMakeLists.txt
    llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-port.h

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=114725&r1=114724&r2=114725&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Fri Sep 24 04:01:13 2010
@@ -305,7 +305,6 @@
 add_subdirectory(lib/MC)
 add_subdirectory(lib/MC/MCParser)
 add_subdirectory(lib/MC/MCDisassembler)
-add_subdirectory(test)
 
 add_subdirectory(utils/FileCheck)
 add_subdirectory(utils/count)
@@ -370,6 +369,12 @@
 option(LLVM_BUILD_EXAMPLES "Build LLVM example programs." OFF)
 add_subdirectory(examples)
 
+option(LLVM_BUILD_TESTS "Build LLVM unit tests." OFF)
+add_subdirectory(test)
+add_subdirectory(utils/unittest)
+add_subdirectory(unittests)
+
+
 add_subdirectory(cmake/modules)
 
 install(DIRECTORY include/

Modified: llvm/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CMakeLists.txt?rev=114725&r1=114724&r2=114725&view=diff
==============================================================================
--- llvm/trunk/test/CMakeLists.txt (original)
+++ llvm/trunk/test/CMakeLists.txt Fri Sep 24 04:01:13 2010
@@ -52,7 +52,15 @@
   set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
   set(LLVMGCCDIR "")
   set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
-  set(LLVM_BUILD_MODE ${CMAKE_CFG_INTDIR})
+  if (CMAKE_CONFIGURATION_TYPES)
+    # FIXME: We have no idea. It could be any of them... So just output all of
+    # them.
+    set(LLVM_BUILD_MODE "${CMAKE_CONFIGURATION_TYPES}")
+  elseif (CMAKE_BUILD_TYPE)
+    set(LLVM_BUILD_MODE "${CMAKE_BUILD_TYPE}")
+  else()
+    set(LLVM_BUILD_MODE "None")
+  endif()
   set(ENABLE_SHARED ${LLVM_SHARED_LIBS_ENABLED})
   set(SHLIBPATH_VAR ${SHLIBPATH_VAR})
 

Added: llvm/trunk/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CMakeLists.txt?rev=114725&view=auto
==============================================================================
--- llvm/trunk/unittests/CMakeLists.txt (added)
+++ llvm/trunk/unittests/CMakeLists.txt Fri Sep 24 04:01:13 2010
@@ -0,0 +1,95 @@
+function(add_llvm_unittest test_name)
+  if (CMAKE_BUILD_TYPE)
+    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
+      ${LLVM_BINARY_DIR}/unittests/${test_name}/${CMAKE_BUILD_TYPE})
+  else()
+    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
+      ${LLVM_BINARY_DIR}/unittests/${test_name})
+  endif()
+  if( NOT LLVM_BUILD_TESTS )
+    set(EXCLUDE_FROM_ALL ON)
+  endif()
+  add_llvm_executable(${test_name}Tests ${ARGN})
+endfunction()
+
+include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
+
+set(LLVM_LINK_COMPONENTS
+  jit
+  interpreter
+  nativecodegen
+  BitWriter
+  BitReader
+  AsmParser
+  Core
+  System
+  Support
+  )
+
+set(LLVM_USED_LIBS
+  gtest
+  gtest_main
+  )
+
+add_llvm_unittest(ADT
+  ADT/APFloatTest.cpp
+  ADT/APIntTest.cpp
+  ADT/BitVectorTest.cpp
+  ADT/DAGDeltaAlgorithmTest.cpp
+  ADT/DeltaAlgorithmTest.cpp
+  ADT/DenseMapTest.cpp
+  ADT/DenseSetTest.cpp
+  ADT/ilistTest.cpp
+  ADT/ImmutableSetTest.cpp
+  ADT/SmallBitVectorTest.cpp
+  ADT/SmallStringTest.cpp
+  ADT/SmallVectorTest.cpp
+  ADT/SparseBitVectorTest.cpp
+  ADT/StringMapTest.cpp
+  ADT/StringRefTest.cpp
+  ADT/TripleTest.cpp
+  ADT/TwineTest.cpp
+  ADT/ValueMapTest.cpp
+  )
+
+add_llvm_unittest(Analysis
+  Analysis/ScalarEvolutionTest.cpp
+  )
+
+add_llvm_unittest(ExecutionEngine
+  ExecutionEngine/ExecutionEngineTest.cpp
+  )
+
+add_llvm_unittest(JIT
+  ExecutionEngine/JIT/JITEventListenerTest.cpp
+  ExecutionEngine/JIT/JITMemoryManagerTest.cpp
+  ExecutionEngine/JIT/JITTest.cpp
+  ExecutionEngine/JIT/MultiJITTest.cpp
+  )
+
+add_llvm_unittest(Support
+  Support/AllocatorTest.cpp
+  Support/Casting.cpp
+  Support/CommandLineTest.cpp
+  Support/ConstantRangeTest.cpp
+  Support/LeakDetectorTest.cpp
+  Support/MathExtrasTest.cpp
+  Support/raw_ostream_test.cpp
+  Support/RegexTest.cpp
+  Support/System.cpp
+  Support/TypeBuilderTest.cpp
+  Support/ValueHandleTest.cpp
+  )
+
+add_llvm_unittest(Transforms
+  Transforms/Utils/Cloning.cpp
+  )
+
+add_llvm_unittest(VMCore
+  VMCore/ConstantsTest.cpp
+  VMCore/DerivedTypesTest.cpp
+  VMCore/InstructionsTest.cpp
+  VMCore/MetadataTest.cpp
+  VMCore/PassManagerTest.cpp
+  VMCore/VerifierTest.cpp
+  )

Added: llvm/trunk/utils/unittest/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/CMakeLists.txt?rev=114725&view=auto
==============================================================================
--- llvm/trunk/utils/unittest/CMakeLists.txt (added)
+++ llvm/trunk/utils/unittest/CMakeLists.txt Fri Sep 24 04:01:13 2010
@@ -0,0 +1,34 @@
+########################################################################
+# Experimental CMake build script for Google Test.
+#
+# Consider this a prototype.  It will change drastically.  For now,
+# this is only for people on the cutting edge.
+#
+# To run the tests for Google Test itself on Linux, use 'make test' or
+# ctest.  You can select which tests to run using 'ctest -R regex'.
+# For more options, run 'ctest --help'.
+########################################################################
+#
+# Project-wide settings
+
+# Where gtest's .h files can be found.
+include_directories(
+  googletest/include
+  )
+
+if(WIN32)
+  add_definitions(-DGTEST_OS_WINDOWS=1)
+endif()
+
+add_llvm_library(gtest
+  googletest/gtest.cc
+  googletest/gtest-death-test.cc
+  googletest/gtest-filepath.cc
+  googletest/gtest-port.cc
+  googletest/gtest-test-part.cc
+  googletest/gtest-typed-test.cc
+  )
+
+add_llvm_library(gtest_main
+  UnitTestMain/TestMain.cpp
+  )

Modified: llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-port.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-port.h?rev=114725&r1=114724&r2=114725&view=diff
==============================================================================
--- llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-port.h (original)
+++ llvm/trunk/utils/unittest/googletest/include/gtest/internal/gtest-port.h Fri Sep 24 04:01:13 2010
@@ -403,7 +403,8 @@
 // defining __GNUC__ and friends, but cannot compile GCC's tuple
 // implementation.  MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
 // Feature Pack download, which we cannot assume the user has.
-#if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
+#if (defined(__GNUC__) && !(defined(__CUDACC__) || defined(__clang__)) \
+                       && (GTEST_GCC_VER_ >= 40000)) \
     || _MSC_VER >= 1600
 #define GTEST_USE_OWN_TR1_TUPLE 0
 #else





More information about the llvm-commits mailing list