Build graph, tasks and dependency ordering for Cgride.
Cgride Graph is the task graph module. It represents build work as logical tasks connected by dependencies. It validates graph structure and returns tasks in dependency-first order.
This module provides the graph-level types used by the Cgride engine:
- task identifiers
- task kinds
- task nodes
- task inputs
- task outputs
- task dependencies
- graph validation
- root task detection
- leaf task detection
- topological sorting
Cgride Graph does not execute tasks, spawn processes, inspect the filesystem, decide whether files are dirty, select compilers or generate build commands.
- C++23
- Vix CLI
- Vix.cpp
- Cgride Core
vix build --build-target allvix testsvix build --preset release --build-target allFrom the module directory, use the Vix workflow:
vix buildFor a release build:
vix build --preset releasevix check --testsvix installThe install step exposes the cgride::graph integration target, public headers, and package metadata.
C++ integrations can use the installed module target from their project build configuration.
#include <cgride/graph/graph.hpp>
#include <cgride/graph/topology.hpp>
int main()
{
cgride::graph::Graph graph("app");
auto &prepare = graph.task(
cgride::graph::TaskId::from_string("prepare"),
cgride::graph::TaskKind::Prepare);
auto &compile = graph.task(
cgride::graph::TaskId::from_string("compile:main.cpp"),
cgride::graph::TaskKind::Compile);
auto &link = graph.task(
cgride::graph::TaskId::from_string("link:app"),
cgride::graph::TaskKind::Link);
compile.depends_on(prepare.id());
link.depends_on(compile.id());
auto ordered = cgride::graph::topological_sort(graph);
if (!ordered)
{
return 1;
}
return 0;
}Cgride Graph may depend on:
cgride::core
Cgride Graph may be used by:
cgride::enginecgride::executorcgride::cachecgride::cli- external runtimes
- IDE integrations
- developer tools
Cgride Graph must not depend on:
cgride::projectcgride::toolchainscgride::executorcgride::cachecgride::enginecgride::configcgride::cli
This module stores build dependency structure only.
It should answer:
Which tasks exist?
Which tasks depend on other tasks?
What is the safe dependency-first order?It should not answer:
Which compiler should be used?
Which command should run?
Which task is dirty?
How many workers should execute tasks?
How should terminal output be printed?Those decisions belong to higher-level Cgride modules.
MIT