Skip to content

Commit

Permalink
CMake: Permit to explictly specify Python installation directory
Browse files Browse the repository at this point in the history
By setting the WEARABLES_PYTHON_INSTALL_DIR CMake variable.
  • Loading branch information
traversaro authored Oct 22, 2023
1 parent 3fe3182 commit 36d4cff
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 36d4cff

Please sign in to comment.