llvm.org GIT mirror llvm / d420e7b
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120212 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 8 years ago
4 changed file(s) with 37 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
2424 to this source directory as the last argument.
2525 This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
2626 Please delete them.")
27 endif()
28
29 # Run-time build mode; It is used for unittests.
30 if(MSVC_IDE)
31 # Expect "$(Configuration)", "$(OutDir)", etc.
32 # It is expanded by msbuild or similar.
33 set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}")
34 elseif(NOT CMAKE_BUILD_TYPE STREQUAL "")
35 # Expect "Release" "Debug", etc.
36 # Or unittests could not run.
37 set(RUNTIME_BUILD_MODE ${CMAKE_BUILD_TYPE})
38 else()
39 # It might be "."
40 set(RUNTIME_BUILD_MODE "${CMAKE_CFG_INTDIR}")
2741 endif()
2842
2943 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
4949
5050 MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/Unit)
5151
52 # Configuration-time: See Unit/lit.site.cfg.in
53 set(LLVM_BUILD_MODE "%(build_mode)s")
54
5255 set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
5356 set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
54 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}")
57 set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
5558 set(LLVMGCCDIR "")
5659 set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
57 if (CMAKE_CONFIGURATION_TYPES)
58 # FIXME: We have no idea. It could be any of them... So just output all of
59 # them.
60 set(LLVM_BUILD_MODE "${CMAKE_CONFIGURATION_TYPES}")
61 elseif (CMAKE_BUILD_TYPE)
62 set(LLVM_BUILD_MODE "${CMAKE_BUILD_TYPE}")
63 else()
64 set(LLVM_BUILD_MODE "None")
65 endif()
6660 set(ENABLE_SHARED ${LLVM_SHARED_LIBS_ENABLED})
6761 set(SHLIBPATH_VAR ${SHLIBPATH_VAR})
6862
8074 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
8175 --param llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
8276 --param llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
77 --param build_config=${CMAKE_CFG_INTDIR}
78 --param build_mode=${RUNTIME_BUILD_MODE}
8379 ${LIT_ARGS}
8480 ${CMAKE_CURRENT_BINARY_DIR}
8581 DEPENDS
77 config.enable_shared = @ENABLE_SHARED@
88 config.shlibpath_var = "@SHLIBPATH_VAR@"
99
10 # Support substitution of the tools_dir and build_mode with user parameters.
11 # This is used when we can't determine the tool dir at configuration time.
12 try:
13 config.llvm_tools_dir = config.llvm_tools_dir % lit.params
14 config.llvm_build_mode = config.llvm_build_mode % lit.params
15 except KeyError,e:
16 key, = e.args
17 lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
18
1019 # Let the main config do the real work.
1120 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")
55 config.llvmgcc_dir = "@LLVMGCCDIR@"
66 config.python_executable = "@PYTHON_EXECUTABLE@"
77
8 # Support substitution of the tools_dir with user parameters. This is
9 # used when we can't determine the tool dir at configuration time.
10 try:
11 config.llvm_tools_dir = config.llvm_tools_dir % lit.params
12 except KeyError,e:
13 key, = e.args
14 lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
15
816 # Let the main config do the real work.
917 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/lit.cfg")