From cb9c67b0cbc4da3d2598ce70439240035c985d3d Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Wed, 28 Jul 2021 12:39:47 +0200 Subject: [PATCH 01/16] [CMake] FIX pybind11 finding python (2) --- CMakeLists.txt | 40 +++++++++++++++++++++++--------------- SofaPython3Config.cmake.in | 38 ++++++++++++++++++++++++------------ 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6067a250..62fc47c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,28 +81,36 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Set the minimum python version to 3.7 set(PYBIND11_PYTHON_VERSION 3.7) -# Find Python3 executable and set PYTHON_EXECUTABLE before finding pybind11 -# to be sure that pybind11 relies on the right Python version -set(python_version "${PYBIND11_PYTHON_VERSION}") -set(python_version_flag "") -if(PYTHON_EXECUTABLE) - execute_process( - COMMAND "${PYTHON_EXECUTABLE}" "--version" - OUTPUT_VARIABLE cmd_output - ) - string(REGEX MATCH "[0-9]+\.[0-9]+" python_exec_version "${cmd_output}") - if(python_exec_version VERSION_GREATER_EQUAL PYBIND11_PYTHON_VERSION) - set(python_version "${python_exec_version}") - set(python_version_flag "EXACT") - endif() -endif() -find_package(Python ${python_version} ${python_version_flag} COMPONENTS Interpreter Development REQUIRED) +# Save PYTHON_* vars +set(PYTHON_VERSION_RESET "${PYTHON_VERSION}") set(PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE}") +set(PYTHON_LIBRARIES_RESET "${PYTHON_LIBRARIES}") +set(PYTHON_INCLUDE_DIRS_RESET "${PYTHON_INCLUDE_DIRS}") +set(PYTHON_LIBRARY_RESET "${PYTHON_LIBRARY}") +set(PYTHON_INCLUDE_DIR_RESET "${PYTHON_INCLUDE_DIR}") + +# Find Python3 +find_package(Python ${PYBIND11_PYTHON_VERSION} COMPONENTS Interpreter Development REQUIRED) + +# Change PYTHON_* vars before pybind11 find_package +# to be sure that pybind11 relies on the right Python version +set(PYTHON_VERSION "${Python_VERSION}" CACHE STRING "" FORCE) set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}" CACHE FILEPATH "" FORCE) +set(PYTHON_LIBRARIES "${Python_LIBRARIES}" CACHE STRING "" FORCE) +set(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}" CACHE STRING "" FORCE) +set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) +set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) # Set the minimum pybind11 version to 2.3 (before that the pybind11::embed target did not exist) find_package(pybind11 2.3 CONFIG QUIET REQUIRED) + +# Reset PYTHON_* vars +set(PYTHON_VERSION "${PYTHON_VERSION_RESET}" CACHE STRING "" FORCE) set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_RESET}" CACHE FILEPATH "" FORCE) +set(PYTHON_LIBRARIES "${PYTHON_LIBRARIES_RESET}" CACHE STRING "" FORCE) +set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS_RESET}" CACHE STRING "" FORCE) +set(PYTHON_LIBRARY "${PYTHON_LIBRARY_RESET}" CACHE INTERNAL "" FORCE) +set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR_RESET}" CACHE INTERNAL "" FORCE) set(SP3_PYTHON_PACKAGES_DIRECTORY "python3/site-packages" diff --git a/SofaPython3Config.cmake.in b/SofaPython3Config.cmake.in index aa0c2be9..86603935 100644 --- a/SofaPython3Config.cmake.in +++ b/SofaPython3Config.cmake.in @@ -9,23 +9,37 @@ set(SP3_PYTHON_PACKAGES_DIRECTORY @SP3_PYTHON_PACKAGES_DIRECTORY@) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") include(SofaPython3Tools) -# Find Python3 executable and set PYTHON_EXECUTABLE before finding pybind11 +# Save PYTHON_* vars +set(PYTHON_VERSION_RESET "${PYTHON_VERSION}") +set(PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE}") +set(PYTHON_LIBRARIES_RESET "${PYTHON_LIBRARIES}") +set(PYTHON_INCLUDE_DIRS_RESET "${PYTHON_INCLUDE_DIRS}") +set(PYTHON_LIBRARY_RESET "${PYTHON_LIBRARY}") +set(PYTHON_INCLUDE_DIR_RESET "${PYTHON_INCLUDE_DIR}") + +# Find Python3 +find_package(Python @PYBIND11_PYTHON_VERSION@ COMPONENTS Interpreter Development REQUIRED) + +# Change PYTHON_* vars before pybind11 find_package # to be sure that pybind11 relies on the right Python version -set(python_version @PYTHON_VERSION@) -set(python_version_flag @python_version_flag@) - -find_package(Python ${python_version} ${python_version_flag} COMPONENTS Interpreter Development REQUIRED) - -set(PYTHON_VERSION ${Python_VERSION}) -set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) -set(PYTHON_LIBRARIES ${Python_LIBRARIES}) -set(PYTHON_INCLUDE_DIRS ${Python_INCLUDE_DIRS}) -set(PYTHON_LIBRARY ${Python_LIBRARY}) -set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIR}) +set(PYTHON_VERSION "${Python_VERSION}" CACHE STRING "" FORCE) +set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}" CACHE FILEPATH "" FORCE) +set(PYTHON_LIBRARIES "${Python_LIBRARIES}" CACHE STRING "" FORCE) +set(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}" CACHE STRING "" FORCE) +set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) +set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) # Set the minimum pybind11 version to 2.3 (before that the pybind11::embed target did not exist) find_package(pybind11 2.3 CONFIG QUIET REQUIRED) +# Reset PYTHON_* vars +set(PYTHON_VERSION "${PYTHON_VERSION_RESET}" CACHE STRING "" FORCE) +set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_RESET}" CACHE FILEPATH "" FORCE) +set(PYTHON_LIBRARIES "${PYTHON_LIBRARIES_RESET}" CACHE STRING "" FORCE) +set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS_RESET}" CACHE STRING "" FORCE) +set(PYTHON_LIBRARY "${PYTHON_LIBRARY_RESET}" CACHE INTERNAL "" FORCE) +set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR_RESET}" CACHE INTERNAL "" FORCE) + if(NOT SofaPython3_FIND_COMPONENTS) set(SofaPython3_FIND_COMPONENTS Plugin Bindings) endif() From 2203ee920149c8aad99a285b3392b94b2fe209cf Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Wed, 28 Jul 2021 18:37:58 +0200 Subject: [PATCH 02/16] [CMake] find_package(Python) first --- CMakeLists.txt | 6 +++--- SofaPython3Config.cmake.in | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62fc47c6..453131c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Set the minimum python version to 3.7 set(PYBIND11_PYTHON_VERSION 3.7) +# Find Python3 +find_package(Python ${PYBIND11_PYTHON_VERSION} COMPONENTS Interpreter Development REQUIRED) + # Save PYTHON_* vars set(PYTHON_VERSION_RESET "${PYTHON_VERSION}") set(PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE}") @@ -89,9 +92,6 @@ set(PYTHON_INCLUDE_DIRS_RESET "${PYTHON_INCLUDE_DIRS}") set(PYTHON_LIBRARY_RESET "${PYTHON_LIBRARY}") set(PYTHON_INCLUDE_DIR_RESET "${PYTHON_INCLUDE_DIR}") -# Find Python3 -find_package(Python ${PYBIND11_PYTHON_VERSION} COMPONENTS Interpreter Development REQUIRED) - # Change PYTHON_* vars before pybind11 find_package # to be sure that pybind11 relies on the right Python version set(PYTHON_VERSION "${Python_VERSION}" CACHE STRING "" FORCE) diff --git a/SofaPython3Config.cmake.in b/SofaPython3Config.cmake.in index 86603935..f3b7d774 100644 --- a/SofaPython3Config.cmake.in +++ b/SofaPython3Config.cmake.in @@ -9,6 +9,9 @@ set(SP3_PYTHON_PACKAGES_DIRECTORY @SP3_PYTHON_PACKAGES_DIRECTORY@) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") include(SofaPython3Tools) +# Find Python3 +find_package(Python @PYBIND11_PYTHON_VERSION@ COMPONENTS Interpreter Development REQUIRED) + # Save PYTHON_* vars set(PYTHON_VERSION_RESET "${PYTHON_VERSION}") set(PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE}") @@ -17,9 +20,6 @@ set(PYTHON_INCLUDE_DIRS_RESET "${PYTHON_INCLUDE_DIRS}") set(PYTHON_LIBRARY_RESET "${PYTHON_LIBRARY}") set(PYTHON_INCLUDE_DIR_RESET "${PYTHON_INCLUDE_DIR}") -# Find Python3 -find_package(Python @PYBIND11_PYTHON_VERSION@ COMPONENTS Interpreter Development REQUIRED) - # Change PYTHON_* vars before pybind11 find_package # to be sure that pybind11 relies on the right Python version set(PYTHON_VERSION "${Python_VERSION}" CACHE STRING "" FORCE) From 3f31b342820030946454c3deb1beef2eccca7159 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Wed, 28 Jul 2021 18:40:46 +0200 Subject: [PATCH 03/16] [CMake] FIX badly named PYTHON_USER_SITE variable --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 453131c4..86012fcd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,7 @@ message(STATUS "Python: Executable: ${Python_EXECUTABLE} Headers: ${Python_INCLUDE_DIRS} Libraries: ${Python_LIBRARIES} - User site: ${Python_USER_SITE}" + User site: ${PYTHON_USER_SITE}" ) message(STATUS "pybind11: Version: ${pybind11_VERSION} From 0e6d983ea71d9cb9cc19dade9dc7a7cf081ba5ea Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Wed, 28 Jul 2021 18:44:42 +0200 Subject: [PATCH 04/16] add debug logs --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86012fcd..da88f771 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,9 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(PYBIND11_PYTHON_VERSION 3.7) # Find Python3 +message("--- find_package(Python) ---") find_package(Python ${PYBIND11_PYTHON_VERSION} COMPONENTS Interpreter Development REQUIRED) +message("--- find_package(Python) done ---") # Save PYTHON_* vars set(PYTHON_VERSION_RESET "${PYTHON_VERSION}") @@ -102,7 +104,9 @@ set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) # Set the minimum pybind11 version to 2.3 (before that the pybind11::embed target did not exist) +message("--- find_package(pybind11) ---") find_package(pybind11 2.3 CONFIG QUIET REQUIRED) +message("--- find_package(pybind11) done ---") # Reset PYTHON_* vars set(PYTHON_VERSION "${PYTHON_VERSION_RESET}" CACHE STRING "" FORCE) From 9099aa601aaf2abb4094791b11e25d1edc9d3ad5 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Thu, 29 Jul 2021 10:57:58 +0200 Subject: [PATCH 05/16] add debug logs (2) --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index da88f771..23e40611 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,20 @@ set(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}" CACHE STRING "" FORCE) set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) +message("PYTHON_VERSION_RESET = ${PYTHON_VERSION_RESET}") +message("PYTHON_EXECUTABLE_RESET = ${PYTHON_EXECUTABLE_RESET}") +message("PYTHON_LIBRARIES_RESET = ${PYTHON_LIBRARIES_RESET}") +message("PYTHON_INCLUDE_DIRS_RESET = ${PYTHON_INCLUDE_DIRS_RESET}") +message("PYTHON_LIBRARY_RESET = ${PYTHON_LIBRARY_RESET}") +message("PYTHON_INCLUDE_DIR_RESET = ${PYTHON_INCLUDE_DIR_RESET}") + +message("PYTHON_VERSION = ${PYTHON_VERSION}") +message("PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") +message("PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}") +message("PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}") +message("PYTHON_LIBRARY = ${PYTHON_LIBRARY}") +message("PYTHON_INCLUDE_DIR = ${PYTHON_INCLUDE_DIR}") + # Set the minimum pybind11 version to 2.3 (before that the pybind11::embed target did not exist) message("--- find_package(pybind11) ---") find_package(pybind11 2.3 CONFIG QUIET REQUIRED) From 4a035d009d2f8b1eb812e6689a810c2543754ba3 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Thu, 29 Jul 2021 11:08:24 +0200 Subject: [PATCH 06/16] [CMake] Fallback values for PYTHON_LIBRARY and PYTHON_INCLUDE_DIR --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23e40611..ea949e03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,8 +100,16 @@ set(PYTHON_VERSION "${Python_VERSION}" CACHE STRING "" FORCE) set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}" CACHE FILEPATH "" FORCE) set(PYTHON_LIBRARIES "${Python_LIBRARIES}" CACHE STRING "" FORCE) set(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}" CACHE STRING "" FORCE) -set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) -set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) +if(EXISTS "${Python_LIBRARY}") + set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) +elseif(EXISTS "${Python_LIBRARIES}") + set(PYTHON_LIBRARY "${Python_LIBRARIES}" CACHE INTERNAL "" FORCE) +endif() +if(EXISTS "${Python_INCLUDE_DIR}") + set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) +elseif(EXISTS "${Python_INCLUDE_DIRS}") + set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE) +endif() message("PYTHON_VERSION_RESET = ${PYTHON_VERSION_RESET}") message("PYTHON_EXECUTABLE_RESET = ${PYTHON_EXECUTABLE_RESET}") From 6d406515a71bc4806da9bde3f440ef329750bc7c Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Thu, 29 Jul 2021 11:28:33 +0200 Subject: [PATCH 07/16] [CMake] Reset PYTHON_* vars as late as possible --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea949e03..556bc02b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,14 +130,6 @@ message("--- find_package(pybind11) ---") find_package(pybind11 2.3 CONFIG QUIET REQUIRED) message("--- find_package(pybind11) done ---") -# Reset PYTHON_* vars -set(PYTHON_VERSION "${PYTHON_VERSION_RESET}" CACHE STRING "" FORCE) -set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_RESET}" CACHE FILEPATH "" FORCE) -set(PYTHON_LIBRARIES "${PYTHON_LIBRARIES_RESET}" CACHE STRING "" FORCE) -set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS_RESET}" CACHE STRING "" FORCE) -set(PYTHON_LIBRARY "${PYTHON_LIBRARY_RESET}" CACHE INTERNAL "" FORCE) -set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR_RESET}" CACHE INTERNAL "" FORCE) - set(SP3_PYTHON_PACKAGES_DIRECTORY "python3/site-packages" CACHE STRING @@ -254,3 +246,11 @@ if (SP3_LINK_TO_USER_SITE AND SP3_PYTHON_PACKAGES_LINK_DIRECTORY) endif() endforeach() endif() + +# Reset PYTHON_* vars +set(PYTHON_VERSION "${PYTHON_VERSION_RESET}" CACHE STRING "" FORCE) +set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_RESET}" CACHE FILEPATH "" FORCE) +set(PYTHON_LIBRARIES "${PYTHON_LIBRARIES_RESET}" CACHE STRING "" FORCE) +set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS_RESET}" CACHE STRING "" FORCE) +set(PYTHON_LIBRARY "${PYTHON_LIBRARY_RESET}" CACHE INTERNAL "" FORCE) +set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_DIR_RESET}" CACHE INTERNAL "" FORCE) From fa67fe989b67221a7354ec74a7f36de00a0a96d1 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Thu, 29 Jul 2021 11:35:19 +0200 Subject: [PATCH 08/16] [CMake] Propagate fix to Config.cmake.in --- SofaPython3Config.cmake.in | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/SofaPython3Config.cmake.in b/SofaPython3Config.cmake.in index f3b7d774..e9ff715a 100644 --- a/SofaPython3Config.cmake.in +++ b/SofaPython3Config.cmake.in @@ -26,8 +26,16 @@ set(PYTHON_VERSION "${Python_VERSION}" CACHE STRING "" FORCE) set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}" CACHE FILEPATH "" FORCE) set(PYTHON_LIBRARIES "${Python_LIBRARIES}" CACHE STRING "" FORCE) set(PYTHON_INCLUDE_DIRS "${Python_INCLUDE_DIRS}" CACHE STRING "" FORCE) -set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) -set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) +if(EXISTS "${Python_LIBRARY}") + set(PYTHON_LIBRARY "${Python_LIBRARY}" CACHE INTERNAL "" FORCE) +elseif(EXISTS "${Python_LIBRARIES}") + set(PYTHON_LIBRARY "${Python_LIBRARIES}" CACHE INTERNAL "" FORCE) +endif() +if(EXISTS "${Python_INCLUDE_DIR}") + set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR}" CACHE INTERNAL "" FORCE) +elseif(EXISTS "${Python_INCLUDE_DIRS}") + set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE) +endif() # Set the minimum pybind11 version to 2.3 (before that the pybind11::embed target did not exist) find_package(pybind11 2.3 CONFIG QUIET REQUIRED) From 312dfec25c611bc9cbc6c46784410d13095bddf7 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Thu, 29 Jul 2021 11:36:24 +0200 Subject: [PATCH 09/16] remove debug logs --- CMakeLists.txt | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 556bc02b..59215e5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,9 +82,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) set(PYBIND11_PYTHON_VERSION 3.7) # Find Python3 -message("--- find_package(Python) ---") find_package(Python ${PYBIND11_PYTHON_VERSION} COMPONENTS Interpreter Development REQUIRED) -message("--- find_package(Python) done ---") # Save PYTHON_* vars set(PYTHON_VERSION_RESET "${PYTHON_VERSION}") @@ -111,24 +109,8 @@ elseif(EXISTS "${Python_INCLUDE_DIRS}") set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE) endif() -message("PYTHON_VERSION_RESET = ${PYTHON_VERSION_RESET}") -message("PYTHON_EXECUTABLE_RESET = ${PYTHON_EXECUTABLE_RESET}") -message("PYTHON_LIBRARIES_RESET = ${PYTHON_LIBRARIES_RESET}") -message("PYTHON_INCLUDE_DIRS_RESET = ${PYTHON_INCLUDE_DIRS_RESET}") -message("PYTHON_LIBRARY_RESET = ${PYTHON_LIBRARY_RESET}") -message("PYTHON_INCLUDE_DIR_RESET = ${PYTHON_INCLUDE_DIR_RESET}") - -message("PYTHON_VERSION = ${PYTHON_VERSION}") -message("PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") -message("PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}") -message("PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}") -message("PYTHON_LIBRARY = ${PYTHON_LIBRARY}") -message("PYTHON_INCLUDE_DIR = ${PYTHON_INCLUDE_DIR}") - # Set the minimum pybind11 version to 2.3 (before that the pybind11::embed target did not exist) -message("--- find_package(pybind11) ---") find_package(pybind11 2.3 CONFIG QUIET REQUIRED) -message("--- find_package(pybind11) done ---") set(SP3_PYTHON_PACKAGES_DIRECTORY "python3/site-packages" From 22d0c825c34eeee401e9dfa334848dfb3ed81bcf Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 30 Jul 2021 17:10:53 +0200 Subject: [PATCH 10/16] Merge branch 'ci_improve_workflows' into fix_fileformat_error --- .github/workflows/macos.yml | 169 +++++++++++++++++++++++------------ .github/workflows/ubuntu.yml | 166 ++++++++++++++++++++-------------- CMakeLists.txt | 4 + 3 files changed, 215 insertions(+), 124 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6862def2..214754c5 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,22 +1,42 @@ -name: CI +name: MacOS CI -on: pull_request +on: [workflow_dispatch, pull_request] jobs: build: - name: Building on ${{ matrix.os }} + name: Building with SOFA ${{ matrix.sofa_branch }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [macos-10.15] + sofa_branch: [master, v21.06] env: - TOKEN: ${{ secrets.SOFA_REPO_READ_TOKEN }} SOFA_ROOT: /opt/sofa + SOFA_OS: MacOS steps: - name: Checkout source code uses: actions/checkout@v2 + - name: Set env vars + run: | + echo github.event.number = ${{ github.event.number }} + echo github.event.pull_request.number = ${{ github.event.pull_request.number }} + echo github.event.issue.number = ${{ github.event.issue.number }} + if [ -n "${{ github.event.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.number }}" + elif [ -n "${{ github.event.pull_request.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.pull_request.number }}" + elif [ -n "${{ github.event.issue.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.issue.number }}" + else + GIT_BRANCH="${GITHUB_REF#refs/heads/}" + fi + echo "GIT_BRANCH = $GIT_BRANCH" + if [ -z "$GIT_BRANCH" ]; then exit 1; fi + echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV + - name: Set up Python 3.7 uses: actions/setup-python@v2 with: @@ -24,76 +44,107 @@ jobs: - name: Install requirements run: | - brew install ccache ninja boost eigen pybind11 - python3 -m pip install numpy + brew install eigen boost + brew install ccache ninja + python3 -m pip install numpy scipy - - name: Download SOFA nightly build - run: | - curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip + - name: pybind11 cache files + uses: actions/cache@v2 + id: pybind11_cache + with: + path: /tmp/pybind11 + key: pybind11_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }} - - name: Install SOFA nightly build + - name: Build pybind11 + if: steps.pybind11_cache.outputs.cache-hit != 'true' run: | - sudo unzip sofa.zip -d temp - sudo unzip temp/MacOS/`ls temp/MacOS/` -d temp - sudo rm -rf temp/MacOS - sudo mv temp/`ls temp` $SOFA_ROOT - rm -rf temp - - - name: Get Time - id: time - uses: nanzm/get-time-action@v1.0 - with: - timeZone: 8 - format: 'YYYY-MM-DD-HH-mm-ss' + git clone -b v2.4.3 --depth 1 https://github.com/pybind/pybind11.git /tmp/pybind11 + cd /tmp/pybind11 + cmake -DCMAKE_BUILD_TYPE=Release -DPYBIND11_TEST=OFF -DPYTHON_EXECUTABLE=$(which python3.7) . + make --silent + + - name: Install pybind11 + run: | + cd /tmp/pybind11 + sudo make --silent install + + - name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries + shell: bash + run: | + mkdir -p /tmp/sofa_zip + mkdir -p /tmp/sofa_binaries + curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \ + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS}/*zip*/${SOFA_OS}.zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries + sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT} + sudo ls -la ${SOFA_ROOT} + rm -rf /tmp/sofa_* - name: ccache cache files uses: actions/cache@v2 with: path: .ccache - key: ${{ matrix.os }}-ccache-${{ steps.time.outputs.time }} - restore-keys: | - ${{ matrix.os }}-ccache- + key: ccache_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }} - name: Build env: CCACHE_COMPRESS: true CCACHE_COMPRESSLEVEL: 6 CCACHE_MAXSIZE: "500M" - run: - export CCACHE_BASEDIR=$GITHUB_WORKSPACE && - export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache && - ccache -z && - cmake - -GNinja - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake - -DCMAKE_BUILD_TYPE=Release - -DPYTHON_EXECUTABLE=$(which python) - . - && ninja && ninja install - && echo ${CCACHE_BASEDIR} - && ccache -s - - - name: Archive production + run: | + export CCACHE_BASEDIR=$GITHUB_WORKSPACE + export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache + ccache -z + cmake \ + -GNinja \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DPYTHON_EXECUTABLE=$(which python3.7) \ + . + ninja install + echo ${CCACHE_BASEDIR} + ccache -s + + - name: Create artifact uses: actions/upload-artifact@v2 with: - name: sp3-${{ matrix.os }} + name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }} path: install tests: - name: Testing on ${{ matrix.os }} + name: Testing with SOFA ${{ matrix.sofa_branch }} needs: [build] runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [macos-10.15] + sofa_branch: [master, v21.06] env: - TOKEN: ${{ secrets.SOFA_REPO_READ_TOKEN }} SOFA_ROOT: /opt/sofa + SOFA_OS: MacOS steps: + - name: Set env vars + run: | + echo github.event.number = ${{ github.event.number }} + echo github.event.pull_request.number = ${{ github.event.pull_request.number }} + echo github.event.issue.number = ${{ github.event.issue.number }} + if [ -n "${{ github.event.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.number }}" + elif [ -n "${{ github.event.pull_request.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.pull_request.number }}" + elif [ -n "${{ github.event.issue.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.issue.number }}" + else + GIT_BRANCH="${GITHUB_REF#refs/heads/}" + fi + echo "GIT_BRANCH = $GIT_BRANCH" + if [ -z "$GIT_BRANCH" ]; then exit 1; fi + echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV - name: Set up Python 3.7 uses: actions/setup-python@v2 @@ -103,25 +154,25 @@ jobs: - name: Install requirements run: | brew install boost - python3 -m pip install numpy - - - name: Download SOFA nightly build - run: | - curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/MacOS/*zip*/MacOS.zip + python3 -m pip install numpy scipy - - name: Install SOFA nightly build + - name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries + shell: bash run: | - sudo unzip sofa.zip -d temp - sudo unzip temp/MacOS/`ls temp/MacOS/` -d temp - sudo rm -rf temp/MacOS - sudo mv temp/`ls temp` $SOFA_ROOT - rm -rf temp + mkdir -p /tmp/sofa_zip + mkdir -p /tmp/sofa_binaries + curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \ + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS}/*zip*/${SOFA_OS}.zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries + sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT} + sudo ls -la ${SOFA_ROOT} + rm -rf /tmp/sofa_* - name: Install SP3 uses: actions/download-artifact@v2 with: - name: sp3-${{ matrix.os }} + name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }} path: SofaPython3 - name: Binding.Sofa.Tests diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 41d5455e..e629a37f 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,22 +1,42 @@ -name: CI +name: Ubuntu CI -on: pull_request +on: [workflow_dispatch, pull_request] jobs: build: - name: Building on ${{ matrix.os }} + name: Building with SOFA ${{ matrix.sofa_branch }} runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-18.04] + sofa_branch: [master, v21.06] env: - TOKEN: ${{ secrets.SOFA_REPO_READ_TOKEN }} SOFA_ROOT: /opt/sofa + SOFA_OS: Linux steps: - name: Checkout source code uses: actions/checkout@v2 + - name: Set env vars + run: | + echo github.event.number = ${{ github.event.number }} + echo github.event.pull_request.number = ${{ github.event.pull_request.number }} + echo github.event.issue.number = ${{ github.event.issue.number }} + if [ -n "${{ github.event.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.number }}" + elif [ -n "${{ github.event.pull_request.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.pull_request.number }}" + elif [ -n "${{ github.event.issue.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.issue.number }}" + else + GIT_BRANCH="${GITHUB_REF#refs/heads/}" + fi + echo "GIT_BRANCH = $GIT_BRANCH" + if [ -z "$GIT_BRANCH" ]; then exit 1; fi + echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV + - name: Set up Python 3.7 uses: actions/setup-python@v2 with: @@ -26,89 +46,105 @@ jobs: run: | sudo apt install -qq libeigen3-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev sudo apt install -qq ccache ninja-build - python3 -m pip install numpy + python3 -m pip install numpy scipy - - name: Cache pybind11 + - name: pybind11 cache files uses: actions/cache@v2 id: pybind11_cache with: path: /tmp/pybind11 - key: pybind24 + key: pybind11_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }} - name: Build pybind11 if: steps.pybind11_cache.outputs.cache-hit != 'true' - run: git clone -b v2.4 --depth 1 https://github.com/pybind/pybind11.git /tmp/pybind11 && cd /tmp/pybind11 && cmake -DPYBIND11_TEST=OFF . && cmake -DPYBIND11_TEST=OFF . && make + run: | + git clone -b v2.4.3 --depth 1 https://github.com/pybind/pybind11.git /tmp/pybind11 + cd /tmp/pybind11 + cmake -DCMAKE_BUILD_TYPE=Release -DPYBIND11_TEST=OFF -DPYTHON_EXECUTABLE=$(which python3.7) . + make --silent - name: Install pybind11 - run: cd /tmp/pybind11 && sudo make install - - - name: Download SOFA nightly build - run: | - curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip - - - name: Install SOFA nightly build - run: | - sudo unzip sofa.zip -d temp - sudo unzip temp/Linux/`ls temp/Linux/` -d temp - sudo rm -rf temp/Linux - sudo mkdir -p $SOFA_ROOT - sudo mv temp/`ls temp`/* $SOFA_ROOT/ - sudo rm -rf temp - - - name: Get Time - id: time - uses: nanzm/get-time-action@v1.0 - with: - timeZone: 8 - format: 'YYYY-MM-DD-HH-mm-ss' + run: | + cd /tmp/pybind11 + sudo make --silent install + + - name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries + shell: bash + run: | + mkdir -p /tmp/sofa_zip + mkdir -p /tmp/sofa_binaries + curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \ + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS}/*zip*/${SOFA_OS}.zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries + sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT} + sudo ls -la ${SOFA_ROOT} + rm -rf /tmp/sofa_* - name: ccache cache files uses: actions/cache@v2 with: path: .ccache - key: ${{ matrix.os }}-ccache-${{ steps.time.outputs.time }} - restore-keys: | - ${{ matrix.os }}-ccache- + key: ccache_${{ env.GIT_BRANCH }}_${{ matrix.os }}_${{ hashFiles('.github/workflows/*.yml') }} - name: Build env: CCACHE_COMPRESS: true CCACHE_COMPRESSLEVEL: 6 CCACHE_MAXSIZE: "500M" - run: - export CCACHE_BASEDIR=$GITHUB_WORKSPACE && - export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache && - ccache -z && - cmake - -GNinja - -DCMAKE_C_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake - -DCMAKE_BUILD_TYPE=Release - . - && ninja && ninja install - && echo ${CCACHE_BASEDIR} - && ccache -s - - - name: Archive production + run: | + export CCACHE_BASEDIR=$GITHUB_WORKSPACE + export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache + ccache -z + cmake \ + -GNinja \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DPYTHON_EXECUTABLE=$(which python3.7) \ + . + ninja install + echo ${CCACHE_BASEDIR} + ccache -s + + - name: Create artifact uses: actions/upload-artifact@v2 with: - name: sp3-${{ matrix.os }} + name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }} path: install tests: - name: Testing on ${{ matrix.os }} + name: Testing with SOFA ${{ matrix.sofa_branch }} needs: [build] runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-18.04] + sofa_branch: [master, v21.06] env: - TOKEN: ${{ secrets.SOFA_REPO_READ_TOKEN }} SOFA_ROOT: /opt/sofa + SOFA_OS: Linux steps: + - name: Set env vars + run: | + echo github.event.number = ${{ github.event.number }} + echo github.event.pull_request.number = ${{ github.event.pull_request.number }} + echo github.event.issue.number = ${{ github.event.issue.number }} + if [ -n "${{ github.event.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.number }}" + elif [ -n "${{ github.event.pull_request.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.pull_request.number }}" + elif [ -n "${{ github.event.issue.number }}" ]; then + GIT_BRANCH="PR-${{ github.event.issue.number }}" + else + GIT_BRANCH="${GITHUB_REF#refs/heads/}" + fi + echo "GIT_BRANCH = $GIT_BRANCH" + if [ -z "$GIT_BRANCH" ]; then exit 1; fi + echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV - name: Set up Python 3.7 uses: actions/setup-python@v2 @@ -118,25 +154,25 @@ jobs: - name: Install requirements run: | sudo apt install -qq libboost-all-dev - python3 -m pip install numpy - - - name: Download SOFA nightly build - run: | - curl --output sofa.zip -L \ - https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/lastSuccessfulBuild/CI_SCOPE=binaries_minimal/artifact/Linux/*zip*/Linux.zip + python3 -m pip install numpy scipy - - name: Install SOFA nightly build + - name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries + shell: bash run: | - sudo unzip sofa.zip -d temp - sudo unzip temp/Linux/`ls temp/Linux/` -d temp - sudo rm -rf temp/Linux - sudo mv temp/`ls temp` $SOFA_ROOT - sudo rm -rf temp + mkdir -p /tmp/sofa_zip + mkdir -p /tmp/sofa_binaries + curl --output /tmp/sofa_zip/${SOFA_OS}.zip -L \ + https://ci.inria.fr/sofa-ci-dev/job/nightly-generate-binaries/CI_BRANCH=${{ matrix.sofa_branch }},CI_SCOPE=minimal/lastSuccessfulBuild/artifact/${SOFA_OS}/*zip*/${SOFA_OS}.zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}.zip -d /tmp/sofa_zip + unzip -qq /tmp/sofa_zip/${SOFA_OS}/SOFA_*.zip -d /tmp/sofa_binaries + sudo mv /tmp/sofa_binaries/SOFA_* ${SOFA_ROOT} + sudo ls -la ${SOFA_ROOT} + rm -rf /tmp/sofa_* - name: Install SP3 uses: actions/download-artifact@v2 with: - name: sp3-${{ matrix.os }} + name: SofaPython3_${{ env.GIT_BRANCH }}_SOFA-${{ matrix.sofa_branch }}_${{ env.SOFA_OS }} path: SofaPython3 - name: Binding.Sofa.Tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 59215e5e..baa1f7b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,10 @@ if (SP3_COMPILED_AS_SOFA_SUBPROJECT) else() option(SP3_BUILD_TEST "Compile the automatic tests for SofaPython3, along with the gtest library." ON) endif() +if(SP3_BUILD_TEST) + # TODO: remove this when SOFA's GTest handles threads correctly + find_package(Threads REQUIRED) +endif() find_package(SofaExporter QUIET) CMAKE_DEPENDENT_OPTION(SP3_WITH_SOFAEXPORTER "Bind the SOFA exporter component." ON "SofaExporter_FOUND" OFF) From b5de9fe109794941d03d2f84d252794345ca4f0f Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 30 Jul 2021 17:39:24 +0200 Subject: [PATCH 11/16] debug python env on MacOS --- .github/workflows/macos.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 214754c5..2ea6765e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -46,6 +46,11 @@ jobs: run: | brew install eigen boost brew install ccache ninja + brew list | grep python + brew unlink python@3.9 + brew unlink python@3.8 + echo "python -V" && python -V + echo "python3 -V" && python3 -V python3 -m pip install numpy scipy - name: pybind11 cache files From 3816b678d5da6be0ed7aa8e736c0981936c80987 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 30 Jul 2021 18:03:23 +0200 Subject: [PATCH 12/16] debug python env on MacOS (2) --- .github/workflows/macos.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 2ea6765e..b71e7094 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -43,12 +43,13 @@ jobs: python-version: '3.7' - name: Install requirements + shell: bash run: | brew install eigen boost brew install ccache ninja - brew list | grep python - brew unlink python@3.9 - brew unlink python@3.8 + brew list | grep python | while read package; do + brew unlink $package + done echo "python -V" && python -V echo "python3 -V" && python3 -V python3 -m pip install numpy scipy @@ -157,8 +158,14 @@ jobs: python-version: '3.7' - name: Install requirements + shell: bash run: | brew install boost + brew list | grep python | while read package; do + brew unlink $package + done + echo "python -V" && python -V + echo "python3 -V" && python3 -V python3 -m pip install numpy scipy - name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries @@ -185,6 +192,11 @@ jobs: run: | export DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/SofaPython3/lib:$SOFA_ROOT/lib export PYTHONPATH=$GITHUB_WORKSPACE/SofaPython3/lib/python3/site-packages + echo "--------------------------------" + ls -l ${SOFA_ROOT} + echo "--------------------------------" + otool -L ${SOFA_ROOT}/bin/runSofa + echo "--------------------------------" chmod +x SofaPython3/bin/Bindings.Sofa.Tests ./SofaPython3/bin/Bindings.Sofa.Tests - name: Bindings.SofaRuntime.Tests From 338527b36d1586f898c4d8dd32acf4cea0e269ef Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 30 Jul 2021 18:24:49 +0200 Subject: [PATCH 13/16] debug python env on MacOS (3) --- .github/workflows/macos.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b71e7094..b91be17b 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -197,6 +197,8 @@ jobs: echo "--------------------------------" otool -L ${SOFA_ROOT}/bin/runSofa echo "--------------------------------" + otool -L SofaPython3/bin/Bindings.Sofa.Tests + echo "--------------------------------" chmod +x SofaPython3/bin/Bindings.Sofa.Tests ./SofaPython3/bin/Bindings.Sofa.Tests - name: Bindings.SofaRuntime.Tests From 2cc8bda02d0cc26309801f88ca4fed5efd8afca8 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 30 Jul 2021 19:03:42 +0200 Subject: [PATCH 14/16] debug python env on MacOS (4) --- .github/workflows/macos.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index b91be17b..c1a72eb3 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -99,6 +99,9 @@ jobs: CCACHE_COMPRESSLEVEL: 6 CCACHE_MAXSIZE: "500M" run: | + echo "RUNNER_TOOL_CACHE = $RUNNER_TOOL_CACHE" + python_root="$(find $RUNNER_TOOL_CACHE -maxdepth 3 -type d -path '**/Python/*/x64')" + echo "python_root = $python_root" export CCACHE_BASEDIR=$GITHUB_WORKSPACE export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache ccache -z @@ -109,6 +112,8 @@ jobs: -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \ -DCMAKE_BUILD_TYPE=Release \ -DPYTHON_EXECUTABLE=$(which python3.7) \ + -DPython_EXECUTABLE=$(which python3.7) \ + -DPython_ROOT=$python_root \ . ninja install echo ${CCACHE_BASEDIR} From f213c9cf41b777005f3ef9c843da93482963fb92 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Fri, 30 Jul 2021 19:18:28 +0200 Subject: [PATCH 15/16] debug python env on MacOS (5) --- .github/workflows/macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index c1a72eb3..4996d044 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -100,7 +100,7 @@ jobs: CCACHE_MAXSIZE: "500M" run: | echo "RUNNER_TOOL_CACHE = $RUNNER_TOOL_CACHE" - python_root="$(find $RUNNER_TOOL_CACHE -maxdepth 3 -type d -path '**/Python/*/x64')" + python_root="$(find $RUNNER_TOOL_CACHE -maxdepth 3 -type d -path '**/Python/3.7*/x64')" echo "python_root = $python_root" export CCACHE_BASEDIR=$GITHUB_WORKSPACE export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache From a5b4527cd884097ea3ea4ca6cb733f6b061fbc73 Mon Sep 17 00:00:00 2001 From: Guillaume Paran Date: Sat, 31 Jul 2021 07:32:58 +0200 Subject: [PATCH 16/16] [GitHub] CLEAN worflows --- .github/workflows/macos.yml | 12 ------------ .github/workflows/ubuntu.yml | 6 +++++- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 4996d044..3a30a7d2 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -50,8 +50,6 @@ jobs: brew list | grep python | while read package; do brew unlink $package done - echo "python -V" && python -V - echo "python3 -V" && python3 -V python3 -m pip install numpy scipy - name: pybind11 cache files @@ -111,7 +109,6 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DPYTHON_EXECUTABLE=$(which python3.7) \ -DPython_EXECUTABLE=$(which python3.7) \ -DPython_ROOT=$python_root \ . @@ -169,8 +166,6 @@ jobs: brew list | grep python | while read package; do brew unlink $package done - echo "python -V" && python -V - echo "python3 -V" && python3 -V python3 -m pip install numpy scipy - name: Download and install the latest SOFA ${{ matrix.sofa_branch }} binaries @@ -197,13 +192,6 @@ jobs: run: | export DYLD_LIBRARY_PATH=$GITHUB_WORKSPACE/SofaPython3/lib:$SOFA_ROOT/lib export PYTHONPATH=$GITHUB_WORKSPACE/SofaPython3/lib/python3/site-packages - echo "--------------------------------" - ls -l ${SOFA_ROOT} - echo "--------------------------------" - otool -L ${SOFA_ROOT}/bin/runSofa - echo "--------------------------------" - otool -L SofaPython3/bin/Bindings.Sofa.Tests - echo "--------------------------------" chmod +x SofaPython3/bin/Bindings.Sofa.Tests ./SofaPython3/bin/Bindings.Sofa.Tests - name: Bindings.SofaRuntime.Tests diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e629a37f..0fb153da 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -93,6 +93,9 @@ jobs: CCACHE_COMPRESSLEVEL: 6 CCACHE_MAXSIZE: "500M" run: | + echo "RUNNER_TOOL_CACHE = $RUNNER_TOOL_CACHE" + python_root="$(find $RUNNER_TOOL_CACHE -maxdepth 3 -type d -path '**/Python/3.7*/x64')" + echo "python_root = $python_root" export CCACHE_BASEDIR=$GITHUB_WORKSPACE export CCACHE_DIR=$GITHUB_WORKSPACE/.ccache ccache -z @@ -102,7 +105,8 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_PREFIX_PATH=$SOFA_ROOT/lib/cmake \ -DCMAKE_BUILD_TYPE=Release \ - -DPYTHON_EXECUTABLE=$(which python3.7) \ + -DPython_EXECUTABLE=$(which python3.7) \ + -DPython_ROOT=$python_root \ . ninja install echo ${CCACHE_BASEDIR}