mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 08:58:35 +00:00
Compare commits
36 Commits
0e2d05788a
...
e72bc4e778
| Author | SHA1 | Date | |
|---|---|---|---|
| e72bc4e778 | |||
| 57cff02e58 | |||
| 6157f1d860 | |||
| 4868b5d0d0 | |||
| 2dc80ea281 | |||
| 80ec220477 | |||
| 7dc8d77e19 | |||
| aaba0d4f3d | |||
| f7bb1fee0f | |||
| 2d182e7259 | |||
| 02872886fd | |||
| a8538fe408 | |||
| 140dbe9469 | |||
| 7d23753199 | |||
| bdf4c0baee | |||
| 09dbd7f8e2 | |||
| 78151ff0de | |||
| 66797c2265 | |||
| b07ca1c0ac | |||
| 8ff841f2f5 | |||
| 54849b2c43 | |||
| 8dae42f8ea | |||
| 8edb16f1e4 | |||
| 6704c96b30 | |||
| 02ad12a902 | |||
| c7d5d135ca | |||
| 8998d19bce | |||
| d42eeee0ff | |||
| ba408c3dcc | |||
| 98068b54f7 | |||
| 5770d69128 | |||
| 80fc509997 | |||
| 05f16fc6b4 | |||
| e63175549c | |||
| 525bd52f8b | |||
| 9f97202121 |
@@ -12,8 +12,13 @@ Only ASCII letters, digits, underscores `_` and hyphens `-` are allowed in the p
|
||||
|
||||
```bash
|
||||
dcr new my-app
|
||||
dcr new my-app --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
Generates:
|
||||
|
||||
* `dcr.toml` with basic fields
|
||||
@@ -24,8 +29,12 @@ Generates:
|
||||
Initializes a DCR project in the current (empty) directory.
|
||||
|
||||
```bash
|
||||
mkdir app && cd app
|
||||
dcr init
|
||||
dcr init --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
The project name is taken from the current directory name. The directory name must follow the same naming rules as `dcr new`.
|
||||
|
||||
@@ -15,9 +15,9 @@ dcr setup
|
||||
If `~/.dcr/config.toml` is not found, DCR returns an error. Create it manually:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
## `dcr --help`
|
||||
|
||||
@@ -13,9 +13,9 @@ error: registry not found
|
||||
**Solution:** Make sure `~/.dcr/config.toml` exists:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
And check `DCR_INDEX_PATH`:
|
||||
|
||||
@@ -103,7 +103,7 @@ man dcr-build
|
||||
To use the registry, create `~/.dcr/config.toml`:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
@@ -10,36 +10,23 @@ DCR itself is [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later.html
|
||||
|
||||
> **Note:** DCR is a build tool, not a library. The GPL applies only to DCR's own source code. Projects built with DCR are not subject to DCR's license — their licensing is determined solely by their own code and dependencies.
|
||||
|
||||
## Vendored libraries
|
||||
|
||||
DCR statically links the following C libraries through its vendored Rust dependencies:
|
||||
|
||||
| Library | License | Bundled by |
|
||||
| ------------------------------------------ | ------------------ | ----------------------------- |
|
||||
| [libgit2](https://libgit2.org) | MIT OR Apache-2.0 | `git2` / `libgit2-sys` |
|
||||
| [libssh2](https://libssh2.org) | MIT OR Apache-2.0 | `libgit2-sys` |
|
||||
| [zlib](https://zlib.net) | MIT OR Apache-2.0 | `libgit2-sys` |
|
||||
| [OpenSSL](https://openssl.org) | Apache-2.0 | `openssl-sys` / `openssl-src` |
|
||||
| [ring](https://github.com/briansmith/ring) | Apache-2.0 AND ISC | `rustls` |
|
||||
|
||||
## Rust dependencies
|
||||
|
||||
DCR is written in Rust. The following notable Rust crates are statically linked:
|
||||
|
||||
| Crate | License |
|
||||
| --------------------------------------------- | ------------------------ |
|
||||
| [`reqwest`](https://crates.io/crates/reqwest) | MIT OR Apache-2.0 |
|
||||
| [`rustls`](https://crates.io/crates/rustls) | Apache-2.0 OR ISC OR MIT |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
|
||||
| [`git2`](https://crates.io/crates/git2) | MIT OR Apache-2.0 |
|
||||
| [`openssl`](https://crates.io/crates/openssl) | Apache-2.0 |
|
||||
| [`tokio`](https://crates.io/crates/tokio) | MIT |
|
||||
| [`hyper`](https://crates.io/crates/hyper) | MIT |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
|
||||
| Crate | License |
|
||||
| ------------------------------------------------------- | ----------------- |
|
||||
| [`ureq`](https://crates.io/crates/ureq) | MIT OR Apache-2.0 |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
|
||||
| [`toml_edit`](https://crates.io/crates/toml_edit) | MIT OR Apache-2.0 |
|
||||
| [`serde_json`](https://crates.io/crates/serde_json) | MIT OR Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
|
||||
| [`glob`](https://crates.io/crates/glob) | MIT OR Apache-2.0 |
|
||||
| [`self-replace`](https://crates.io/crates/self-replace) | MIT OR Apache-2.0 |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
|
||||
|
||||
Full dependency tree (143 packages) is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
|
||||
Full dependency tree is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
|
||||
|
||||
## Additional credits
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ type = "none"
|
||||
inherit = true
|
||||
language = "c"
|
||||
standard = "c11"
|
||||
workspace_only = true
|
||||
|
||||
[workspace.lib-core]
|
||||
path = "lib-core"
|
||||
|
||||
@@ -37,13 +37,13 @@ Main project configuration file. Located at the project root.
|
||||
|
||||
## [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 |
|
||||
| Field | Required | Description |
|
||||
| --------- | -------- | ------------------------------------------- |
|
||||
| `name` | yes | Project name |
|
||||
| `version` | yes | Semantic version |
|
||||
| `type` | no | `app`, `lib`, `none` (defaults to `"none"`) |
|
||||
| `license` | no | SPDX license identifier |
|
||||
| `author` | no | Author |
|
||||
|
||||
```toml
|
||||
[package]
|
||||
@@ -60,36 +60,36 @@ author = "John Doe"
|
||||
|
||||
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
|
||||
|
||||
| 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` |
|
||||
| `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 |
|
||||
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` |
|
||||
| `debug` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) |
|
||||
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
|
||||
| `strip` | `false` | Strip symbols from output (`-s` in ldflags) |
|
||||
| `warnings` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) |
|
||||
| `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables |
|
||||
| `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) |
|
||||
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
|
||||
| Field | Default | Description |
|
||||
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) |
|
||||
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
|
||||
| `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) |
|
||||
| `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) |
|
||||
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
|
||||
| `target` | host | Target 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 |
|
||||
| `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 (no `language`/`compiler` required) |
|
||||
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | — | Optimization level: `0`-`3`, `"s"`, `"z"` (derived from profile if omitted) |
|
||||
| `debug` | profile-based | Emit debug symbols (`-g`): `true` in debug, `false` in release |
|
||||
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
|
||||
| `strip` | `false` | Strip 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) |
|
||||
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
|
||||
|
||||
Settings from raw config (not in typed struct):
|
||||
|
||||
@@ -97,6 +97,30 @@ Settings from raw config (not in typed struct):
|
||||
* `ldscript` — linker script path
|
||||
* `build.steps` / `build.post_steps` — codegen steps
|
||||
|
||||
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`
|
||||
|
||||
Each language can have its own table that overrides the flat `[build]` settings:
|
||||
|
||||
```toml
|
||||
[build]
|
||||
compiler = "clang"
|
||||
standard = "c11"
|
||||
|
||||
[build.c]
|
||||
standard = "c23"
|
||||
compiler = "gcc"
|
||||
|
||||
[build.cxx]
|
||||
standard = "c++23"
|
||||
compiler = "g++"
|
||||
|
||||
[build.asm]
|
||||
compiler = "nasm"
|
||||
flags = ["-felf64"]
|
||||
```
|
||||
|
||||
The flat `[build]` acts as fallback; per-language tables take precedence for their language.
|
||||
|
||||
Example:
|
||||
|
||||
```toml
|
||||
|
||||
@@ -41,24 +41,22 @@ DCR uses a package registry for dependency lookup by name.
|
||||
|
||||
```toml
|
||||
# ~/.dcr/config.toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
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`:
|
||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
||||
|
||||
* `branch` — switch to a branch
|
||||
* `tag` — switch to a tag
|
||||
* `rev` — switch to a specific commit
|
||||
* `features` — 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`.
|
||||
|
||||
@@ -65,3 +65,21 @@ standard = "c17"
|
||||
|
||||
# member inherits language and standard
|
||||
```
|
||||
|
||||
## Workspace-only root (no build of its own)
|
||||
|
||||
A workspace root can set `workspace_only = true` — it won't be built itself, and doesn't need `language` or `compiler`:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "my-workspace"
|
||||
version = "0.1.0"
|
||||
|
||||
[build]
|
||||
workspace_only = true
|
||||
kind = "bin"
|
||||
|
||||
[workspace]
|
||||
lib-core = { path = "lib-core" }
|
||||
app = { path = "app", deps = ["lib-core"] }
|
||||
```
|
||||
|
||||
@@ -12,8 +12,13 @@ Only ASCII letters, digits, underscores `_` and hyphens `-` are allowed in the p
|
||||
|
||||
```bash
|
||||
dcr new my-app
|
||||
dcr new my-app --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
Generates:
|
||||
|
||||
* `dcr.toml` with basic fields
|
||||
@@ -24,8 +29,12 @@ Generates:
|
||||
Initializes a DCR project in the current (empty) directory.
|
||||
|
||||
```bash
|
||||
mkdir app && cd app
|
||||
dcr init
|
||||
dcr init --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
The project name is taken from the current directory name. The directory name must follow the same naming rules as `dcr new`.
|
||||
|
||||
@@ -15,9 +15,9 @@ dcr setup
|
||||
If `~/.dcr/config.toml` is not found, DCR returns an error. Create it manually:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
## `dcr --help`
|
||||
|
||||
@@ -13,9 +13,9 @@ error: registry not found
|
||||
**Solution:** Make sure `~/.dcr/config.toml` exists:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
And check `DCR_INDEX_PATH`:
|
||||
|
||||
@@ -103,7 +103,7 @@ man dcr-build
|
||||
To use the registry, create `~/.dcr/config.toml`:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
@@ -10,36 +10,23 @@ DCR itself is [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later.html
|
||||
|
||||
> **Note:** DCR is a build tool, not a library. The GPL applies only to DCR's own source code. Projects built with DCR are not subject to DCR's license — their licensing is determined solely by their own code and dependencies.
|
||||
|
||||
## Vendored libraries
|
||||
|
||||
DCR statically links the following C libraries through its vendored Rust dependencies:
|
||||
|
||||
| Library | License | Bundled by |
|
||||
| ------------------------------------------ | ------------------ | ----------------------------- |
|
||||
| [libgit2](https://libgit2.org) | MIT OR Apache-2.0 | `git2` / `libgit2-sys` |
|
||||
| [libssh2](https://libssh2.org) | MIT OR Apache-2.0 | `libgit2-sys` |
|
||||
| [zlib](https://zlib.net) | MIT OR Apache-2.0 | `libgit2-sys` |
|
||||
| [OpenSSL](https://openssl.org) | Apache-2.0 | `openssl-sys` / `openssl-src` |
|
||||
| [ring](https://github.com/briansmith/ring) | Apache-2.0 AND ISC | `rustls` |
|
||||
|
||||
## Rust dependencies
|
||||
|
||||
DCR is written in Rust. The following notable Rust crates are statically linked:
|
||||
|
||||
| Crate | License |
|
||||
| --------------------------------------------- | ------------------------ |
|
||||
| [`reqwest`](https://crates.io/crates/reqwest) | MIT OR Apache-2.0 |
|
||||
| [`rustls`](https://crates.io/crates/rustls) | Apache-2.0 OR ISC OR MIT |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
|
||||
| [`git2`](https://crates.io/crates/git2) | MIT OR Apache-2.0 |
|
||||
| [`openssl`](https://crates.io/crates/openssl) | Apache-2.0 |
|
||||
| [`tokio`](https://crates.io/crates/tokio) | MIT |
|
||||
| [`hyper`](https://crates.io/crates/hyper) | MIT |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
|
||||
| Crate | License |
|
||||
| ------------------------------------------------------- | ----------------- |
|
||||
| [`ureq`](https://crates.io/crates/ureq) | MIT OR Apache-2.0 |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
|
||||
| [`toml_edit`](https://crates.io/crates/toml_edit) | MIT OR Apache-2.0 |
|
||||
| [`serde_json`](https://crates.io/crates/serde_json) | MIT OR Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
|
||||
| [`glob`](https://crates.io/crates/glob) | MIT OR Apache-2.0 |
|
||||
| [`self-replace`](https://crates.io/crates/self-replace) | MIT OR Apache-2.0 |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
|
||||
|
||||
Full dependency tree (143 packages) is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
|
||||
Full dependency tree is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
|
||||
|
||||
## Additional credits
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ type = "none"
|
||||
inherit = true
|
||||
language = "c"
|
||||
standard = "c11"
|
||||
workspace_only = true
|
||||
|
||||
[workspace.lib-core]
|
||||
path = "lib-core"
|
||||
|
||||
@@ -37,13 +37,13 @@ Main project configuration file. Located at the project root.
|
||||
|
||||
## [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 |
|
||||
| Field | Required | Description |
|
||||
| --------- | -------- | ------------------------------------------- |
|
||||
| `name` | yes | Project name |
|
||||
| `version` | yes | Semantic version |
|
||||
| `type` | no | `app`, `lib`, `none` (defaults to `"none"`) |
|
||||
| `license` | no | SPDX license identifier |
|
||||
| `author` | no | Author |
|
||||
|
||||
```toml
|
||||
[package]
|
||||
@@ -60,36 +60,36 @@ author = "John Doe"
|
||||
|
||||
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
|
||||
|
||||
| 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` |
|
||||
| `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 |
|
||||
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` |
|
||||
| `debug` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) |
|
||||
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
|
||||
| `strip` | `false` | Strip symbols from output (`-s` in ldflags) |
|
||||
| `warnings` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) |
|
||||
| `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables |
|
||||
| `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) |
|
||||
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
|
||||
| Field | Default | Description |
|
||||
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) |
|
||||
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
|
||||
| `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) |
|
||||
| `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) |
|
||||
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
|
||||
| `target` | host | Target 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 |
|
||||
| `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 (no `language`/`compiler` required) |
|
||||
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | — | Optimization level: `0`-`3`, `"s"`, `"z"` (derived from profile if omitted) |
|
||||
| `debug` | profile-based | Emit debug symbols (`-g`): `true` in debug, `false` in release |
|
||||
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
|
||||
| `strip` | `false` | Strip 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) |
|
||||
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
|
||||
|
||||
Settings from raw config (not in typed struct):
|
||||
|
||||
@@ -97,6 +97,30 @@ Settings from raw config (not in typed struct):
|
||||
* `ldscript` — linker script path
|
||||
* `build.steps` / `build.post_steps` — codegen steps
|
||||
|
||||
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`
|
||||
|
||||
Each language can have its own table that overrides the flat `[build]` settings:
|
||||
|
||||
```toml
|
||||
[build]
|
||||
compiler = "clang"
|
||||
standard = "c11"
|
||||
|
||||
[build.c]
|
||||
standard = "c23"
|
||||
compiler = "gcc"
|
||||
|
||||
[build.cxx]
|
||||
standard = "c++23"
|
||||
compiler = "g++"
|
||||
|
||||
[build.asm]
|
||||
compiler = "nasm"
|
||||
flags = ["-felf64"]
|
||||
```
|
||||
|
||||
The flat `[build]` acts as fallback; per-language tables take precedence for their language.
|
||||
|
||||
Example:
|
||||
|
||||
```toml
|
||||
|
||||
@@ -41,24 +41,22 @@ DCR uses a package registry for dependency lookup by name.
|
||||
|
||||
```toml
|
||||
# ~/.dcr/config.toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
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`:
|
||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
||||
|
||||
* `branch` — switch to a branch
|
||||
* `tag` — switch to a tag
|
||||
* `rev` — switch to a specific commit
|
||||
* `features` — 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`.
|
||||
|
||||
@@ -65,3 +65,21 @@ standard = "c17"
|
||||
|
||||
# member inherits language and standard
|
||||
```
|
||||
|
||||
## Workspace-only root (no build of its own)
|
||||
|
||||
A workspace root can set `workspace_only = true` — it won't be built itself, and doesn't need `language` or `compiler`:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "my-workspace"
|
||||
version = "0.1.0"
|
||||
|
||||
[build]
|
||||
workspace_only = true
|
||||
kind = "bin"
|
||||
|
||||
[workspace]
|
||||
lib-core = { path = "lib-core" }
|
||||
app = { path = "app", deps = ["lib-core"] }
|
||||
```
|
||||
|
||||
@@ -12,8 +12,13 @@ sidebar_label: Команды проекта (new, init)
|
||||
|
||||
```bash
|
||||
dcr new my-app
|
||||
dcr new my-app --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
Генерирует:
|
||||
|
||||
* `dcr.toml` с базовыми полями
|
||||
@@ -24,8 +29,12 @@ dcr new my-app
|
||||
Инициализирует проект DCR в текущем (пустом) каталоге.
|
||||
|
||||
```bash
|
||||
mkdir app && cd app
|
||||
dcr init
|
||||
dcr init --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
Название проекта взято из имени текущего каталога. Имя каталога должно соответствовать тем же правилам именования, что и в `dcr new`.
|
||||
|
||||
@@ -15,9 +15,9 @@ dcr setup
|
||||
Если файл `~/.dcr/config.toml` не найден, DCR возвращает ошибку. Создайте его вручную:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
## `dcr --help`
|
||||
|
||||
@@ -13,9 +13,9 @@ sidebar_label: Часто задаваемые вопросы
|
||||
**Решение:** Убедитесь, что файл `~/.dcr/config.toml` существует:
|
||||
|
||||
```toml
|
||||
[[реестр]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
Если реестр кастомный, проверьте `DCR_INDEX_PATH`:
|
||||
|
||||
@@ -103,7 +103,7 @@ man dcr-build
|
||||
Чтобы использовать реестр, создайте файл `~/.dcr/config.toml`:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
@@ -10,36 +10,23 @@ DCR распространяется под лицензией [GPL-3.0-or-later
|
||||
|
||||
> **Важно:** DCR — инструмент сборки, а не библиотека. GPL распространяется только на исходный код самого DCR. Проекты, собранные с помощью DCR, не подпадают под лицензию DCR — их лицензирование определяется исключительно их собственным кодом и зависимостями.
|
||||
|
||||
## Вендорные библиотеки
|
||||
|
||||
DCR статически связывает следующие C-библиотеки через вендорные Rust-зависимости:
|
||||
|
||||
| Библиотека | Лицензия | В комплекте с |
|
||||
| -------------------------------------------- | ------------------ | ----------------------------- |
|
||||
| [libgit2](https://libgit2.org) | MIT ИЛИ Apache-2.0 | `git2` / `libgit2-sys` |
|
||||
| [libssh2](https://libssh2.org) | MIT ИЛИ Apache-2.0 | `libgit2-sys` |
|
||||
| [zlib](https://zlib.net) | MIT ИЛИ Apache-2.0 | `libgit2-sys` |
|
||||
| [OpenSSL](https://openssl.org) | Apache-2.0 | `openssl-sys` / `openssl-src` |
|
||||
| [кольцо](https://github.com/briansmith/ring) | Apache-2.0 И ISC | `rustls` |
|
||||
|
||||
## Rust-зависимости
|
||||
|
||||
DCR написан на Rust. Ниже перечислены основные статически связываемые крейты:
|
||||
|
||||
| Крейт | Лицензия |
|
||||
| --------------------------------------------- | -------------------------- |
|
||||
| [`reqwest`](https://crates.io/crates/reqwest) | MIT ИЛИ Apache-2.0 |
|
||||
| [`rustls`](https://crates.io/crates/rustls) | Apache-2.0 ИЛИ ISC ИЛИ MIT |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT ИЛИ Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT ИЛИ Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT ИЛИ Apache-2.0 |
|
||||
| [`git2`](https://crates.io/crates/git2) | MIT ИЛИ Apache-2.0 |
|
||||
| [`openssl`](https://crates.io/crates/openssl) | Apache-2.0 |
|
||||
| [`tokio`](https://crates.io/crates/tokio) | MIT |
|
||||
| [`hyper`](https://crates.io/crates/hyper) | MIT |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT ИЛИ Apache-2.0 |
|
||||
| Крейт | Лицензия |
|
||||
| ------------------------------------------------------- | ------------------ |
|
||||
| [`ureq`](https://crates.io/crates/ureq) | MIT ИЛИ Apache-2.0 |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT ИЛИ Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT ИЛИ Apache-2.0 |
|
||||
| [`toml_edit`](https://crates.io/crates/toml_edit) | MIT OR Apache-2.0 |
|
||||
| [`serde_json`](https://crates.io/crates/serde_json) | MIT ИЛИ Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT ИЛИ Apache-2.0 |
|
||||
| [`glob`](https://crates.io/crates/glob) | MIT ИЛИ Apache-2.0 |
|
||||
| [`self-replace`](https://crates.io/crates/self-replace) | MIT ИЛИ Apache-2.0 |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT ИЛИ Apache-2.0 |
|
||||
|
||||
Полное дерево зависимостей (143 пакета) доступно в [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). Подавляющее большинство имеют двойную лицензию MIT OR Apache-2.0.
|
||||
Full dependency tree is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). Подавляющее большинство имеют двойную лицензию MIT OR Apache-2.0.
|
||||
|
||||
## Дополнительные благодарности
|
||||
|
||||
|
||||
@@ -33,14 +33,20 @@ type = "none"
|
||||
[build]
|
||||
inherit = true
|
||||
language = "c"
|
||||
standard = "c17"
|
||||
standard = "c11"
|
||||
workspace_only = true
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
{ path = "lib-core" },
|
||||
{ path = "lib-utils", deps = ["lib-core"] },
|
||||
{ path = "app", deps = ["lib-core", "lib-utils"], main = 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
|
||||
```
|
||||
|
||||
## Пакеты
|
||||
|
||||
@@ -38,13 +38,13 @@ sidebar_label: Обзор dcr.toml
|
||||
|
||||
## [пакет]
|
||||
|
||||
| Поле | Обязательное | Описание |
|
||||
| ---------- | ------------ | --------------------------- |
|
||||
| `имя` | да | Имя проекта |
|
||||
| `версия` | да | Семантическая версия |
|
||||
| `тип` | да | `app`, `lib`, `none` |
|
||||
| `лицензия` | нет | SPDX-идентификатор лицензии |
|
||||
| `автор` | нет | Автор |
|
||||
| Поле | Обязательное | Описание |
|
||||
| ---------- | ------------ | ------------------------------------------- |
|
||||
| `имя` | да | Имя проекта |
|
||||
| `версия` | да | Семантическая версия |
|
||||
| `тип` | no | `app`, `lib`, `none` (defaults to `"none"`) |
|
||||
| `лицензия` | нет | SPDX-идентификатор лицензии |
|
||||
| `автор` | нет | Автор |
|
||||
|
||||
```toml
|
||||
[package]
|
||||
@@ -61,36 +61,36 @@ author = "John Doe"
|
||||
|
||||
* `build.qt` — (bool) Включить автоматическую обработку метаобъектов Qt (MOC, UIC, RCC). Требуется установка модулей `qt6` с помощью `pkg-config`.
|
||||
|
||||
| Поле | По умолчанию | Описание |
|
||||
| ------------------------ | --------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
||||
| `язык` | `"c"` | `"c"`, `"cxx"`, `"cpp"` |
|
||||
| `стандартный` | `"c11"` | Стандарт C (`c11`, `c17`, `c23`) |
|
||||
| `cxx_standard` | `"c++20"` | Стандарт C++ (`c++17`, `c++20`, `c++23`) |
|
||||
| `компилятор` | `cxxflags` | Предпочитаемый компилятор |
|
||||
| `тип` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
|
||||
| `target` | хост | Target triple для кросс-компиляции |
|
||||
| `платформа` | `"нативный"` | `native`, `efi`, `freestanding` |
|
||||
| `cflags` | `[]` | Дополнительные флаги C++ |
|
||||
| `ldflags` | `[]` | Дополнительные флаги линковки |
|
||||
| `имя файла` | `""` | Кастомное имя выходного файла |
|
||||
| `расширение` | `""` | Пользовательское расширение файла |
|
||||
| `корни` | `["src"]` | Корневые директории с исходниками |
|
||||
| `exclude` | `[]` | Паттерны исключений |
|
||||
| `include` | `[]` | Дополнительные include-директории |
|
||||
| `src_disable` | `false` | Отключить автоматический поиск источников |
|
||||
| `наследовать` | `false` | Наследовать build от корня workspace |
|
||||
| `clean` | `[]` | Шаблоны Glob для настраиваемых чистых путей |
|
||||
| `out_dir` | `""` | Пользовательский каталог для вывода данных |
|
||||
| `только рабочая область` | `false` | Только для workspace, не собирать отдельно |
|
||||
| `отдельно стоящий` | `false` | Компилировать в автономном режиме (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | `"0"` (отладочная версия) / `"3"` (релизная версия) | Уровень оптимизации: `0`–`3`, `"s"`, `"z"` |
|
||||
| `ldscript` | `true` (отладочный режим) / `false` (релизный режим) | Выводить отладочные символы (`-g`) |
|
||||
| `lto` | `false` | Оптимизация на этапе компоновки (`-flto` как для компилятора, так и для компоновщика) |
|
||||
| `asflags` | `false` | Удалить символы из вывода (опция `-s` в ldflags) |
|
||||
| `true` | `["all", "extra"]` (отладочная версия) / `[]` (релизная версия) | Флаги предупреждений (например, `"all"`, `"extra"`, `"pedantic"`) |
|
||||
| `panic` | `""` | Стратегия «Паника»: `"abort"` отключает исключения и таблицы развертки |
|
||||
| `codegen-units` | `""` | Максимальное количество параллельных заданий компиляции (`"0"` = автоматически) |
|
||||
| `qt` | `false` | Включить автоматическую обработку метаобъектов Qt (MOC, UIC, RCC) |
|
||||
| Поле | По умолчанию | Описание |
|
||||
| ------------------------ | ------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `язык` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) |
|
||||
| `стандартный` | `"c11"` | Стандарт C (`c11`, `c17`, `c23`) |
|
||||
| `cxx_standard` | — | Стандарт C++ (`c++17`, `c++20`, `c++23`) |
|
||||
| `компилятор` | `cxxflags` | Preferred compiler (optional, defaults to `"clang"`) |
|
||||
| `тип` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
|
||||
| `target` | хост | Target triple для кросс-компиляции |
|
||||
| `платформа` | `"нативный"` | `native`, `efi`, `freestanding` |
|
||||
| `cflags` | `[]` | Дополнительные флаги C++ |
|
||||
| `ldflags` | `[]` | Дополнительные флаги линковки |
|
||||
| `имя файла` | `""` | Кастомное имя выходного файла |
|
||||
| `расширение` | `""` | Пользовательское расширение файла |
|
||||
| `корни` | `["src"]` | Корневые директории с исходниками |
|
||||
| `exclude` | `[]` | Паттерны исключений |
|
||||
| `include` | `[]` | Дополнительные include-директории |
|
||||
| `src_disable` | `false` | Отключить автоматический поиск источников |
|
||||
| `наследовать` | `false` | Наследовать build от корня workspace |
|
||||
| `clean` | `[]` | Шаблоны Glob для настраиваемых чистых путей |
|
||||
| `out_dir` | `""` | Пользовательский каталог для вывода данных |
|
||||
| `только рабочая область` | `false` | Workspace-only, not built standalone (no `language`/`compiler` required) |
|
||||
| `отдельно стоящий` | `false` | Компилировать в автономном режиме (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | — | Optimization level: `0`-`3`, `"s"`, `"z"` (derived from profile if omitted) |
|
||||
| `ldscript` | profile-based | Emit debug symbols (`-g`): `true` in debug, `false` in release |
|
||||
| `lto` | `false` | Оптимизация на этапе компоновки (`-flto` как для компилятора, так и для компоновщика) |
|
||||
| `asflags` | `false` | Удалить символы из вывода (опция `-s` в ldflags) |
|
||||
| `true` | `[]` | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`); engine adds `-Wall -Wextra` in debug if empty |
|
||||
| `panic` | `""` | Стратегия «Паника»: `"abort"` отключает исключения и таблицы развертки |
|
||||
| `codegen-units` | `""` | Максимальное количество параллельных заданий компиляции (`"0"` = автоматически) |
|
||||
| `qt` | `false` | Включить автоматическую обработку метаобъектов Qt (MOC, UIC, RCC) |
|
||||
|
||||
Параметры из исходного файла конфигурации (не в виде типизированной структуры):
|
||||
|
||||
@@ -98,6 +98,30 @@ author = "John Doe"
|
||||
* Путь к linker script
|
||||
* `build.steps` / `build.post_steps` — этапы генерации кода
|
||||
|
||||
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`
|
||||
|
||||
Each language can have its own table that overrides the flat `[build]` settings:
|
||||
|
||||
```toml
|
||||
[build]
|
||||
compiler = "clang"
|
||||
standard = "c11"
|
||||
|
||||
[build.c]
|
||||
standard = "c23"
|
||||
compiler = "gcc"
|
||||
|
||||
[build.cxx]
|
||||
standard = "c++23"
|
||||
compiler = "g++"
|
||||
|
||||
[build.asm]
|
||||
compiler = "nasm"
|
||||
flags = ["-felf64"]
|
||||
```
|
||||
|
||||
The flat `[build]` acts as fallback; per-language tables take precedence for their language.
|
||||
|
||||
Пример:
|
||||
|
||||
```toml
|
||||
|
||||
@@ -45,27 +45,25 @@ main = { url = "https://github.com/dcr-ports/dcr-index", priority = 1 }
|
||||
|
||||
```toml
|
||||
# ~/.dcr/config.toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
Приоритет реестра: порядок в файле `config.toml`. Переменная `DCR_INDEX_PATH` переопределяет путь к index.json.
|
||||
|
||||
## Git-зависимости
|
||||
|
||||
При добавлении git-зависимости DCR клонирует репозиторий через `git2`:
|
||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
||||
|
||||
* `branch` — переключиться на ветку
|
||||
* `tag` — переключиться на тег
|
||||
* `rev` — переключиться на конкретный коммит
|
||||
* `features` — флаги функций (проанализированы, но не влияют на сборку)
|
||||
|
||||
Путь к кэшу: `~/.dcr/git/\<hash>/`.
|
||||
## Path dependencies
|
||||
|
||||
## Path-зависимости
|
||||
|
||||
Локальные пути. DCR автоматически находит include и lib директории.
|
||||
Local paths. DCR automatically discovers include and lib directories from the neighbor's `dcr.toml`.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
@@ -75,14 +73,14 @@ mylib = { path = "../relative/path" }
|
||||
|
||||
## dcr.lock
|
||||
|
||||
Файл блокировки зависимостей. Содержит точные версии, хеши и источники.
|
||||
Dependency lock file. Contains package names and sources.
|
||||
|
||||
Создаётся при выполнении команды `dcr build` при наличии зависимостей реестра. Автоматически обновляется при `dcr add`.
|
||||
Created during `dcr build` when registry dependencies are present. Not updated during `dcr add` — only on the next `dcr build`.
|
||||
|
||||
## Процесс резолва
|
||||
## Resolution process
|
||||
|
||||
1. Загружаются все зависимости (registry → git → path)
|
||||
2. Для зависимостей типа «path»: рекурсивно прочитать их файлы `dcr.toml`
|
||||
3. Для зависимостей реестра: выполните поиск в файле `index.json`
|
||||
4. Для зависимостей Git: клонировать в кэш
|
||||
5. Собираются include_dirs, lib_dirs, libs для передачи компилятору
|
||||
1. Load all dependencies (registry → git → path)
|
||||
2. For path deps: recursively read their `dcr.toml`
|
||||
3. For registry deps: search `index.json`
|
||||
4. For git deps: clone to cache
|
||||
5. Collect `include_dirs`, `lib_dirs`, `libs` for the compiler
|
||||
|
||||
@@ -57,3 +57,21 @@ inherit = true
|
||||
language = "c"
|
||||
standard = "c17"
|
||||
```
|
||||
|
||||
## Workspace-only root (no build of its own)
|
||||
|
||||
A workspace root can set `workspace_only = true` — it won't be built itself, and doesn't need `language` or `compiler`:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "my-workspace"
|
||||
version = "0.1.0"
|
||||
|
||||
[build]
|
||||
workspace_only = true
|
||||
kind = "bin"
|
||||
|
||||
[workspace]
|
||||
lib-core = { path = "lib-core" }
|
||||
app = { path = "app", deps = ["lib-core"] }
|
||||
```
|
||||
|
||||
@@ -12,8 +12,13 @@ Only ASCII letters, digits, underscores `_` and hyphens `-` are allowed in the p
|
||||
|
||||
```bash
|
||||
dcr new my-app
|
||||
dcr new my-app --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
Generates:
|
||||
|
||||
* `dcr.toml` with basic fields
|
||||
@@ -24,8 +29,12 @@ Generates:
|
||||
Initializes a DCR project in the current (empty) directory.
|
||||
|
||||
```bash
|
||||
mkdir app && cd app
|
||||
dcr init
|
||||
dcr init --vcs none
|
||||
```
|
||||
|
||||
Flags:
|
||||
|
||||
* `--vcs \<git|none>` — Initialize version control system (defaults to `git` if available, or `none`).
|
||||
|
||||
The project name is taken from the current directory name. The directory name must follow the same naming rules as `dcr new`.
|
||||
|
||||
@@ -15,9 +15,9 @@ dcr setup
|
||||
If `~/.dcr/config.toml` is not found, DCR returns an error. Create it manually:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
## `dcr --help`
|
||||
|
||||
@@ -13,9 +13,9 @@ error: registry not found
|
||||
**Solution:** Make sure `~/.dcr/config.toml` exists:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
And check `DCR_INDEX_PATH`:
|
||||
|
||||
@@ -103,7 +103,7 @@ man dcr-build
|
||||
To use the registry, create `~/.dcr/config.toml`:
|
||||
|
||||
```toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
@@ -10,36 +10,23 @@ DCR itself is [GPL-3.0-or-later](https://spdx.org/licenses/GPL-3.0-or-later.html
|
||||
|
||||
> **Note:** DCR is a build tool, not a library. The GPL applies only to DCR's own source code. Projects built with DCR are not subject to DCR's license — their licensing is determined solely by their own code and dependencies.
|
||||
|
||||
## Vendored libraries
|
||||
|
||||
DCR statically links the following C libraries through its vendored Rust dependencies:
|
||||
|
||||
| Library | License | Bundled by |
|
||||
| ------------------------------------------ | ------------------ | ----------------------------- |
|
||||
| [libgit2](https://libgit2.org) | MIT OR Apache-2.0 | `git2` / `libgit2-sys` |
|
||||
| [libssh2](https://libssh2.org) | MIT OR Apache-2.0 | `libgit2-sys` |
|
||||
| [zlib](https://zlib.net) | MIT OR Apache-2.0 | `libgit2-sys` |
|
||||
| [OpenSSL](https://openssl.org) | Apache-2.0 | `openssl-sys` / `openssl-src` |
|
||||
| [ring](https://github.com/briansmith/ring) | Apache-2.0 AND ISC | `rustls` |
|
||||
|
||||
## Rust dependencies
|
||||
|
||||
DCR is written in Rust. The following notable Rust crates are statically linked:
|
||||
|
||||
| Crate | License |
|
||||
| --------------------------------------------- | ------------------------ |
|
||||
| [`reqwest`](https://crates.io/crates/reqwest) | MIT OR Apache-2.0 |
|
||||
| [`rustls`](https://crates.io/crates/rustls) | Apache-2.0 OR ISC OR MIT |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
|
||||
| [`git2`](https://crates.io/crates/git2) | MIT OR Apache-2.0 |
|
||||
| [`openssl`](https://crates.io/crates/openssl) | Apache-2.0 |
|
||||
| [`tokio`](https://crates.io/crates/tokio) | MIT |
|
||||
| [`hyper`](https://crates.io/crates/hyper) | MIT |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
|
||||
| Crate | License |
|
||||
| ------------------------------------------------------- | ----------------- |
|
||||
| [`ureq`](https://crates.io/crates/ureq) | MIT OR Apache-2.0 |
|
||||
| [`serde`](https://crates.io/crates/serde) | MIT OR Apache-2.0 |
|
||||
| [`toml`](https://crates.io/crates/toml) | MIT OR Apache-2.0 |
|
||||
| [`toml_edit`](https://crates.io/crates/toml_edit) | MIT OR Apache-2.0 |
|
||||
| [`serde_json`](https://crates.io/crates/serde_json) | MIT OR Apache-2.0 |
|
||||
| [`sha2`](https://crates.io/crates/sha2) | MIT OR Apache-2.0 |
|
||||
| [`glob`](https://crates.io/crates/glob) | MIT OR Apache-2.0 |
|
||||
| [`self-replace`](https://crates.io/crates/self-replace) | MIT OR Apache-2.0 |
|
||||
| [`ctrlc`](https://crates.io/crates/ctrlc) | MIT OR Apache-2.0 |
|
||||
|
||||
Full dependency tree (143 packages) is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
|
||||
Full dependency tree is available in [`Cargo.lock`](https://github.com/dexoron/dcr/blob/main/Cargo.lock). The overwhelming majority are dual-licensed under MIT OR Apache-2.0.
|
||||
|
||||
## Additional credits
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ type = "none"
|
||||
inherit = true
|
||||
language = "c"
|
||||
standard = "c11"
|
||||
workspace_only = true
|
||||
|
||||
[workspace.lib-core]
|
||||
path = "lib-core"
|
||||
|
||||
@@ -37,13 +37,13 @@ Main project configuration file. Located at the project root.
|
||||
|
||||
## [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 |
|
||||
| Field | Required | Description |
|
||||
| --------- | -------- | ------------------------------------------- |
|
||||
| `name` | yes | Project name |
|
||||
| `version` | yes | Semantic version |
|
||||
| `type` | no | `app`, `lib`, `none` (defaults to `"none"`) |
|
||||
| `license` | no | SPDX license identifier |
|
||||
| `author` | no | Author |
|
||||
|
||||
```toml
|
||||
[package]
|
||||
@@ -60,36 +60,36 @@ author = "John Doe"
|
||||
|
||||
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
|
||||
|
||||
| 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` |
|
||||
| `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 |
|
||||
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | `"0"` (debug) / `"3"` (release) | Optimization level: `0`-`3`, `"s"`, `"z"` |
|
||||
| `debug` | `true` (debug) / `false` (release) | Emit debug symbols (`-g`) |
|
||||
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
|
||||
| `strip` | `false` | Strip symbols from output (`-s` in ldflags) |
|
||||
| `warnings` | `["all", "extra"]` (debug) / `[]` (release) | Warning flags (e.g. `"all"`, `"extra"`, `"pedantic"`) |
|
||||
| `panic` | `""` | Panic strategy: `"abort"` disables exceptions and unwind tables |
|
||||
| `codegen-units` | `""` | Max parallel compilation jobs (`"0"` = auto) |
|
||||
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
|
||||
| Field | Default | Description |
|
||||
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) |
|
||||
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
|
||||
| `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) |
|
||||
| `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) |
|
||||
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` |
|
||||
| `target` | host | Target 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 |
|
||||
| `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 (no `language`/`compiler` required) |
|
||||
| `freestanding` | `false` | Compile in freestanding mode (`-ffreestanding` + `-nostdlib -static`) |
|
||||
| `opt_level` | — | Optimization level: `0`-`3`, `"s"`, `"z"` (derived from profile if omitted) |
|
||||
| `debug` | profile-based | Emit debug symbols (`-g`): `true` in debug, `false` in release |
|
||||
| `lto` | `false` | Link-time optimization (`-flto` for both compiler and linker) |
|
||||
| `strip` | `false` | Strip 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) |
|
||||
| `qt` | `false` | Enable automatic Qt meta-object handling (MOC, UIC, RCC) |
|
||||
|
||||
Settings from raw config (not in typed struct):
|
||||
|
||||
@@ -97,6 +97,30 @@ Settings from raw config (not in typed struct):
|
||||
* `ldscript` — linker script path
|
||||
* `build.steps` / `build.post_steps` — codegen steps
|
||||
|
||||
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`
|
||||
|
||||
Each language can have its own table that overrides the flat `[build]` settings:
|
||||
|
||||
```toml
|
||||
[build]
|
||||
compiler = "clang"
|
||||
standard = "c11"
|
||||
|
||||
[build.c]
|
||||
standard = "c23"
|
||||
compiler = "gcc"
|
||||
|
||||
[build.cxx]
|
||||
standard = "c++23"
|
||||
compiler = "g++"
|
||||
|
||||
[build.asm]
|
||||
compiler = "nasm"
|
||||
flags = ["-felf64"]
|
||||
```
|
||||
|
||||
The flat `[build]` acts as fallback; per-language tables take precedence for their language.
|
||||
|
||||
Example:
|
||||
|
||||
```toml
|
||||
|
||||
@@ -41,24 +41,22 @@ DCR uses a package registry for dependency lookup by name.
|
||||
|
||||
```toml
|
||||
# ~/.dcr/config.toml
|
||||
[[registry]]
|
||||
name = "default"
|
||||
[registry.default]
|
||||
url = "https://index.dcr.pm"
|
||||
priority = 1
|
||||
```
|
||||
|
||||
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`:
|
||||
Git dependencies are parsed and recorded in `dcr.lock`. DCR supports specifying branch/tag/rev for git sources:
|
||||
|
||||
* `branch` — switch to a branch
|
||||
* `tag` — switch to a tag
|
||||
* `rev` — switch to a specific commit
|
||||
* `features` — 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`.
|
||||
|
||||
@@ -65,3 +65,21 @@ standard = "c17"
|
||||
|
||||
# member inherits language and standard
|
||||
```
|
||||
|
||||
## Workspace-only root (no build of its own)
|
||||
|
||||
A workspace root can set `workspace_only = true` — it won't be built itself, and doesn't need `language` or `compiler`:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "my-workspace"
|
||||
version = "0.1.0"
|
||||
|
||||
[build]
|
||||
workspace_only = true
|
||||
kind = "bin"
|
||||
|
||||
[workspace]
|
||||
lib-core = { path = "lib-core" }
|
||||
app = { path = "app", deps = ["lib-core"] }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user