From 36d4cff8a17fd893f1405cc1152780b9c6077494 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 22 Oct 2023 19:20:21 +0200 Subject: [PATCH 1/2] CMake: Permit to explictly specify Python installation directory By setting the WEARABLES_PYTHON_INSTALL_DIR CMake variable. --- bindings/CMakeLists.txt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt index 7ec18c9..231dd82 100644 --- a/bindings/CMakeLists.txt +++ b/bindings/CMakeLists.txt @@ -14,14 +14,17 @@ if(WEARABLES_COMPILE_PYTHON_BINDINGS) FALSE) # Install the resulting Python package for the active interpreter - if(WEARABLES_DETECT_ACTIVE_PYTHON_SITEPACKAGES) - set(PYTHON_INSTDIR ${Python3_SITELIB}/wearables) - else() - execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix=''))" - OUTPUT_VARIABLE _PYTHON_INSTDIR) - string(STRIP ${_PYTHON_INSTDIR} _PYTHON_INSTDIR_CLEAN) - set(PYTHON_INSTDIR ${_PYTHON_INSTDIR_CLEAN}/wearables) + if(NOT DEFINED WEARABLES_PYTHON_INSTALL_DIR) + if(WEARABLES_DETECT_ACTIVE_PYTHON_SITEPACKAGES) + set(WEARABLES_PYTHON_INSTALL_DIR ${Python3_SITELIB}) + else() + execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix=''))" + OUTPUT_VARIABLE _PYTHON_INSTDIR) + string(STRIP ${_PYTHON_INSTDIR} _PYTHON_INSTDIR_CLEAN) + set(WEARABLES_PYTHON_INSTALL_DIR ${_PYTHON_INSTDIR_CLEAN}) + endif() endif() + set(PYTHON_INSTDIR ${WEARABLES_PYTHON_INSTALL_DIR}/wearables) # Folder of the Python package within the build tree. # It is used for the Python tests. From f19cdee4d9cd950125801e625e0f2becdfc56ded Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 22 Oct 2023 19:22:28 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13601f2..9c24836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- CMake: Permit to explictly specify Python installation directory by setting the `WEARABLES_PYTHON_INSTALL_DIR` CMake variable (https://github.com/robotology/wearables/pull/197). + ## [1.7.2] - 2023-09-06 ### Fixed