dcr 0.7.2

DCR is a utility for managing C/C++ projects in a Cargo-like style.
---
sidebar_label: dcr.toml overview
---

# dcr.toml

Main project configuration file. Located at the project root.

## Structure

```toml
[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
```

## [package]

| Field | Required | Description |
|-------|----------|-------------|
| `name` | yes | Project name |
| `version` | yes | Semantic version |
| `type` | yes | `app`, `lib`, `none` |
| `license` | no | SPDX license identifier |
| `author` | no | Author |

```toml
[package]
name = "my-app"
version = "0.1.0"
type = "app"
license = "MIT"
author = "John Doe"
```

## [build]

| Field | Default | Description |
|-------|---------|-------------|
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | `"c++20"` | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
| `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi`, `freestanding` |
| `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension |
| `roots` | `["src"]` | Source root directories |
| `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery |
| `inherit` | `false` | Inherit build from workspace root |
| `clean` | `[]` | Glob patterns for custom clean paths |
| `out_dir` | `""` | Custom output directory |
| `workspace_only` | `false` | Workspace-only, not built standalone |

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

Example:

```toml
[build]
language = "c++"
standard = "c23"
cxx_standard = "c++23"
compiler = "clang"
kind = "sharedlib"
cflags = ["-Wall", "-Wextra"]
```

## [toolchain]

```toml
[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](/docs/reference/dependencies).

## [run]

```toml
[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](/docs/reference/workspaces).