Documentation

Build profiles

Profiles allow overriding [build] fields for specific build modes.

Configuration

Editor
[build]
language = "c"
standard = "c17"
cflags = ["-Wall"]

[build.debug]
cflags = ["-O0", "-g"]

[build.release]
cflags = ["-O3", "-DNDEBUG"]

Merge rules

Fields from [build.<profile>] are merged on top of [build]:

  • Scalar fields (strings, numbers, bools) — replaced
  • Arrays (cflags, ldflags, …) — appended (extend the [build] array)

Set inherit = false to disable array inheritance (only profile’s own arrays are used).

Built-in profiles

The default flags for each profile are composed from three config fields:

Field debug default release default
opt_level "0" "3"
debug true false
warnings ["all", "extra"] []

Which produce the equivalent compiler flags:

Profile Effective flags
debug -O0 -g -Wall -Wextra -fno-omit-frame-pointer -DDCR_DEBUG
release -O3 -DNDEBUG

Additional build options can be toggled per-profile:

Editor
[build.release]
opt_level = "z"
lto = true
strip = true
panic = "abort"
codegen-units = "1"

[build.debug]
opt_level = "1"
debug = false
warnings = ["all", "error"]

Target-specific profiles

Editor
[build.linux]
cflags = ["-DLINUX"]

[build.windows.debug]
cflags = ["-DWIN32", "-O0", "-g"]

Short OS names (linux, macos, windows, …) are aliases for the canonical target triple. [build.windows] and [build.x86_64-pc-windows-msvc] are equivalent; if both are present, the full triple wins.

Application order (highest priority first):

  1. [build.<target>.<profile>]
  2. [build.<profile>.<target>]
  3. [build.<target>]
  4. the same three keys with a short OS name ([build.linux.<profile>], [build.<profile>.linux], [build.linux])
  5. [build.<profile>]
  6. [build]