diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2019-04-02 10:14:26 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2019-04-03 10:49:26 +0300 |
commit | 31e20e78b6a3f94db08cc1f1b0115ef80eccaa08 (patch) | |
tree | ab4df5b2b4c4f0b4df4b249ec8a4d3f32754f9d8 /cmake | |
parent | 5e66564c00bbdf8acc67b63c4271d3d0b778ff0d (diff) |
Use GitLab CI
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/CuraTests.cmake | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/cmake/CuraTests.cmake b/cmake/CuraTests.cmake index b6d04de036..1a1a1c9f29 100644 --- a/cmake/CuraTests.cmake +++ b/cmake/CuraTests.cmake @@ -1,10 +1,22 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -enable_testing() +include(CTest) include(CMakeParseArguments) -find_package(PythonInterp 3.5.0 REQUIRED) +# FIXME: Remove the code for CMake <3.12 once we have switched over completely. +# FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs. The FindPython3 +# module is copied from the CMake repository here so in CMake <3.12 we can still use it. +if(${CMAKE_VERSION} VERSION_LESS 3.12) + # Use FindPythonInterp and FindPythonLibs for CMake <3.12 + find_package(PythonInterp 3 REQUIRED) + find_package(PythonLibs 3 REQUIRED) + + set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) +else() + # Use FindPython3 for CMake >=3.12 + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +endif() add_custom_target(test-verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose) @@ -36,7 +48,7 @@ function(cura_add_test) if (NOT ${test_exists}) add_test( NAME ${_NAME} - COMMAND ${PYTHON_EXECUTABLE} -m pytest --verbose --full-trace --capture=no --no-print-log --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY} + COMMAND ${Python3_EXECUTABLE} -m pytest --verbose --full-trace --capture=no --no-print-log --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY} ) set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT LANG=C) set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT "PYTHONPATH=${_PYTHONPATH}") @@ -59,13 +71,13 @@ endforeach() #Add code style test. add_test( NAME "code-style" - COMMAND ${PYTHON_EXECUTABLE} run_mypy.py + COMMAND ${Python3_EXECUTABLE} run_mypy.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) #Add test for whether the shortcut alt-keys are unique in every translation. add_test( NAME "shortcut-keys" - COMMAND ${PYTHON_EXECUTABLE} scripts/check_shortcut_keys.py + COMMAND ${Python3_EXECUTABLE} scripts/check_shortcut_keys.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -)
\ No newline at end of file +) |