diff options
author | j.spijker@ultimaker.com <jelle spijker> | 2022-03-24 16:44:07 +0300 |
---|---|---|
committer | Jelle Spijker <spijker.jelle@gmail.com> | 2022-03-24 16:44:07 +0300 |
commit | bde680f3531e909f33027feb625cd461af1fcf92 (patch) | |
tree | 31bb401e7767d269822ad024995326f033ee57a6 /cmake | |
parent | 55cb86ebbd8eab1434b97619b89d9d1565c404c9 (diff) |
Use modern >=3.12 cmake find_package Python logic
This should also install cura and UM in the site-packages in a uniform
OS agnotisc path. I also removed the renaming of cura_app.py to cura
on Linux. Because this seemed to confuse pyinstaller.
Contribute to CURA-8640
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/CuraPluginInstall.cmake | 17 | ||||
-rw-r--r-- | cmake/CuraTests.cmake | 16 |
2 files changed, 7 insertions, 26 deletions
diff --git a/cmake/CuraPluginInstall.cmake b/cmake/CuraPluginInstall.cmake index 8d9efe1f12..79b86ebdc6 100644 --- a/cmake/CuraPluginInstall.cmake +++ b/cmake/CuraPluginInstall.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Ultimaker B.V. +# Copyright (c) 2022 Ultimaker B.V. # CuraPluginInstall.cmake is released under the terms of the LGPLv3 or higher. # @@ -11,19 +11,6 @@ option(PRINT_PLUGIN_LIST "Should the list of plugins that are installed be printed?" ON) -# 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) - - set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) -else() - # Use FindPython3 for CMake >=3.12 - find_package(Python3 REQUIRED COMPONENTS Interpreter) -endif() - # Options or configuration variables set(CURA_NO_INSTALL_PLUGINS "" CACHE STRING "A list of plugins that should not be installed, separated with ';' or ','.") @@ -97,7 +84,7 @@ foreach(_plugin_json_path ${_plugin_json_list}) if(${PRINT_PLUGIN_LIST}) message(STATUS "[-] PLUGIN TO REMOVE : ${_rel_plugin_dir}") endif() - execute_process(COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mod_bundled_packages_json.py + execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mod_bundled_packages_json.py -d ${CMAKE_CURRENT_SOURCE_DIR}/resources/bundled_packages ${_plugin_dir_name} RESULT_VARIABLE _mod_json_result) diff --git a/cmake/CuraTests.cmake b/cmake/CuraTests.cmake index b8127a70ec..09e8dadbab 100644 --- a/cmake/CuraTests.cmake +++ b/cmake/CuraTests.cmake @@ -1,15 +1,9 @@ -# Copyright (c) 2018 Ultimaker B.V. +# Copyright (c) 2022 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. include(CTest) include(CMakeParseArguments) -# FIXME: The new FindPython3 finds the system's Python3.6 rather than the Python3.5 that we built for Cura's environment. -# So we're using the old method here, with FindPythonInterp for now. -find_package(PythonInterp 3 REQUIRED) - -set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) - add_custom_target(test-verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose) function(cura_add_test) @@ -40,7 +34,7 @@ function(cura_add_test) if (NOT ${test_exists}) add_test( NAME ${_NAME} - COMMAND ${Python3_EXECUTABLE} -m pytest --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY} + COMMAND ${Python_EXECUTABLE} -m pytest --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY} ) set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT LANG=C) set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT "PYTHONPATH=${_PYTHONPATH}") @@ -53,14 +47,14 @@ endfunction() #Add code style test. add_test( NAME "code-style" - COMMAND ${Python3_EXECUTABLE} run_mypy.py + COMMAND ${Python_EXECUTABLE} run_mypy.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) #Add test for import statements which are not compatible with all builds add_test( NAME "invalid-imports" - COMMAND ${Python3_EXECUTABLE} scripts/check_invalid_imports.py + COMMAND ${Python_EXECUTABLE} scripts/check_invalid_imports.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) @@ -78,6 +72,6 @@ endforeach() #Add test for whether the shortcut alt-keys are unique in every translation. add_test( NAME "shortcut-keys" - COMMAND ${Python3_EXECUTABLE} scripts/check_shortcut_keys.py + COMMAND ${Python_EXECUTABLE} scripts/check_shortcut_keys.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) |