Home | History | Annotate | Download | only in test
      1 macro(pythonize_bool var)
      2   if (${var})
      3     set(${var} True)
      4   else()
      5     set(${var} False)
      6   endif()
      7 endmacro()
      8 
      9 include(FindPythonInterp)
     10 if(PYTHONINTERP_FOUND)
     11   if(LIBCXX_BUILT_STANDALONE)
     12     set(LIT_EXECUTABLE "" CACHE FILEPATH "Path to LLVM's lit.py.")
     13   else()
     14     set(LIT_EXECUTABLE "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
     15   endif()
     16 
     17   set(LIT_ARGS_DEFAULT "-sv")
     18   if (MSVC OR XCODE)
     19     set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
     20   endif()
     21   set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}"
     22       CACHE STRING "Default options for lit")
     23   set(LIT_ARGS "${LLVM_LIT_ARGS}")
     24   separate_arguments(LIT_ARGS)
     25 
     26   set(LIBCXX_COMPILER ${CMAKE_CXX_COMPILER})
     27   set(LIBCXX_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
     28   set(LIBCXX_BINARY_DIR ${CMAKE_BINARY_DIR})
     29   set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
     30   pythonize_bool(LIBCXX_ENABLE_SHARED)
     31   pythonize_bool(LIBCXX_HAS_STDCXX0X_FLAG)
     32 
     33   set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
     34 
     35   configure_file(
     36     ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
     37     ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
     38     @ONLY)
     39 
     40   add_custom_target(check-libcxx
     41     COMMAND ${PYTHON_EXECUTABLE}
     42             ${LIT_EXECUTABLE}
     43             ${LIT_ARGS}
     44             ${CMAKE_CURRENT_BINARY_DIR}
     45     DEPENDS cxx
     46     COMMENT "Running libcxx tests")
     47 else()
     48   message(WARNING "Could not find Python, no check target will be available!")
     49 endif()
     50