This repository contains example projects for Cgride.
The examples show the intended Cgride project model:
Build C++ with C++.
A Cgride project is described with a cgride.cpp file. The build description is written in C++, not in a custom config format and not in CMake.
examples/
├── hello/
├── static-library/
├── multiple-targets/
└── embedded-api/
You need the cgride command available in your PATH.
Check the installed version:
cgride --versionA minimal executable project.
hello/
├── cgride.cpp
└── src/
└── main.cpp
Build it:
cd hello
cgride buildRun it:
cgride runExpected output:
Hello from Cgride
A project with one library target and one executable target.
static-library/
├── cgride.cpp
├── core/
│ ├── include/
│ │ └── core/
│ │ └── message.hpp
│ └── src/
│ └── message.cpp
└── app/
└── src/
└── main.cpp
Build it:
cd static-library
cgride buildRun it:
cgride runExpected output:
Hello from the Cgride static library example
A project with two executable targets.
multiple-targets/
├── cgride.cpp
├── server/
│ └── src/
│ └── main.cpp
└── worker/
└── src/
└── main.cpp
Build the default target:
cd multiple-targets
cgride buildBuild a specific target:
cgride build --target server
cgride build --target workerRun a specific target:
cgride run --target server
cgride run --target workerExpected output for server:
Hello from the Cgride server target
Expected output for worker:
Hello from the Cgride worker target
A direct C++ API example.
embedded-api/
└── main.cpp
This example shows how another C++ program can use Cgride as a library through the public umbrella header:
#include <cgride/cgride.hpp>It demonstrates the lower-level embedding model behind the CLI.
The normal user-facing examples are hello, static-library, and multiple-targets.
From the repository root:
for dir in hello static-library multiple-targets; do
echo "==> $dir"
cd "$dir"
cgride build
cd ..
doneFrom the repository root:
cd hello
cgride run
cd ..
cd static-library
cgride run
cd ..
cd multiple-targets
cgride run --target server
cgride run --target worker
cd ..The official user-facing Cgride project format is:
project/
├── cgride.cpp
└── src/
└── main.cpp
The cgride.cpp file is real C++ code. It describes the project, targets, sources, include directories, links, and build settings by using the Cgride C++ API.
Cgride does not use these examples to promote multiple project formats.
For these examples:
cgride.cpp official user project description
main.cpp normal C++ source file
cgride command user-facing build and run interface
No cgride.config file is used.
No CMakeLists.txt file is used for the user-facing examples.
The current examples cover:
- one executable target;
- one library target linked into an executable;
- multiple executable targets;
- direct use of the public Cgride C++ API.
These examples are intentionally small.
They are meant to validate the public Cgride shape before larger examples are added.