From 1e0cace3bfa0885c0975848284e111f8739e2f92 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 22 Oct 2023 18:56:05 +0200 Subject: [PATCH 1/2] CMake: Permit to explictly specify Python installation directory This is done by setting the ICUB_MODELS_PYTHON_INSTALL_DIR CMake variable. --- python/CMakeLists.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 2775924..dbe0273 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -11,15 +11,18 @@ if(ICUB_MODELS_USES_PYTHON) FALSE) # Install the resulting Python package for the active interpreter - if(ICUB_MODELS_DETECT_ACTIVE_PYTHON_SITEPACKAGES) - set(PYTHON_INSTDIR ${Python3_SITELIB}/icub_models) - 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}/icub_models) + if(NOT DEFINED ICUB_MODELS_PYTHON_INSTALL_DIR) + if(ICUB_MODELS_DETECT_ACTIVE_PYTHON_SITEPACKAGES) + set(ICUB_MODELS_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(ICUB_MODELS_PYTHON_INSTALL_DIR ${_PYTHON_INSTDIR_CLEAN}) + endif() endif() + set(PYTHON_INSTDIR ${ICUB_MODELS_PYTHON_INSTALL_DIR}/icub_models) + # Install the __init__.py file From 417997c3aa005a7a5176585a0a8f1b4170c18256 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 22 Oct 2023 18:57:14 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d7631f..62bb7c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format of this document is based on [Keep a Changelog](https://keepachangelo ### Changed * Enable publishing of robot joints in ROS 2 via `controlBoard_nws_ros2` for `iCubGazeboV2_5_visuomanip` (https://github.com/robotology/icub-models/pull/211). +* CMake: Permit to explictly specify Python installation directory by setting the `ICUB_MODELS_PYTHON_INSTALL_DIR` CMake variable (https://github.com/robotology/icub-models/pull/218). ### Fixed * Fixed wrong simulated finger hall effect sensors port names prefix for `iCubGazeboV2_5_visuomanip` (https://github.com/robotology/icub-models/pull/215).