Skip to main content

dcr.toml

Main project configuration file. Located at the project root.

Structure

[package]
# required fields

[build]
# build settings

[build.debug] # optional: debug override
[build.release] # optional: release override

[build.linux] # optional: Linux override
[build.windows] # optional: Windows override
[build.windows.debug] # target + profile combination

[toolchain]
# compiler/linker paths

[dependencies]
# project dependencies

[workspace]
# multi-package configuration

[run]
# run settings

[archive]
# optional: pack FAT disk image after build

[package]

FieldRequiredDescription
nameyesProject name
versionyesSemantic version of the project
dcr-versionnoSemver of the dcr tool this project targets. Written by dcr new / dcr init to the current tool version.
typenoapp, lib, none (defaults to "none")
licensenoSPDX license identifier
authornoAuthor
[package]
name = "my-app"
version = "0.1.0"
dcr-version = "0.8.4"
type = "app"
license = "MIT"
author = "John Doe"

package.dcr-version

Optional pin of the DCR CLI the project was written for. On every dcr.toml load:

SituationBehaviour
Field missing / emptyWarning: add dcr-version (set by dcr new / dcr init)
Running dcr older than pinWarning: upgrade dcr (dcr --update)
Running dcr newer than pinWarning: review changelog, bump the pin when ready
EqualSilent
Invalid semverWarning once, field ignored

Never fails the command — warnings only. Pre-release suffixes (1.0.0-dev) are ignored for comparison (1.0.0-dev1.0.0).

[build]

...

  • build.qt — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires qt6 modules installed via pkg-config.
FieldDefaultDescription
language"c""c", "c++", "cpp", "cxx", "asm", "llvm_ir", "llvm-ir", "ll" (optional, defaults to "c")
standard"c11"C standard (c11, c17, c23)
cxx_standardC++ standard (c++17, c++20, c++23)
compiler"clang"Preferred compiler (optional, defaults to "clang")
kind"bin"bin, staticlib, sharedlib, efi, elf, none, custom, flat-bin
targethostTarget triple for cross-compilation
platform"native"native, efi
cflags[]Additional C/C++/ASM flags
ldflags[]Additional linker flags
filename""Custom output file name
extension""Custom file extension (for flat-bin, default is bin)
roots["src"]Source roots: directories and/or individual source/header files
exclude[]Exclude patterns
include[]Additional include directories
src_disablefalseDisable auto source discovery
inheritfalseInherit build from workspace root
clean[]Glob patterns for custom clean paths
out_dir""Custom output directory
workspace_onlyfalseWorkspace-only, not built standalone (no language/compiler required)
freestandingfalseCompile in freestanding mode (-ffreestanding + -nostdlib -static)
opt_levelOptimization level: 0-3, "s", "z" (derived from profile if omitted)
debugprofile-basedEmit debug symbols (-g): true in debug, false in release
ltofalseLink-time optimization (-flto for both compiler and linker)
stripfalseStrip symbols from output (-s in ldflags)
warnings[]Warning flags (e.g. "all", "extra", "pedantic"); engine adds -Wall -Wextra in debug if empty
panic""Panic strategy: "abort" disables exceptions and unwind tables
codegen-units""Max parallel compilation jobs ("0" = auto)
qtfalseEnable automatic Qt meta-object handling (MOC, UIC, RCC)

Settings from raw config (not in typed struct):

  • pkg_config — list of pkg-config packages
  • ldscript — linker script path
  • build.steps / build.post_steps — codegen steps

Per-language overrides: [build.c], [build.cxx], [build.asm], [build.llvm_ir]

Each language can have its own table that overrides the flat [build] settings:

[build]
compiler = "clang"
standard = "c11"

[build.c]
standard = "c23"
compiler = "gcc"

[build.cxx]
standard = "c++23"
compiler = "g++"

[build.asm]
compiler = "nasm"
flags = ["-felf64"]

[build.llvm_ir]
compiler = "llc"

The flat [build] acts as fallback; per-language tables take precedence for their language.

Example:

[build]
language = "c++"
standard = "c23"
cxx_standard = "c++23"
compiler = "clang"
kind = "sharedlib"
cflags = ["-Wall", "-Wextra"]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "2"

[toolchain]

[toolchain]
cc = "/usr/bin/clang"
cxx = "/usr/bin/clang++"
as = "/usr/bin/as"
ar = "/usr/bin/ar"
ld = "/usr/bin/ld.lld"

Raw config also supports uic, moc, rcc for Qt codegen.

[dependencies]

See dependencies.

[run]

[run]
cmd = "./target/{profile}/{name}"

Substitutions:

  • {version} — package version
  • {version_major}, {version_minor}, {version_patch}, {version_suffix}, {version_suffix_dash} — version parts
  • {profile} — debug / release
  • {name} — package name

Default cmd = ./target/{profile}/{name} (macOS/Windows) or ./target/<triple>/<profile>/<name> (Linux).

[workspace]

See workspaces.

[archive]

Optional post-build step: format a FAT volume and copy built artifacts into a disk image. Runs after a successful package build (and after workspace member builds that define [archive]).

Requires DCR built with the archive Cargo feature (cargo build --features archive). Release binaries include this feature.

FieldRequiredDescription
outputyesImage path relative to project root ({profile} allowed)
formatyesfat12, fat16, or fat32
sizenoImage size: bytes or K/KB/M/MB/G/GB (default 1474560 ≈ 1.44 MiB)
offsetnoByte offset of the FAT volume inside the image (default 0)
labelnoVolume label (max 11 chars, default VOLUME)
bootsectornoPath to a 512-byte boot sector written at offset 0 when offset is 0 ({profile} allowed)
layoutnoList of { from, to } entries (files or globs → path inside the volume)
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"

[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"

[[archive.layout]]
from = "assets/*"
to = "/"

Typical pairing with kind = "flat-bin" (NASM -f bin) for bootloaders and pure-ASM OS images.

flat-bin (kind)

Produces a raw binary (default extension bin) for boot sectors, kernels, and freestanding payloads.

Assemblers

ToolLanguage / compilerHow flat-bin is produced
NASMlanguage = "asm", compiler = "nasm"-f bin<stem>.bin
FASMcompiler = "fasm"direct write (use format binary in source)
GAScompiler = "as" / "gas"assemble → objcopy -O binary
MASMcompiler = "ml" / "ml64"assemble → objcopy -O binary
LLClanguage = "llvm_ir", compiler = "llc"-filetype=objobjcopy -O binary
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]

C / C++

Compile all sources, link with -nostdlib -static (plus your ldflags / ldscript), then convert the intermediate ELF/PE with objcopy -O binary to <filename|name>.bin.

[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldscript = "linker.ld"
ldflags = ["-T", "linker.ld"]

Notes:

  • Multi-file ASM packages emit one <stem>.bin per source; C/C++ emit a single project binary.
  • objcopy tools tried in order: llvm-objcopy, objcopy, gobjcopy.
  • Incompatible with build.qt = true.
  • dcr run rejects flat-bin (not a host executable).