From 42781eff2f086350e4a277e544c6eb1a1ceb5f78 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 18 Jul 2021 23:47:44 +0200 Subject: [PATCH] Move iDynTree in conda-forge and build idyntree-matlab-bindings in robotology channel (#817) --- .../workflows/generate-conda-packages.yaml | 4 +++- CHANGELOG.md | 2 ++ cmake/BuildiDynTree.cmake | 9 ++------ cmake/Buildidyntree-matlab-bindings.cmake | 21 +++++++++++++++++++ cmake/RobotologySuperbuildLogic.cmake | 7 +++++++ ...tologySuperbuildGenerateCondaRecipes.cmake | 4 ++++ ... => idyntree-matlab-bindings_activate.msh} | 0 ...> idyntree-matlab-bindings_deactivate.msh} | 0 conda/recipe_template/bld.bat | 6 +++++- conda/recipe_template/build.sh | 4 ++++ releases/latest.releases.yaml | 4 ++-- scripts/install_robotology_packages.m | 2 +- 12 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 cmake/Buildidyntree-matlab-bindings.cmake rename conda/multisheller/{idyntree_activate.msh => idyntree-matlab-bindings_activate.msh} (100%) rename conda/multisheller/{idyntree_deactivate.msh => idyntree-matlab-bindings_deactivate.msh} (100%) diff --git a/.github/workflows/generate-conda-packages.yaml b/.github/workflows/generate-conda-packages.yaml index b26e28319..79d45fc26 100644 --- a/.github/workflows/generate-conda-packages.yaml +++ b/.github/workflows/generate-conda-packages.yaml @@ -105,10 +105,13 @@ jobs: cd build/conda/generated_recipes # Debug generated recipes cat */meta.yaml + cat */bld.bat + cat */build.sh # We use the conda_build_config from conda-forge-pinning, and our local one # See https://docs.conda.io/projects/conda-build/en/latest/resources/variants.html#creating-conda-build-variant-config-files # We manually specify the build order as conda build is too slow, and conda mambabuild does not support correctly multiple recipes # see https://github.com/mamba-org/boa/issues/117 + conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml idyntree-matlab-bindings conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml blockfactory conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml yarp conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml matio-cpp @@ -117,7 +120,6 @@ jobs: conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml icub-firmware-shared conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml robots-configuration conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml icub-main - conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml idyntree conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml lie-group-controllers conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml qpoases conda mambabuild -m ${CONDA_PREFIX}/conda_build_config.yaml -m ${GITHUB_WORKSPACE}/conda/conda_build_config.yml yarp-matlab-bindings diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bd9cd2dd..95793ae44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,11 @@ The format of this document is based on [Keep a Changelog](https://keepachangelo - Add `nlohmann-json` dependency to the superbuild (https://github.com/robotology/robotology-superbuild/pull/776). - In `YARP`, all the `fake***` YARP devices are now enabled (https://github.com/robotology/robotology-superbuild/pull/797). - `pybind11` has been added as dependency for the `ROBOTOLOGY_USES_PYTHON` option (https://github.com/robotology/robotology-superbuild/pull/800), to enable compilation of Python bindings of `manif` and `bipedal-locomotion-framework`. +- `ycm-cmake-modules`, `osqp-eigen`, `robot-testing-framework` and `idyntree` conda packages are now part of the `conda-forge` channel. The new `idyntree-matlab-bindings` package is now contained in the `robotology` channel (https://github.com/robotology/robotology-superbuild/pull/807, https://github.com/robotology/robotology-superbuild/pull/817). - The `idyntree-yarp-tools` was added to the Dynamics component of the superbuild (https://github.com/robotology/robotology-superbuild/pull/818). - An `apt.txt` file and a `scripts/install_apt_dependencies.sh` script have been added to the superbuild to report the required apt packages in a machine readable form. People that mantain either Docker recipes or documentation on how to instal the robotology-superbuild are suggest to switch to use these files instead of hardcoding the dependencies manually (https://github.com/robotology/robotology-superbuild/pull/825). + ## [2021.05] - 2021-05-31 ### Added diff --git a/cmake/BuildiDynTree.cmake b/cmake/BuildiDynTree.cmake index 10301acb2..398f4b3fb 100644 --- a/cmake/BuildiDynTree.cmake +++ b/cmake/BuildiDynTree.cmake @@ -37,10 +37,5 @@ ycm_ep_helper(iDynTree TYPE GIT ${iDynTree_OPTIONAL_CMAKE_ARGS} DEPENDS ${iDynTree_DEPENDS}) -set(iDynTree_CONDA_DEPENDENCIES libxml2 ipopt eigen irrlicht) - -if(ROBOTOLOGY_USES_PYTHON) - list(APPEND iDynTree_CONDA_DEPENDENCIES swig) - list(APPEND iDynTree_CONDA_DEPENDENCIES python) - list(APPEND iDynTree_CONDA_DEPENDENCIES numpy) -endif() +set(iDynTree_CONDA_PKG_NAME idyntree) +set(iDynTree_CONDA_PKG_CONDA_FORGE_OVERRIDE ON) diff --git a/cmake/Buildidyntree-matlab-bindings.cmake b/cmake/Buildidyntree-matlab-bindings.cmake new file mode 100644 index 000000000..b5313a92d --- /dev/null +++ b/cmake/Buildidyntree-matlab-bindings.cmake @@ -0,0 +1,21 @@ +# Copyright (C) Fondazione Istituto Italiano di Tecnologia +# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT +include(YCMEPHelper) +include(FindOrBuildPackage) + +find_or_build_package(iDynTree QUIET) + +# The version of idyntree-matlab-bindings is always exactly the same of iDynTree, as we use the exact same repo +set(idyntree-matlab-bindings_TAG ${iDynTree_TAG}) + +ycm_ep_helper(idyntree-matlab-bindings TYPE GIT + STYLE GITHUB + REPOSITORY robotology/idyntree.git + TAG master + COMPONENT dynamics + FOLDER src + CMAKE_ARGS -DIDYNTREE_USES_MATLAB:BOOL=${ROBOTOLOGY_USES_MATLAB} + DEPENDS iDynTree + SOURCE_SUBDIR bindings) + +set(idyntree-matlab-bindings_CONDA_PKG_NAME idyntree-matlab-bindings) diff --git a/cmake/RobotologySuperbuildLogic.cmake b/cmake/RobotologySuperbuildLogic.cmake index 0d30c175d..b751f3fac 100644 --- a/cmake/RobotologySuperbuildLogic.cmake +++ b/cmake/RobotologySuperbuildLogic.cmake @@ -37,6 +37,13 @@ endif() # Dynamics if(ROBOTOLOGY_ENABLE_DYNAMICS) find_or_build_package(iDynTree) + # If we are generating conda-recipes, then we also need to build idyntree-matlab-bindings + # as the iDynTree package provided by conda-forge does not have MATLAB bindings, so we generate + # this package in the robotology channel + if(ROBOTOLOGY_GENERATE_CONDA_RECIPES AND ROBOTOLOGY_USES_MATLAB) + find_or_build_package(idyntree-matlab-bindings) + endif() + find_or_build_package(OsqpEigen QUIET) find_or_build_package(idyntree-yarp-tools) find_or_build_package(qpOASES) find_or_build_package(BlockFactory) diff --git a/conda/cmake/RobotologySuperbuildGenerateCondaRecipes.cmake b/conda/cmake/RobotologySuperbuildGenerateCondaRecipes.cmake index bf5bfd1f6..6ba2895bb 100644 --- a/conda/cmake/RobotologySuperbuildGenerateCondaRecipes.cmake +++ b/conda/cmake/RobotologySuperbuildGenerateCondaRecipes.cmake @@ -110,6 +110,10 @@ macro(generate_metametadata_file) string(APPEND metametadata_file_contents " github_tag: ${${_cmake_pkg}_CONDA_TAG}\n") string(APPEND metametadata_file_contents " conda_build_number: ${CONDA_BUILD_NUMBER}\n") + if(_YH_${_cmake_pkg}_SOURCE_SUBDIR) + string(APPEND metametadata_file_contents " source_subdir: ${_YH_${_cmake_pkg}_SOURCE_SUBDIR}\n") + endif() + if(NOT "${${_cmake_pkg}_CONDA_CMAKE_ARGS}" STREQUAL "") string(APPEND metametadata_file_contents " cmake_args:\n") foreach(_cmake_arg IN LISTS ${_cmake_pkg}_CONDA_CMAKE_ARGS) diff --git a/conda/multisheller/idyntree_activate.msh b/conda/multisheller/idyntree-matlab-bindings_activate.msh similarity index 100% rename from conda/multisheller/idyntree_activate.msh rename to conda/multisheller/idyntree-matlab-bindings_activate.msh diff --git a/conda/multisheller/idyntree_deactivate.msh b/conda/multisheller/idyntree-matlab-bindings_deactivate.msh similarity index 100% rename from conda/multisheller/idyntree_deactivate.msh rename to conda/multisheller/idyntree-matlab-bindings_deactivate.msh diff --git a/conda/recipe_template/bld.bat b/conda/recipe_template/bld.bat index 7f8b70c07..2c7b6a0ee 100644 --- a/conda/recipe_template/bld.bat +++ b/conda/recipe_template/bld.bat @@ -1,3 +1,7 @@ +{% if source_subdir is defined and source_subdir|length %} +cd {{ source_subdir }} +{% endif %} + mkdir build cd build @@ -11,7 +15,7 @@ cmake ^ -DCMAKE_VERBOSE_MAKEFILE=OFF ^ -DCMAKE_INSTALL_LIBDIR=lib ^ {% for cmake_arg in cmake_args %} {{ cmake_arg }} ^ -{% endfor %} %SRC_DIR% +{% endfor %} .. if errorlevel 1 exit 1 :: Build. diff --git a/conda/recipe_template/build.sh b/conda/recipe_template/build.sh index 0f1e461bc..5a641672a 100644 --- a/conda/recipe_template/build.sh +++ b/conda/recipe_template/build.sh @@ -1,5 +1,9 @@ #!/bin/sh +{% if source_subdir is defined and source_subdir|length %} +cd {{ source_subdir }} +{% endif %} + mkdir build cd build diff --git a/releases/latest.releases.yaml b/releases/latest.releases.yaml index defb03588..47344131e 100644 --- a/releases/latest.releases.yaml +++ b/releases/latest.releases.yaml @@ -74,7 +74,7 @@ repositories: iDynTree: type: git url: https://github.com/robotology/idyntree.git - version: v3.3.0 + version: v4.0.0 BlockFactory: type: git url: https://github.com/robotology/blockfactory.git @@ -106,7 +106,7 @@ repositories: whole-body-estimators: type: git url: https://github.com/robotology/whole-body-estimators.git - version: v0.5.0 + version: v0.5.1 walking-teleoperation: type: git url: https://github.com/robotology/walking-teleoperation.git diff --git a/scripts/install_robotology_packages.m b/scripts/install_robotology_packages.m index cbf4b0f66..53bc27f3b 100644 --- a/scripts/install_robotology_packages.m +++ b/scripts/install_robotology_packages.m @@ -79,7 +79,7 @@ function install_robotology_packages(varargin) % Install all the robotology packages related to MATLAB or Simulink fprintf('Installing robotology packages\n'); - system(sprintf('"%s" install -y -c conda-forge -c robotology yarp-matlab-bindings idyntree wb-toolbox osqp-matlab casadi-matlab-bindings whole-body-controllers matlab-whole-body-simulator icub-models', conda_full_path)); + system(sprintf('"%s" install -y -c conda-forge -c robotology yarp-matlab-bindings idyntree-matlab-bindings wb-toolbox osqp-matlab casadi-matlab-bindings whole-body-controllers matlab-whole-body-simulator icub-models', conda_full_path)); fprintf('Installation of robotology packages completed\n'); fprintf('Creating setup script in %s\n', setup_script);