aboutsummaryrefslogtreecommitdiffstats
path: root/test/CMakeLists.txt
blob: 5ad48eff4e7dd6cf7ec2943ed85d275d9c28ce82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
foreach(c ${LLVM_TARGETS_TO_BUILD})
  set(TARGETS_BUILT "${TARGETS_BUILT} ${c}")
endforeach(c)
set(TARGETS_TO_BUILD ${TARGETS_BUILT})

# FIXME: This won't work for project files, we need to use a --param.
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/${CMAKE_CFG_INTDIR}")
set(SHLIBEXT "${LTDL_SHLIB_EXT}")

include(FindPythonInterp)
if(PYTHONINTERP_FOUND)
  configure_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/site.exp.in
    ${CMAKE_CURRENT_BINARY_DIR}/site.exp)

  MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/Unit)

  add_custom_target(check
    COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
                -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
                -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}#"
                -e "s#\@LLVMGCCDIR\@##"
                ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >
                ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
    COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"
                -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"
                -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_BINARY_DIR}/${CMAKE_CFG_INTDIR}#"
                -e "s#\@LLVMGCCDIR\@##"
                -e "s#\@LLVM_BUILD_MODE\@#${CMAKE_CFG_INTDIR}#"
                ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in >
                ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
    COMMAND ${PYTHON_EXECUTABLE}
                ${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
                -sv
                ${CMAKE_CURRENT_BINARY_DIR}
                DEPENDS
                COMMENT "Running LLVM regression tests")

endif()