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