SC::Build describes a C++ build in C++ and can either execute it directly or generate projects for another build system. This guide explains that model and the shortest useful workflow.
An SC-build.cpp file is an executable build description. The repository launcher compiles it when needed, asks it to create a graph of workspaces, projects, configurations, and files, then hands that graph to a backend.
The pipeline has three stages: the launcher compiles a stale SC-build.cpp, the definition creates the project graph, and the selected backend consumes that graph. The native backend compiles and links immediately; generated backends write Xcode, Visual Studio, or Make projects for another tool to build.
This is why changing build logic does not require a separate scripting language or installed package manager. The build description uses the same compiler, result handling, strings, paths, and process APIs as the rest of Sane C++.
From the SaneCppLibraries repository root, compile a target first and then run the produced executable:
Use SC.bat on Windows. build run brings stale target inputs up to date before launching the executable. Contributor and test workflows still use an explicit compile step first because it makes build failures and program failures easy to distinguish.
The native backend is the default on macOS, Linux, and Windows. It writes intermediates and outputs below _Build without requiring generated project files.
A small external definition has three jobs: name the target, add its source, and add Sane C++ Libraries.
The important types form a hierarchy:
Definition owns the complete build graph.Workspace groups related projects. A simple definition can use the implicit default workspace.Project names an output and collects source files, include paths, dependencies, and link settings.Configuration changes settings for builds such as Debug and Release.Settings can be attached at project, configuration, or file-group level. Start at project level and move a setting deeper only when a target genuinely needs a different value.
Use the native backend for normal command-line development:
Generate projects when the project file is itself useful, for example to work inside Xcode or Visual Studio:
Generated files live under _Build/_Projects. Native and generated outputs live under _Build/_Outputs, separated by platform, architecture, backend, compiler, and configuration. These directories are disposable build products.
addSaneCppLibraries(project, parameters) adds the unity-build SC.cpp form. It is the simplest option for most programs because the library set becomes one compilation unit.
To compile the individual library sources instead:
Both forms add the public Includes directory, so target sources include library entry points such as SaneCppStrings.h rather than repository-internal paths.
Cross compilation is easier to reason about when three concerns stay separate:
--target selects the destination platform and ABI profile.--toolchain selects the compiler family when the profile does not already imply one.--runner selects how a foreign executable is launched, if it can be launched on the host.For example:
Package-managed compilers, sysroots, and runners are installed through SC::Package. Not every host and target pair has the same build or run support. Use the command help for the current matrix:
Tools/SC-build/Build.h when you need the exact public API.Tools/SC-build.cpp for the build graph used by this repository.