# robotology/robotology-superbuild architecture

> Architecture diagram of the GitHub repository robotology/robotology-superbuild, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robotology/robotology-superbuild
- Repository: https://github.com/robotology/robotology-superbuild

## Overview

##### Project Type and Purpose
- This is a “superbuild” meta-repository (robotology-superbuild) whose sole responsibility is to orchestrate the download, configuration, compilation, testing, and packaging of dozens of Robotology-related C++/Matlab/Python projects.
- It uses CMake (with the YCM modules) as the build orchestrator, supports multiple dependency providers (apt, conda-forge, pixi, deprecated vcpkg), and offers binary packaging (conda recipes, Windows installers, Docker images).

##### File Structure Analysis
- Top-level:
- .ci, .github/workflows, scripts – CI pipelines & helper scripts
- cmake/… – dozens of per-package “BuildFoo.cmake” modules + superbuild logic
- conda/… – conda-forge recipe generation & multishell activation scripts
- packaging/windows/… – Windows installer build scripts
- doc/… – user & developer documentation
- releases/… – YAML lists of package versions for each quarterly release
- Key patterns:
- “ExternalProject” / FetchContent per subproject (each Build*.cmake)
- Profile-based enable/disable of subsets (via CMake options)
- Dependency-provider abstraction (apt vs conda vs pixi vs vcpkg)
- Multi-platform CI via GitHub Actions building Docker, conda packages, Windows binaries

##### README Insights
- Core concept: a CMake superbuild that pulls in each Robotology component into src/<name>, builds in build/src/<name>, installs into build/install.
- Supports “rolling update” vs “frozen releases” (profiles & tags)
- Binary distribution via conda-forge & robotology channels
- Source installation on Linux/macOS/Windows (apt or conda or pixi) or WSL

##### Components
a. Build Orchestrator Layer
- Main CMakeLists.txt + YCM modules (RobotologySuperbuildLogic, Options, Bootstrap)
- Per-package Build*.cmake scripts (in cmake/)
b. Dependency Providers
- apt installer (scripts/install_*.sh + apt.txt)
- Conda recipe generator (conda/cmake → CondaGenerationOptions, recipe templates)
- pixi (pixi.toml, pixi.lock, pixi activation scripts)
- Deprecated vcpkg path (doc/deprecated-installation-methods.md)
c. Subprojects (External Projects)
- YARP, iCub, iDynTree, CasADi, Gazebo-YARP-Plugins, human‐dynamics,…
- Each fetches source into src/<name>, builds into build/src/<name>
d. Build Artifacts & Installation
- build/install (final prefix) → setup.sh / setup.bat sets environment vars
- packaging outputs: conda packages, Docker images, Windows installer
e. CI/CD Layer
- GitHub Actions workflows (ci.yml, build-docker-images.yml, generate-conda-packages.yml, release.yml)
- scripts to bump versions, update locks, generate packages

##### Relationships & Data Flows
- Build Orchestrator → Subprojects (fetch & build)
- Subprojects → install prefix (artifacts flow)
- install prefix → packaging modules → binary outputs (conda recipes, installers, Docker)
- CI pipelines consume: source repo + packaging logic → produce build artifacts, run tests, publish releases

##### Architectural Patterns & Principles
- Modular ExternalProject pattern: each package is an isolated CMake ExternalProject via Build*.cmake
- Profile-driven inclusion/exclusion: high configurability via CMake options
- Separation of concerns: build orchestration, dependency acquisition, packaging, CI all clearly layered
- Reuse: common YCM modules for fetching, tagging, developer-mode, update targets

##### Technologies & Frameworks
- CMake (≥3.19) + YCM
- ExternalProject / FetchContent
- apt, conda-forge, pixi, vcpkg
- GitHub Actions
- Docker
- scripts (bash/PowerShell)

