Documentation

Multi-package workspace

A project with three packages: two libraries and a binary.

Structure

Editor
workspace/
├── dcr.toml              # root workspace
├── lib-core/
│   ├── dcr.toml
│   └── src/core.c
├── lib-utils/
│   ├── dcr.toml
│   └── src/utils.c
└── app/
    ├── dcr.toml
    └── src/main.c

Root dcr.toml

Editor
[package]
name = "my-workspace"
version = "0.1.0"
type = "none"

[build]
inherit = true
language = "c"
standard = "c11"
workspace_only = true

[workspace.lib-core]
path = "lib-core"

[workspace.lib-utils]
path = "lib-utils"
deps = ["lib-core"]

[workspace.app]
path = "app"
deps = ["lib-core", "lib-utils"]
main = true

Packages

lib-core/dcr.toml:

Editor
[package]
name = "lib-core"
version = "0.1.0"
type = "none"

[build]
kind = "staticlib"

lib-utils/dcr.toml:

Editor
[package]
name = "lib-utils"
version = "0.1.0"
type = "none"

[build]
kind = "staticlib"

app/dcr.toml:

Editor
[package]
name = "app"
version = "0.1.0"
type = "none"

[build]
kind = "bin"

Build

Terminal
cd workspace
dcr build                     # builds everything in correct order
dcr build --workspace app     # only app (lib-core and lib-utils built as deps)
dcr run                       # builds and runs main package

Build order (topological sort):

  1. lib-core
  2. lib-utils (depends on lib-core)
  3. app (depends on lib-core, lib-utils)