[llvm-commits] [llvm] r120212 - in /llvm/trunk: CMakeLists.txt test/CMakeLists.txt test/Unit/lit.site.cfg.in test/lit.site.cfg.in

NAKAMURA Takumi geek4civic at gmail.com
Sat Nov 27 05:10:11 PST 2010


Author: chapuni
Date: Sat Nov 27 07:10:11 2010
New Revision: 120212

URL: http://llvm.org/viewvc/llvm-project?rev=120212&view=rev
Log:
CMake: lit(check.vcproj) can run with multiple configurations on Visual Studio.

Unittests need LLVM_BUILD_MODE to pick up each test.

Confirmed on CentOS5, Mingw, MSYS, and with possible configurations on VS8 and VS10.

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/test/CMakeLists.txt
    llvm/trunk/test/Unit/lit.site.cfg.in
    llvm/trunk/test/lit.site.cfg.in

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=120212&r1=120211&r2=120212&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Sat Nov 27 07:10:11 2010
@@ -27,6 +27,20 @@
 Please delete them.")
 endif()
 
+# Run-time build mode; It is used for unittests.
+if(MSVC_IDE)
+  # Expect "$(Configuration)", "$(OutDir)", etc.
+  # It is expanded by msbuild or similar.
+  set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}")
+elseif(NOT CMAKE_BUILD_TYPE STREQUAL "")
+  # Expect "Release" "Debug", etc.
+  # Or unittests could not run.
+  set(RUNTIME_BUILD_MODE ${CMAKE_BUILD_TYPE})
+else()
+  # It might be "."
+  set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}")
+endif()
+
 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
 
 set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})

Modified: llvm/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CMakeLists.txt?rev=120212&r1=120211&r2=120212&view=diff
==============================================================================
--- llvm/trunk/test/CMakeLists.txt (original)
+++ llvm/trunk/test/CMakeLists.txt Sat Nov 27 07:10:11 2010
@@ -50,20 +50,14 @@
 
   MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/Unit)
 
+  # Configuration-time: See Unit/lit.site.cfg.in
+  set(LLVM_BUILD_MODE "%(build_mode)s")
+
   set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
   set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
-  set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
+  set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
   set(LLVMGCCDIR "")
   set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
-  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})
 
@@ -81,6 +75,8 @@
                 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
                 --param llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
                 --param llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
+                --param build_config=${CMAKE_CFG_INTDIR}
+                --param build_mode=${RUNTIME_BUILD_MODE}
                 ${LIT_ARGS}
                 ${CMAKE_CURRENT_BINARY_DIR}
                 DEPENDS

Modified: llvm/trunk/test/Unit/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Unit/lit.site.cfg.in?rev=120212&r1=120211&r2=120212&view=diff
==============================================================================
--- llvm/trunk/test/Unit/lit.site.cfg.in (original)
+++ llvm/trunk/test/Unit/lit.site.cfg.in Sat Nov 27 07:10:11 2010
@@ -8,5 +8,14 @@
 config.enable_shared = @ENABLE_SHARED@
 config.shlibpath_var = "@SHLIBPATH_VAR@"
 
+# Support substitution of the tools_dir and build_mode with user parameters.
+# This is used when we can't determine the tool dir at configuration time.
+try:
+    config.llvm_tools_dir = config.llvm_tools_dir % lit.params
+    config.llvm_build_mode = config.llvm_build_mode % lit.params
+except KeyError,e:
+    key, = e.args
+    lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
 # Let the main config do the real work.
 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")

Modified: llvm/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.site.cfg.in?rev=120212&r1=120211&r2=120212&view=diff
==============================================================================
--- llvm/trunk/test/lit.site.cfg.in (original)
+++ llvm/trunk/test/lit.site.cfg.in Sat Nov 27 07:10:11 2010
@@ -6,5 +6,13 @@
 config.llvmgcc_dir = "@LLVMGCCDIR@"
 config.python_executable = "@PYTHON_EXECUTABLE@"
 
+# Support substitution of the tools_dir with user parameters. This is
+# used when we can't determine the tool dir at configuration time.
+try:
+    config.llvm_tools_dir = config.llvm_tools_dir % lit.params
+except KeyError,e:
+    key, = e.args
+    lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
+
 # Let the main config do the real work.
 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/lit.cfg")





More information about the llvm-commits mailing list