##### Essential Elements
- Installation prefix (“build/install”) feeding “setup scripts”
- Packaging modules → outputs (conda packages, installers, Docker images)
- CI/CD layer at top driving all stages

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% CI/CD Layer
    subgraph "CI/CD Layer"
        direction TB
        CI_CI["ci.yml"]:::ci
        CI_CondaGen["generate-conda-packages.yaml"]:::ci
        CI_NonPeriodical["generate-non-periodical-conda-package.yaml"]:::ci
        CI_Release["release.yml"]:::ci
        CI_UpdateLatest["update-latest-releases.yml"]:::ci
        CI_CI --> CI_CondaGen
        CI_CondaGen --> CI_NonPeriodical
        CI_NonPeriodical --> CI_Release
        CI_Release --> CI_UpdateLatest
    end

    %% Dependency Providers
    subgraph "Dependency Providers"
        direction TB
        DP_Apt["apt (apt.txt, scripts/install_apt_dependencies.sh)"]:::dep
        DP_Conda["conda (recipe generator)"]:::dep
        DP_Pixi["pixi (pixi.toml, pixi.lock)"]:::dep
        DP_Vcpkg["vcpkg (deprecated)"]:::dep
    end

    %% Build Orchestrator Layer
    subgraph "Build Orchestrator" 
        direction TB
        Orchestrator["robotology-superbuild (CMakeLists.txt)"]:::orch
        YCM_Logic["RobotologySuperbuildLogic.cmake"]:::orch
        YCM_Options["RobotologySuperbuildOptions.cmake"]:::orch
        YCM_Bootstrap["YCMBootstrapFetch.cmake"]:::orch
        YCM_LoadVcs["YCMLoadVcsYamlInfo.cmake"]:::orch
        subgraph "Per-Package Scripts"
            direction TB
            BP_YARP["BuildYARP.cmake"]:::orch
            BP_IDY["BuildiDynTree.cmake"]:::orch
            BP_ICUB["BuildICUB.cmake"]:::orch
            BP_CAS["Buildcasadi.cmake"]:::orch
        end
    end

    %% Subprojects
    subgraph "Subprojects (ExternalProject)"
        direction TB
        SP_YARP["YARP"]:::sub
        SP_IDY["iDynTree"]:::sub
        SP_ICUB["iCub"]:::sub
        SP_CAS["CasADi"]:::sub
        SP_GZ["Gazebo-YARP-Plugins"]:::sub
        SP_HD["HumanDynamicsEstimation"]:::sub
    end

    %% Installation Prefix
    Install["build/install\n(setup.sh / setup.bat)"]:::orch

    %% Packaging & Distribution
    subgraph "Packaging & Distribution"
        direction TB
        PK_Conda["Conda Packages"]:::pack
        PK_WinInst["Windows Installer"]:::pack
        PK_Docker["Docker Images"]:::pack
    end

    %% Relationships
    CI_UpdateLatest --> Orchestrator
    DP_Apt --> Orchestrator
    DP_Conda --> Orchestrator
    DP_Pixi --> Orchestrator
    DP_Vcpkg --> Orchestrator
    Orchestrator --> SP_YARP
    Orchestrator --> SP_IDY
    Orchestrator --> SP_ICUB
    Orchestrator --> SP_CAS
    Orchestrator --> SP_GZ
    Orchestrator --> SP_HD
    SP_YARP --> Install
    SP_IDY --> Install
    SP_ICUB --> Install
    SP_CAS --> Install
    SP_GZ --> Install
    SP_HD --> Install
    Install --> PK_Conda
    Install --> PK_WinInst
    Install --> PK_Docker

    %% Click Events - Build Orchestrator
    click Orchestrator "https://github.com/robotology/robotology-superbuild/blob/master/CMakeLists.txt"
    click YCM_Logic "https://github.com/robotology/robotology-superbuild/blob/master/cmake/RobotologySuperbuildLogic.cmake"
    click YCM_Options "https://github.com/robotology/robotology-superbuild/blob/master/cmake/RobotologySuperbuildOptions.cmake"
    click YCM_Bootstrap "https://github.com/robotology/robotology-superbuild/blob/master/cmake/YCMBootstrapFetch.cmake"
    click YCM_LoadVcs "https://github.com/robotology/robotology-superbuild/blob/master/cmake/YCMLoadVcsYamlInfo.cmake"
    click BP_YARP "https://github.com/robotology/robotology-superbuild/blob/master/cmake/BuildYARP.cmake"
    click BP_IDY "https://github.com/robotology/robotology-superbuild/blob/master/cmake/BuildiDynTree.cmake"
    click BP_ICUB "https://github.com/robotology/robotology-superbuild/blob/master/cmake/BuildICUB.cmake"
    click BP_CAS "https://github.com/robotology/robotology-superbuild/blob/master/cmake/Buildcasadi.cmake"

    %% Click Events - Dependency Providers
    click DP_Apt "https://github.com/robotology/robotology-superbuild/blob/master/apt.txt"
    click DP_Apt "https://github.com/robotology/robotology-superbuild/blob/master/scripts/install_apt_dependencies.sh"
    click DP_Conda "https://github.com/robotology/robotology-superbuild/blob/master/conda/cmake/RobotologySuperbuildGenerateCondaRecipes.cmake"
    click DP_Conda "https://github.com/robotology/robotology-superbuild/blob/master/conda/cmake/CondaGenerationOptions.cmake"
    click DP_Conda "https://github.com/robotology/robotology-superbuild/blob/master/conda/conda_build_config.yml"
    click DP_Conda "https://github.com/robotology/robotology-superbuild/blob/master/conda/cmake_recipe_template/recipe.yaml"
    click DP_Pixi "https://github.com/robotology/robotology-superbuild/blob/master/pixi.toml"
    click DP_Pixi "https://github.com/robotology/robotology-superbuild/blob/master/pixi.lock"
    click DP_Pixi "https://github.com/robotology/robotology-superbuild/blob/master/pixi_activation.sh"
    click DP_Pixi "https://github.com/robotology/robotology-superbuild/blob/master/.github/workflows/pixi-ci.yml"
    click DP_Vcpkg "https://github.com/robotology/robotology-superbuild/blob/master/doc/deprecated-installation-methods.md"

    %% Click Events - CI/CD
    click CI_CI "https://github.com/robotology/robotology-superbuild/blob/master/.github/workflows/ci.yml"
    click CI_CondaGen "https://github.com/robotology/robotology-superbuild/blob/master/.github/workflows/generate-conda-packages.yaml"
    click CI_NonPeriodical "https://github.com/robotology/robotology-superbuild/blob/master/.github/workflows/generate-non-periodical-conda-package.yaml"
    click CI_Release "https://github.com/robotology/robotology-superbuild/blob/master/.github/workflows/release.yml"
    click CI_UpdateLatest "https://github.com/robotology/robotology-superbuild/blob/master/.github/workflows/update-latest-releases.yml"

    %% Click Events - Packaging
    click PK_WinInst "https://github.com/robotology/robotology-superbuild/blob/master/packaging/windows/CMakeLists.txt"
    click PK_WinInst "https://github.com/robotology/robotology-superbuild/blob/master/packaging/windows/scripts/setup.bat"
    click PK_WinInst "https://github.com/robotology/robotology-superbuild/blob/master/packaging/windows/scripts/setup.sh"
    click PK_WinInst "https://github.com/robotology/robotology-superbuild/blob/master/packaging/windows/scripts/addPathsToUserEnvVariables.ps1"
    click PK_WinInst "https://github.com/robotology/robotology-superbuild/blob/master/packaging/windows/scripts/removePathsFromUserEnvVariables.ps1"
    click PK_Docker "https://github.com/robotology/robotology-superbuild/blob/master/.github/workflows/build-docker-images.yml"

    %% Styles
    classDef orch fill:#CCFFCC,stroke:#009900
    classDef sub fill:#CCE5FF,stroke:#0055CC
    classDef dep fill:#FFD9A6,stroke:#FF8800
    classDef pack fill:#E5CCFF,stroke:#8000FF
    classDef ci fill:#DDDDDD,stroke:#888888
    class Orchestrator,YCM_Logic,YCM_Options,YCM_Bootstrap,YCM_LoadVcs,BP_YARP,BP_IDY,BP_ICUB,BP_CAS orch
    class SP_YARP,SP_IDY,SP_ICUB,SP_CAS,SP_GZ,SP_HD sub
    class DP_Apt,DP_Conda,DP_Pixi,DP_Vcpkg dep
    class PK_Conda,PK_WinInst,PK_Docker pack
    class CI_CI,CI_CondaGen,CI_NonPeriodical,CI_Release,CI_UpdateLatest ci
```
