Move the verbose asm output up a bit so it can be used in the special cases
[oota-llvm.git] / test / CMakeLists.txt
1 foreach(c ${LLVM_TARGETS_TO_BUILD})
2   set(TARGETS_BUILT "${TARGETS_BUILT} ${c}")
3 endforeach(c)
4 set(TARGETS_TO_BUILD ${TARGETS_BUILT})
5
6 # FIXME: This won't work for project files, we need to use a --param.
7 set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}")
8 set(SHLIBEXT "${LTDL_SHLIB_EXT}")
9
10 if(BUILD_SHARED_LIBS)
11   set(LLVM_SHARED_LIBS_ENABLED "1")
12 else()
13   set(LLVM_SHARED_LIBS_ENABLED "0")
14 endif(BUILD_SHARED_LIBS)
15
16 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
17   set(SHLIBPATH_VAR "DYLD_LIBRARY_PATH")
18 else() # Default for all other unix like systems.
19   # CMake hardcodes the library locaction using rpath.
20   # Therefore LD_LIBRARY_PATH is not required to run binaries in the
21   # build dir. We pass it anyways. 
22   set(SHLIBPATH_VAR "LD_LIBRARY_PATH")
23 endif()
24
25 include(FindPythonInterp)
26 if(PYTHONINTERP_FOUND)
27   configure_file(
28     ${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in
29     ${CMAKE_CURRENT_BINARY_DIR}/site.exp)
30
31   MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/Unit)
32
33   add_custom_target(check
34     COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
35                 -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
36                 -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}#"
37                 -e "s#\@LLVMGCCDIR\@##"
38                 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
39                 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
40     COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
41                 -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
42                 -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}#"
43                 -e "s#\@LLVMGCCDIR\@##"
44                 -e "s#\@LLVM_BUILD_MODE\@#${CMAKE_CFG_INTDIR}#"
45                 -e "s#\@ENABLE_SHARED\@#${LLVM_SHARED_LIBS_ENABLED}#"
46                 -e "s#\@SHLIBPATH_VAR\@#${SHLIBPATH_VAR}#"
47                 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in >
48                 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
49     COMMAND ${PYTHON_EXECUTABLE}
50                 ${LLVM_SOURCE_DIR}/utils/lit/lit.py
51                 --param llvm_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
52                 --param llvm_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
53                 -sv
54                 ${CMAKE_CURRENT_BINARY_DIR}
55                 DEPENDS
56                 COMMENT "Running LLVM regression tests")
57
58 endif()