Dependencies
Formats
The [dependencies] section supports three formats:
String (registry)
[dependencies]
fmt = "10.1.1"
spdlog = "1.12"
catch2 = "3.4.0"
The version string is used as-is for registry lookup.
Table (git)
[dependencies]
fmt = { git = "https://github.com/fmtlib/fmt", tag = "10.1.1" }
Fields: git, branch, tag, rev.
Table (path)
[dependencies]
mylib = { path = "../mylib" }
Registry
DCR uses a package registry for dependency lookup by name.
# ~/.dcr/config.toml
[[registry]]
name = "default"
url = "https://index.dcr.pm"
Registry priority: order in config.toml. The DCR_INDEX_PATH variable overrides the path to index.json.
Git dependencies
DCR clones git repositories via git2:
branch— switch to a branchtag— switch to a tagrev— switch to a specific commitfeatures— feature flags (parsed, but does not affect build)
Cache path: ~/.dcr/git/<hash>/.
Path dependencies
Local paths. DCR automatically discovers include and lib directories from the neighbor's dcr.toml.
[dependencies]
mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" }
dcr.lock
Dependency lock file. Contains package names and sources.
Created during dcr build when registry dependencies are present. Not updated during dcr add — only on the next dcr build.
Resolution process
- Load all dependencies (registry → git → path)
- For path deps: recursively read their
dcr.toml - For registry deps: search
index.json - For git deps: clone to cache
- Collect
include_dirs,lib_dirs,libsfor the compiler