Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 5.5 KB

conda-recipe-generation.md

File metadata and controls

71 lines (50 loc) · 5.5 KB

Conda Recipe Generation

Rationale

See the documentation on conda-forge and the robotology-superbuild for a general discussion on how the robotology-superbuild and conda can work together.

This document describes how to the internal machinery used to generate the conda recipes and then build conda binaries. If you just want to compile the robotology-superbuild from source using conda-forge dependendencies of you just want to install conda binary packages from the robotology conda channel, you do not need to read this document, as the information in the documentation on conda-forge and the robotology-superbuild should be enough.

How to generate recipes

To generate the conda recipes for a given configuration of the robotology-superbuild, configure the robotology-superbuild in a conda workspace (TODO: docs on this, for now check the GitHub Action CI). As the conda recipes are intendend to build release version of software, specify an option to get a specific release.

After that, install the additional dependencies required for the recipe generation:

conda install pyyaml jinja2 conda-build ninja anaconda-client conda-forge-pinning
python -m pip install git+https://github.com/wolfv/multisheller.git@0cc03c68d0c68d2f9cf7b07ddb68afa531419a6d

Then, set the ROBOTOLOGY_GENERATE_CONDA_RECIPES CMake option to ON in the robotology-superbuild build. This will deactivate the usual logic for building projects of the robotology-superbuild, and instead will generate (at CMake configure time) conda recipes in <build_dir>/conda/generated_recipes for all the projects of the superbuild. If the configuration was concluded correctly, i.e. CMake configuration ended with:

-- To build the generated conda recipes, navigate to the directory and run conda build . in it.
-- Configuring done
-- Generating done
-- Build files have been written to: C:/src/robotology-superbuild/build-conda

you can then build the generated recipes. To build the generate recipes, you can move in the <build_dir>/conda/generated_recipes directory and run the appropriate build command using conda build :

cd <build_dir>/conda/generated_recipes
conda build -m ${CONDA_PREFIX}/conda_build_config.yaml -m <src_dir>/conda/conda_build_config.yml .

The -m option specifies the additional build configuration files that are used for conda-build. In particular, we use two conda_build_config files. The first one is the standard one of conda-forge, installed via the conda-forge-pinning package, and that is used to ensure compatibility with conda-forge binaries. The second is a local file, that is used to specify setting specific to the robotology channel.

Note that the generated recipes will depend on the specific configuration of the robotology-superbuild used, so enabling additional profiles will generate recipes for the packages contained in those profiles. For this reason, the generated recipes in general are not cross-platform. For example the recipes generated on Linux could contain Linux-specific CMake options passed to the projects, so may not be usable on Windows. If you want to obtain recipe that can be built on a given operating system, please generate them with the robotology-superbuild on that operating system.

Internals

All the files necessary to generate the conda recipes are contained in the conda directory of the root source dir.

In particular:

conda/cmake/RobotologySuperbuildGenerateCondaRecipes.cmake

This CMake scripts contain the logic to generate the recipes. The generation is articulated as follows.

The cmake/RobotologySuperbuildLogic.cmake file, that contains the logic of which projects should be built, is run after redefining the ycm_ep_helper and find_or_build_package YCM functions, to extract the informations on name, versions, dependency and cmake options of subpackages. This information are combined with the conda-specific metadata specified in conda/cmake/CondaGenerationOptions.cmake (that contains information such as conda dependencies external to the robotology-superbuild) to generate the <build_dir>/conda/robotology-superbuild-conda-metametadata.yaml file.

After that, the data in <build_dir>/conda/robotology-superbuild-conda-metametadata.yaml is used via the conda/python/generate_conda_recipes_from_metametadata.py python script to generate the conda recipes.

conda/recipe_template

This directory contains Jinja2 templates for the files meta.yaml, bld.bat and build.sh that will be part of each generated recipe.

conda/python/generate_conda_recipes_from_metametadata.py

Python script that takes the metametadata file generated by the generate_metametadata_file CMake macro, and uses it to configure the Jinja2 templates conda/recipe_template to generate the recipe for each specific package.

Additional (Non Periodical) Recipes

On the top of the recipes generated by the robotology-superbuild metadata, the conda/non_periodical_recipes contains some recipes that are uploaded to the robotology channel in a non periodic way. This recipes are not generated every week as the one from robotology-superbuild ordinary step and they are not generated, but their generation is triggered manually by the generate-non-periodic-conda-packages.yaml GitHub Actions job.