From adf3f1f4fefe566c151a3ba9904eaff7299a7822 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Thu, 26 Sep 2024 13:42:11 +0200 Subject: [PATCH] Enable python bindings compilation for human-dynamics-estimation if ROBOTOLOGY_USES_PYTHON is enabled (#1717) * Enable python bindings compilation for human-dynamics-estimation * Update BuildHumanDynamicsEstimation.cmake * Bump hde to 4.0.1 --- cmake/BuildHumanDynamicsEstimation.cmake | 25 ++++++++++++++++++++++-- cmake/BuildiDynTree.cmake | 2 +- releases/latest.releases.yaml | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/cmake/BuildHumanDynamicsEstimation.cmake b/cmake/BuildHumanDynamicsEstimation.cmake index eb6935ae7..aca5e787e 100644 --- a/cmake/BuildHumanDynamicsEstimation.cmake +++ b/cmake/BuildHumanDynamicsEstimation.cmake @@ -11,8 +11,24 @@ find_or_build_package(osqp QUIET) find_or_build_package(OsqpEigen QUIET) find_or_build_package(robometry QUIET) +# For what regards Python installation, the options changes depending +# on whether we are installing HDE in the superbuild, or generating a +# conda package +# See https://github.com/robotology/robotology-superbuild/issues/641 +set(HDE_OPTIONAL_CMAKE_ARGS "") +if(ROBOTOLOGY_USES_PYTHON) + if (NOT ROBOTOLOGY_GENERATE_CONDA_RECIPES) + # If we are not generating a conda recipe, the bindings need to go in the ROBOTOLOGY_SUPERBUILD_PYTHON_INSTALL_DIR + list(APPEND HDE_OPTIONAL_CMAKE_ARGS "-DHDE_PYTHON_INSTALL_DIR=${ROBOTOLOGY_SUPERBUILD_PYTHON_INSTALL_DIR}") + else() + # If we are building a conda package, the active environment is the correct place were to install the python bindings + list(APPEND HDE_OPTIONAL_CMAKE_ARGS "-DHDE_DETECT_ACTIVE_PYTHON_SITEPACKAGES:BOOL=ON") + endif() +endif() + + if(WIN32) - list(APPEND HDE_CMAKE_ARGS -DXSENS_MVN_USE_SDK:BOOL=${ROBOTOLOGY_USES_XSENS_MVN_SDK} -DENABLE_XsensSuit:BOOL=${ROBOTOLOGY_USES_XSENS_MVN_SDK} ) + list(APPEND HDE_OPTIONAL_CMAKE_ARGS -DXSENS_MVN_USE_SDK:BOOL=${ROBOTOLOGY_USES_XSENS_MVN_SDK} -DENABLE_XsensSuit:BOOL=${ROBOTOLOGY_USES_XSENS_MVN_SDK} ) endif() ycm_ep_helper(HumanDynamicsEstimation TYPE GIT @@ -21,7 +37,7 @@ ycm_ep_helper(HumanDynamicsEstimation TYPE GIT TAG master COMPONENT human_dynamics FOLDER src - CMAKE_ARGS -DHUMANSTATEPROVIDER_ENABLE_VISUALIZER:BOOL=ON ${HDE_CMAKE_ARGS} + CMAKE_ARGS -DHUMANSTATEPROVIDER_ENABLE_VISUALIZER:BOOL=ON -DHDE_COMPILE_PYTHON_BINDINGS:BOOL=${ROBOTOLOGY_USES_PYTHON} ${HDE_OPTIONAL_CMAKE_ARGS} DEPENDS iDynTree YARP osqp @@ -30,3 +46,8 @@ ycm_ep_helper(HumanDynamicsEstimation TYPE GIT robometry) set(HumanDynamicsEstimation_CONDA_DEPENDENCIES eigen) + +if(ROBOTOLOGY_USES_PYTHON) + list(APPEND HumanDynamicsEstimation_CONDA_DEPENDENCIES python) + list(APPEND HumanDynamicsEstimation_CONDA_DEPENDENCIES pybind11) +endif() diff --git a/cmake/BuildiDynTree.cmake b/cmake/BuildiDynTree.cmake index d06edaeb0..11d25727e 100644 --- a/cmake/BuildiDynTree.cmake +++ b/cmake/BuildiDynTree.cmake @@ -11,7 +11,7 @@ set(iDynTree_DEPENDS "") list(APPEND iDynTree_DEPENDS OsqpEigen) # For what regards Python installation, the options changes depending -# on whether we are installing YARP from source, or generating a +# on whether we are installing iDynTree from source, or generating a # conda package on Windows as in that case the installation location # will need to be outside of CMAKE_INSTALL_PREFIX # See https://github.com/robotology/robotology-superbuild/issues/641 diff --git a/releases/latest.releases.yaml b/releases/latest.releases.yaml index d0719eb7d..416abe717 100644 --- a/releases/latest.releases.yaml +++ b/releases/latest.releases.yaml @@ -122,7 +122,7 @@ repositories: HumanDynamicsEstimation: type: git url: https://github.com/robotology/human-dynamics-estimation.git - version: v4.0.0 + version: v4.0.1 human-gazebo: type: git url: https://github.com/robotology/human-gazebo.git