Building from source
Anvil is C++20, built with CMake and Ninja against the distribution's own libraries: Fedora's, or CachyOS's and Arch's. Nothing is downloaded at build time apart from two git submodules.
Fedora
sudo dnf install cmake ninja-build gcc-c++ git clang-tools-extra libasan libubsan \
doctest-devel opencascade-devel eigen3-devel json-devel \
minizip-ng-devel pugixml-devel zlib-ng-compat-devel \
glfw-devel libglvnd-devel mesa-libGL-devel liberation-sans-fonts
git clone https://git.pandanas.net/Code-Liberation-Front/Anvil.git anvil && cd anvil
git submodule update --init
cmake --preset release
cmake --build --preset release
ctest --preset release
./build/release/bin/anvil
The two submodules are Dear ImGui and SolveSpace's constraint solver. --recursive is not needed: SolveSpace's own submodules belong to its application, and Anvil builds none of them.
What the packages are for:
| Package | Used for |
|---|---|
opencascade-devel |
The geometry kernel: solids, booleans, fillets, tessellation, STEP. Version 7.8 or later. |
glfw-devel, libglvnd-devel, mesa-libGL-devel |
The window and OpenGL 4.5. GLFW 3.4 or later. |
eigen3-devel |
Needed by the vendored sketch solver. |
json-devel |
The .anvil document and the settings files. |
minizip-ng-devel, zlib-ng-compat-devel, pugixml-devel |
The .anvil and 3MF containers. |
doctest-devel |
The test suites. |
libasan, libubsan |
The sanitised debug preset. |
clang-tools-extra |
clang-format, for the format check. |
liberation-sans-fonts |
The font the sketch Text tool draws its outlines from. |
CachyOS and Arch
sudo pacman -S --needed base-devel cmake ninja git clang doctest opencascade eigen \
nlohmann-json minizip-ng pugixml glfw libglvnd mesa ttf-liberation
Then the same steps as on Fedora, from git clone on. The packages are the same libraries under Arch's names: Arch ships headers with the library, so there are no -devel packages; clang holds clang-format; GCC carries the sanitizer runtimes itself; and the font is ttf-liberation. CI builds and tests on CachyOS on every push, with its own compiler, OpenCASCADE and GLFW.
Presets
| Preset | Purpose |
|---|---|
debug-asan |
Debug with ASan + UBSan. What you develop against. |
debug |
Debug without sanitizers. |
relwithdebinfo |
Optimised with symbols, for profiling. |
release |
Optimised. The configuration the budgets are measured against. |
Each preset builds into its own directory under build/, so you can keep several side by side:
cmake --preset debug-asan
cmake --build --preset debug-asan
ctest --preset debug-asan
Anvil's own code is compiled with -Wall -Wextra -Werror, so a warning fails the build.
Tests
ctest runs two suites:
anvil_core_testslinks the core library alone. Every geometry operation is tested here without a window or a GPU.anvil_ui_testsdrives the panels through real interface frames, again with no window.
A third layer drives the real binary. tests/e2e/ holds scripts that model a part through the actual interface (the bracket from Your first part is one), save it, reopen it and export it. The script language is described in docs/automation.md.
The scripts
| Script | What it does |
|---|---|
scripts/ci.sh |
The whole gate, and what CI runs: the format check; debug-asan and release, each built with -Werror and each running both test suites; the end-to-end scripts under Xvfb, with the files they export measured by a script that shares no code with Anvil; and the performance budgets. Run it before pushing. |
scripts/in-container.sh |
Runs a command inside the CI image with the repository mounted, for a machine without the -devel packages: scripts/in-container.sh scripts/ci.sh. |
scripts/format.sh |
Formats Anvil's own sources in place with clang-format. |
scripts/e2e.sh |
Runs every script in tests/e2e/ against a built binary under Xvfb, then checks what they wrote. |
scripts/with-xvfb.sh |
Runs any command against a private X server with software OpenGL and a throwaway settings directory. |
scripts/budgets.sh |
Measures the release build against its budgets (start-up time, memory, idle CPU, rebuild time, installed size), prints a table, and fails if any is over. |
scripts/build-rpm.sh |
Builds the RPM from the commit that is checked out, into build/rpm/. |
scripts/test-rpm.sh |
Installs that RPM in a clean Fedora container, as dnf install would, and proves the installed application runs. |
scripts/build-arch.sh |
Builds the pacman package from the commit that is checked out, into build/arch/. On a system without makepkg it builds in a CachyOS container. |
scripts/test-arch.sh |
Installs that package in a clean CachyOS container, as pacman -U would, and proves the installed application runs. |
scripts/flatpak-build.sh |
Builds the Flatpak from packaging/flatpak/, installs it and runs it; it needs a privileged container. |
Without the toolchain installed
scripts/in-container.sh uses the image described by ci/Dockerfile. Build it once:
podman build -f ci/Dockerfile -t anvil-ci:dev ci
scripts/in-container.sh scripts/ci.sh
scripts/in-container.sh cmake --build --preset release
Running headless
The end-to-end scripts and the screenshots in this guide are made without a display. Xvfb with Mesa's software renderer provides the OpenGL 4.5 context Anvil needs:
sudo dnf install xorg-x11-server-Xvfb mesa-dri-drivers # Fedora
sudo pacman -S --needed xorg-server-xvfb xorg-xauth mesa # CachyOS, Arch
OUT=$PWD/out scripts/with-xvfb.sh build/release/bin/anvil --script tests/e2e/bracket.script
Packaging
packaging/ holds the RPM spec, the pacman PKGBUILD (packaging/arch/), the desktop entry, the .anvil MIME type, the AppStream data and the Flatpak manifest. scripts/build-rpm.sh and scripts/build-arch.sh package the checked-out commit, not the working tree, so commit first; both build from the same source tarball (scripts/source-tarball.sh). See Installation for installing the result.
How the source is laid out
core/ a static library: no OpenGL, no ImGui, no window
base/ math, Result, logging, ids
document/ expressions, parameters, the feature tree, commands and undo
sketch/ 2D entities, constraints, the solver behind ISketchSolver
features/ one class per feature
kernel/ the only place OpenCASCADE headers are included
analysis/ manifold, wall thickness, overhang, measure
io/ .anvil, JSON, STL, 3MF, STEP, PNG
ui/ the executable
app/ window, main loop, session, settings, the script driver
commands/ the command registry and the toolbar layout
render/ GL loader, camera, grid, build plate, meshes, picking
panels/ theme, docked panels, dialogs, sketch view, view cube
tests/ core/, ui/ and e2e/
packaging/ RPM spec, PKGBUILD, desktop entry, MIME type, AppStream data, Flatpak manifest
docs/ file format, naming scheme, script language, this guide's source
Two rules shape it. core/ must be testable without a GPU or a window, and OpenCASCADE types never leave core/kernel/. Every change to a document is a command on the undo stack.
Further reading in the repository
| File | About |
|---|---|
docs/file-format.md |
The .anvil container. |
docs/topological-naming.md |
How a fillet finds its edge again after a rebuild. |
docs/automation.md |
The script language used by the end-to-end tests. |
CLAUDE.md |
The brief the application was built to. |
PROGRESS.md |
What is built, what is deferred, and what still needs a person. |
This guide's own source is in docs/wiki/. The Keyboard shortcuts page is generated by scripts/wiki-shortcuts.py from the toolbar layout, and scripts/ci.sh fails if the two disagree.
Licence
GPL-3.0-or-later. Anvil links OpenCASCADE (LGPL-2.1 with an exception) and vendors Dear ImGui (MIT) and SolveSpace's solver (GPL-3.0-or-later).
- Home
- Getting started
- Sketching
- Modelling
- Files
- Printing
- Working with an AI assistant
- Reference
Written for Anvil 0.2.0. Units are millimetres. Repository · Issue tracker