From c14c8caead6e01946660e7860a5c1d70794aa3ed Mon Sep 17 00:00:00 2001 From: Vitaly Bogdanov Date: Fri, 24 May 2024 18:17:51 +0300 Subject: [PATCH] Update minimal CMake version to 1.19 This simplifies supporting Python package build script and works for Apple Silicon. --- .github/workflows/ci-auto.yml | 2 +- .github/workflows/ci-manual.yml | 2 +- .github/workflows/common.yml | 2 +- .github/workflows/minimal.yml | 2 +- CMakeLists.txt | 2 +- README.md | 2 +- c/CMakeLists.txt | 4 ++-- python/CMakeLists.txt | 34 ++++++++------------------------- 8 files changed, 16 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci-auto.yml b/.github/workflows/ci-auto.yml index 91d28a5cd..0cbcb1b11 100644 --- a/.github/workflows/ci-auto.yml +++ b/.github/workflows/ci-auto.yml @@ -14,4 +14,4 @@ jobs: with: python-version: "3.7" os: "ubuntu-20.04" - cmake-version: "3.16.x" + cmake-version: "3.19.x" diff --git a/.github/workflows/ci-manual.yml b/.github/workflows/ci-manual.yml index a1eae926b..2a176af0f 100644 --- a/.github/workflows/ci-manual.yml +++ b/.github/workflows/ci-manual.yml @@ -21,7 +21,7 @@ on: cmake-version: description: 'JSON array of CMake versions to be checked' required: true - default: "[\"3.15.x\"]" + default: "[\"3.19.x\"]" type: string jobs: diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 111d36f07..f73a51696 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -21,7 +21,7 @@ on: type: string cmake-version: description: "CMake version to use" - default: "3.16.x" + default: "3.19.x" required: false type: string diff --git a/.github/workflows/minimal.yml b/.github/workflows/minimal.yml index 054f7a91c..ffab5fa5e 100644 --- a/.github/workflows/minimal.yml +++ b/.github/workflows/minimal.yml @@ -54,7 +54,7 @@ jobs: - name: Install CMake uses: jwlawson/actions-setup-cmake@v1.14.1 with: - cmake-version: "3.16.x" + cmake-version: "3.19.x" - name: Install Conan uses: turtlebrowser/get-conan@v1.2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 89b229101..293755023 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Minimal version supported by hyperonc -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.19) project(hyperon) diff --git a/README.md b/README.md index 3f9264291..b0eabc070 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Rust (see the Notes at the installation page). * Python3 and Python3-dev (3.7 or later) * Pip (23.1.2 or later) * GCC (7.5 or later) - * CMake (3.15 or later) + * CMake (3.19 or later) * Install cbindgen: ``` diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 0e94587c9..fda738cd5 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -1,5 +1,5 @@ # Minimal version which allows building dependencies from sources -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.19) project(hyperonc) enable_testing() @@ -9,7 +9,7 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure) execute_process( # --build is required to build dependencies from source under cibuildwheel # environment - COMMAND cmake -E env CC= CXX= conan install --build -- ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND cmake -E env CC= CXX= conan install --build -pr:b default -pr:h default -- ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index ba2003d1a..ffa6f4ae1 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,5 +1,4 @@ -# version supported by Ubuntu 18.04 -cmake_minimum_required(VERSION 3.10.2) +cmake_minimum_required(VERSION 3.19) project(hyperonpy) enable_testing() @@ -11,31 +10,14 @@ if (POLICY CMP0025) endif () set(CMAKE_CXX_STANDARD 11) -if (${CMAKE_VERSION} GREATER_EQUAL "3.12") - # The default value ("FIRST") prefers the installation with the highest - # version. "ONLY" sticks to a virtualenv even when its version is smaller - # which is usually expected by an user. - if (NOT DEFINED Python3_FIND_VIRTUALENV) - set(Python3_FIND_VIRTUALENV "ONLY") - endif() - if (${CMAKE_VERSION} GREATER_EQUAL "3.18") - # Development.Embed is not supported by cibuildwheel environment - find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development.Module) - else() - find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development) - endif() -else() # support Ubuntu 18.04 - # pybind11 config looks for Python path again when deprecated PythonInterp - # and PythonLibs packages are used. It should find the same version though - # because PYTHON_EXECUTABLE is already set. - find_package(PythonInterp 3.7 REQUIRED) - find_package(PythonLibs 3.7 REQUIRED) - # Python installation path should be modified via Python environment. - # Following way of getting paths seems to be working (for Ubuntu as well). - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'), end='')" OUTPUT_VARIABLE Python3_SITEARCH) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('purelib'), end='')" OUTPUT_VARIABLE Python3_SITELIB) - set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) +# The default value ("FIRST") prefers the installation with the highest +# version. "ONLY" sticks to a virtualenv even when its version is smaller +# which is usually expected by an user. +if (NOT DEFINED Python3_FIND_VIRTUALENV) + set(Python3_FIND_VIRTUALENV "ONLY") endif() +# Development.Embed is not supported by cibuildwheel environment +find_package(Python3 3.7 REQUIRED COMPONENTS Interpreter Development.Module) message(STATUS "Python native modules installation path (Python3_SITEARCH): ${Python3_SITEARCH}") message(STATUS "Python modules installation path (Python3_SITELIB): ${Python3_SITELIB}")