52 Commits

Author SHA1 Message Date
658cb17ffa New translations os-flat-bin-archive.mdx (Ukrainian)
[ci skip]
2026-07-21 18:17:11 +08:00
091e2fd426 New translations os-flat-bin-archive.mdx (Russian)
[ci skip]
2026-07-21 18:17:10 +08:00
9078d16e52 New translations os-flat-bin-archive.mdx (Polish)
[ci skip]
2026-07-21 18:17:09 +08:00
42350f7d85 New translations os-flat-bin-archive.mdx (German)
[ci skip]
2026-07-21 18:17:07 +08:00
950380d500 New translations workspaces.mdx (Ukrainian)
[ci skip]
2026-07-21 18:17:06 +08:00
c0220f8037 New translations workspaces.mdx (Russian)
[ci skip]
2026-07-21 18:17:05 +08:00
16340b4ce1 New translations workspaces.mdx (Polish)
[ci skip]
2026-07-21 18:17:04 +08:00
0a182eb7a3 New translations workspaces.mdx (German)
[ci skip]
2026-07-21 18:17:02 +08:00
32d90ab2b4 New translations platform-support.mdx (Ukrainian)
[ci skip]
2026-07-21 18:17:01 +08:00
e10ae8ca99 New translations platform-support.mdx (Russian)
[ci skip]
2026-07-21 18:17:00 +08:00
7e35f9e733 New translations platform-support.mdx (Polish)
[ci skip]
2026-07-21 18:16:59 +08:00
37de001497 New translations platform-support.mdx (German)
[ci skip]
2026-07-21 18:16:57 +08:00
4503e71f8c New translations dependencies.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:56 +08:00
c204124d5b New translations dependencies.mdx (Russian)
[ci skip]
2026-07-21 18:16:55 +08:00
0f96005356 New translations dependencies.mdx (Polish)
[ci skip]
2026-07-21 18:16:53 +08:00
5340793fff New translations dependencies.mdx (German)
[ci skip]
2026-07-21 18:16:52 +08:00
fa55fa0c44 New translations dcr-toml.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:51 +08:00
505a5371ac New translations dcr-toml.mdx (Russian)
[ci skip]
2026-07-21 18:16:49 +08:00
0e4d8f2fa7 New translations dcr-toml.mdx (Polish)
[ci skip]
2026-07-21 18:16:47 +08:00
e22c49d66a New translations dcr-toml.mdx (German)
[ci skip]
2026-07-21 18:16:46 +08:00
5d91f93bbf New translations cross-compilation.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:44 +08:00
24585646a8 New translations cross-compilation.mdx (Russian)
[ci skip]
2026-07-21 18:16:43 +08:00
67b00b7459 New translations cross-compilation.mdx (Polish)
[ci skip]
2026-07-21 18:16:42 +08:00
5fa4c5e3ea New translations cross-compilation.mdx (German)
[ci skip]
2026-07-21 18:16:41 +08:00
90d9e3b4b3 New translations build-system.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:39 +08:00
db4983b9e5 New translations build-system.mdx (Russian)
[ci skip]
2026-07-21 18:16:38 +08:00
b2c03dadc4 New translations build-system.mdx (Polish)
[ci skip]
2026-07-21 18:16:37 +08:00
da0ae39589 New translations build-system.mdx (German)
[ci skip]
2026-07-21 18:16:35 +08:00
40eeed48f0 New translations first-steps.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:34 +08:00
c7b71b2e93 New translations first-steps.mdx (Russian)
[ci skip]
2026-07-21 18:16:33 +08:00
8a7e891f0c New translations first-steps.mdx (Polish)
[ci skip]
2026-07-21 18:16:32 +08:00
3583da762a New translations first-steps.mdx (German)
[ci skip]
2026-07-21 18:16:30 +08:00
8b3a5d0a2d New translations faq.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:29 +08:00
a20ca20a43 New translations faq.mdx (Russian)
[ci skip]
2026-07-21 18:16:28 +08:00
df4dca15f3 New translations faq.mdx (Polish)
[ci skip]
2026-07-21 18:16:27 +08:00
ec35a981e5 New translations faq.mdx (German)
[ci skip]
2026-07-21 18:16:26 +08:00
56becced2a New translations contributing.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:24 +08:00
f10056912c New translations contributing.mdx (Russian)
[ci skip]
2026-07-21 18:16:23 +08:00
72816a3b53 New translations contributing.mdx (Polish)
[ci skip]
2026-07-21 18:16:22 +08:00
ffb31a4947 New translations contributing.mdx (German)
[ci skip]
2026-07-21 18:16:21 +08:00
75a6a63a1b New translations build-commands.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:19 +08:00
0a1cff31b2 New translations build-commands.mdx (Russian)
[ci skip]
2026-07-21 18:16:18 +08:00
de6346d6c9 New translations build-commands.mdx (Polish)
[ci skip]
2026-07-21 18:16:17 +08:00
98205b0c66 New translations build-commands.mdx (German)
[ci skip]
2026-07-21 18:16:16 +08:00
d261b705f6 New translations changelog.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:14 +08:00
15a1c753fc New translations changelog.mdx (Russian)
[ci skip]
2026-07-21 18:16:13 +08:00
7361ff8992 New translations changelog.mdx (Polish)
[ci skip]
2026-07-21 18:16:11 +08:00
2213e5dfb8 New translations changelog.mdx (German)
[ci skip]
2026-07-21 18:16:09 +08:00
94459ca7c9 New translations readme.mdx (Ukrainian)
[ci skip]
2026-07-21 18:16:08 +08:00
f301e20831 New translations readme.mdx (Russian)
[ci skip]
2026-07-21 18:16:07 +08:00
dbc1c477f2 New translations readme.mdx (Polish)
[ci skip]
2026-07-21 18:16:05 +08:00
15b5ee011d New translations readme.mdx (German)
[ci skip]
2026-07-21 18:16:04 +08:00
52 changed files with 1448 additions and 328 deletions

View File

@@ -51,8 +51,9 @@ dcr gen vscode
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint * **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue * **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86) * **7 backends** — gcc/clang (unix_cc), MSVC/clang-cl (msvc), GAS, NASM, MASM, FASM, LLVM IR
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom * **8 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom, flat-bin
* **Disk images** — optional `[archive]` packs FAT12/16/32 images after build
* **Cross-compilation** — short names and full triples * **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides * **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort * **Workspaces** — multi-package projects with topological sort

View File

@@ -4,6 +4,108 @@ sidebar_label: Changelog
# Changelog # Changelog
## 0.8.1 (2026-07-20)
### Added
* **`build.kind = "flat-bin"`** — raw binary (default `.bin`) for OS-dev payloads:
* **NASM** — `-f bin` → `\<stem>.bin`
* **FASM** — direct output (`format binary` in source)
* **GAS / MASM / LLC** — object → `objcopy -O binary` → `\<stem>.bin`
* **C/C++** — objects → freestanding link → `objcopy -O binary` → `\<name>.bin`
* Requires `llvm-objcopy` / `objcopy` / `gobjcopy` except for NASM/FASM direct emit
* **`[archive]` section** — after a successful build, pack a FAT disk image (`fatfs`): `output`, `format` (`fat12`/`fat16`/`fat32`), optional `size` (default 1.44 MiB), `offset`, `label`, `bootsector`, and `layout` (`from` → `to`, supports globs). `{profile}` works in paths.
* **Single-file `build.roots`** — a root may be a single source or header file, not only a directory.
### Changed
* **`--force`** also re-runs `build.steps` and `build.post_steps`.
* **`dcr run` on workspace-only root** — if `[run].cmd` is set, run that after build; otherwise delegate to a workspace member.
### Dependencies
* `fatfs = "0.3"` for FAT image packing.
## 0.8.0 (2026-07-18)
### Added
* **Dedicated Build Engine (`src/core/build/engine.rs`)** — decoupled the build orchestration logic completely from the CLI front-end wrapper in `src/cli/build.rs` to a reusable, decoupled core build engine.
* **Polymorphic Language Model (`Language` trait)** — introduced the abstract `Language` trait (`src/core/build/language/mod.rs`). File scanning, compiler resolution, and flags handling are now encapsulated in dedicated language modules for C, C++ (including Qt code generation), LLVM IR, and ASM (GAS, NASM, FASM, MASM).
* **Polymorphic Compilation Dispatch (`Builder` trait)** — introduced the `Builder` trait to generalize builder invocations (`src/core/build/builder/mod.rs`). Consolidated GCC/Clang logic into `builder/cc_common.rs` and Microsoft Visual C++ logic into `builder/msvc/`.
* **Per-Language Configuration overrides (`[build.\<lang>]`)** — introduced support for configuring language-specific compiler, standard, and flags (e.g. `[build.c]`, `[build.cxx]`, `[build.asm]`) independently in `dcr.toml`.
* **Automatic Workspace Dependency Injection** — during workspace builds, include/lib paths of dependent workspace members (including their source headers, local `include/` folders, and build target `target/include` / `target/lib` folders) are automatically resolved and injected.
* **`BuildReporter` Event System** — decoupled build orchestration output into a structured event-driven reporter model (`src/core/build/report.rs`), making DCR suitable for library embedding and IDE integrations without stderr capturing.
* **Build Cancellation Support** — introduced thread-safe cancellation tokens (`Arc\<AtomicBool>`) allowing clients to safely abort compile runs mid-execution.
* **TOML Formatting & Custom Keys Preservation** — migrated the config editor to `toml_edit`, preserving all unknown/user-defined TOML keys, structures, and comments during file write operations (e.g., in `dcr add`).
* **Path Dependencies Target Include Resolution** — local path dependencies configured via tables now correctly expose headers built and packaged into their `target/include` folder to consumer packages.
* **Modular Integration Test Suite** — refactored the monolith `tests/cli_basic.rs` file into clean, specialized integration tests: `cli_build.rs`, `cli_deps.rs`, `cli_lint.rs`, `cli_new.rs`, `cli_qt.rs`, `cli_test.rs`, `cli_workspace.rs`.
### Changed
* **Consolidated Linking and Archiving** — artifact generation (linking executables/shared libraries and archiving static libraries) consolidated into a single `src/core/build/builder/artifact.rs` module.
* **Workspace-Aware member execution** — `dcr run` executed at the workspace root of a `workspace_only` project now triggers the member build inside the workspace context using the `--workspace` parameter, preventing standalone build issues.
* **Elimination of Global State** — removed global variables and states from the build core, encapsulating build logic inside isolated `BuildContext` structs for thread safety.
* **Build Cache Separation** — relocated mtime tracking, incremental caching, and header-dependency checking logic to `src/core/build/cache.rs`.
* **Modularized Pre-build Steps** — decoupled generator scripts and pre-build commands parsing into `src/core/build/steps.rs`.
## 0.7.4 (2026-06-17)
### Added
* **Native Qt support** — automatic meta-object handling (MOC, UIC, RCC) added when `build.qt = true` is set in `dcr.toml`.
* **`dcr lint` command** — C/C++ static analysis via `clang-tidy`. Supports `--fix` for automatic fixes. Respects `build.roots` and `build.src_disable` from config.
* **Three new assembler backends**:
* **MASM** (`compiler = "ml"` / `"ml64"`) — Microsoft Macro Assembler.
* **FASM** (`compiler = "fasm"`) — Flat Assembler.
* **LLVM IR** (`compiler = "llc"`) — compiles `.ll` files via `llc -filetype=obj`.
* **Shared ASM pipeline** — linking and archiving logic consolidated into `core/builder/asm.rs`. Adding a new assembler backend now takes ~30 lines.
* **Filesystem utilities** — `to_hex()` and `home_dir()` extracted to `utils/fs.rs`.
* **Build utilities** — `normalize_target()`, `normalize_kind()`, `normalize_platform()`, `default_profile_flags()` extracted to `utils/build.rs`.
* **Backend helpers** — `asm_lang_flag()`, `source_extensions()`, `elapsed_secs()` added to `core/builder/common.rs`.
* **Full Bare-Metal / Freestanding Automation** — introduced the `build.freestanding = true` configuration option. When enabled (or when a bare-metal target is detected), DCR automatically injects `-ffreestanding` during compilation and both `-nostdlib` and `-static` during linking.
* **Artifact Optimization (LTO & Strip)** — added `build.lto` (auto-injects `-flto` for compiler and linker) and `build.strip` (automatically strips debug symbols via linker `-s` flag) options to `dcr.toml`.
* **Compilation Thread Control** — added the `build.codegen-units` option to strictly limit the maximum number of parallel jobs utilized by the custom `parallel_build` worker pool.
* **Panic Behavior Management** — added `build.panic = "abort"` support. For C++ targets, it automatically strips exception handling and unwind tables via `-fno-exceptions`, `-fno-unwind-tables`, and `-fno-asynchronous-unwind-tables`.
### Changed
* **Intelligent Default Flags Generation** — automated injection of fallback optimization (`-O3`/`-O0`), debug (`-g`), and warning (`-Wall -Wextra`) flags is now suppressed for bare-metal and freestanding builds if `build.cflags` are overridden.
* **Centralized Bare-Metal Detection** — relocated the `is_bare_metal_target` helper to common build utilities (`src/utils/build.rs`) for unified access across the building core.
* **Architectural Refactoring**:
* Renamed `src/config.rs` to `src/templates.rs`.
* Started consolidation of configuration and build orchestration logic.
## 0.7.3 (2026-06-13)
### Added
* **`--vcs` option for `new` and `init` commands** — introduced explicit version control system selection via `--vcs \<git|none>`.
* **Git metadata integration in `--version`** — the CLI now appends the current short commit hash and a `-dirty` suffix if there are uncommitted changes in the DCR repository.
* **Automatic `.gitignore` generation** — Git repository initialization now automatically writes a `.gitignore` file excluding the `/target` directory.
* **Nested repository prevention** — automatic Git initialization is now skipped if `dcr new` or `dcr init` is executed inside an already existing Git repository.
* **VCS verification tests** — added `new_vcs_options_work` and `init_vcs_options_work` integration tests to ensure reliable repository behavior.
### Changed
* **Complete removal of `git2` dependency** — all Git actions (dependency fetching, VCS setup, status checks) are now delegated to the system `git` executable via `Command`. This simplifies compilation and drops the need for `vendored` and `openssl` features.
* **Migrated from `reqwest` to `ureq`** — replaced the heavy `reqwest` crate in `flag_update.rs` with the lightweight synchronous `ureq 2.10` client, reducing overhead and the final binary size.
## 0.7.2 (2026-06-07)
### Added
* `default_target_triple()` now respects `target_env` — Linux (gnu/musl) and Windows (msvc/gnu) use the correct environment instead of hardcoded values.
### Fixed
* **macOS Apple Silicon builds failed with `_main` undefined** — `--target=` is now passed to ldflags, not just cflags. `default_target_triple()` uses `std::env::consts::ARCH` on macOS instead of hardcoded `x86_64`.
* **GitHub Stars and GPL-3.0 badges not rendering in README** — badge block converted to pure HTML.
### Changed
* Default target resolution extracted into shared `default_target_triple()` — removed duplication across build, run, clean.
## 0.7.1 (2026-06-02) ## 0.7.1 (2026-06-02)
### Added ### Added

View File

@@ -13,7 +13,7 @@ dcr build # debug profile
dcr build --release # release build dcr build --release # release build
dcr build --debug # explicit debug dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild dcr build --force # full rebuild (also re-runs build.steps / post_steps)
dcr build --clean # clean + build dcr build --clean # clean + build
dcr build --verbose # show compilation commands dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package dcr build --workspace pkg-a # build specific workspace package
@@ -21,6 +21,8 @@ dcr build --workspace pkg-a # build specific workspace package
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target). Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
With `[archive]` in `dcr.toml`, a FAT disk image is packed after a successful build.
## `dcr run` ## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary. Builds (if sources are newer than artifacts) and runs the binary.
@@ -28,8 +30,11 @@ Builds (if sources are newer than artifacts) and runs the binary.
```bash ```bash
dcr run dcr run
dcr run --release dcr run --release
dcr run --force # force rebuild then run
``` ```
On a **workspace-only** root: if `[run].cmd` is set, that command is used after build; otherwise DCR delegates to a workspace member.
## `dcr clean` ## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`). Removes `target/` directory (or `target/\<target>/\<profile>`).

View File

@@ -46,6 +46,6 @@ CI runs:
* `cargo fmt --check` * `cargo fmt --check`
* `cargo clippy --all-targets -- -D warnings` * `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets` * `cargo check --all-targets --all-features`
* Build on Linux, macOS, Windows * Build on Linux, macOS, Windows
* Integration tests * Integration tests (compilation check)

View File

@@ -39,27 +39,6 @@ which clang
Or specify explicitly via `[toolchain]` in `dcr.toml`. Or specify explicitly via `[toolchain]` in `dcr.toml`.
## openssl-sys build failed
When building DCR from source:
```
error: failed to run custom build command for openssl-sys
```
**Solution:** Install OpenSSL development headers:
```bash
# Ubuntu/Debian
sudo apt install libssl-dev
# Fedora
sudo dnf install openssl-devel
# macOS
brew install openssl
```
## Ctrl+C during build ## Ctrl+C during build
DCR handles SIGINT: interrupts the current compilation and exits with non-zero code. DCR handles SIGINT: interrupts the current compilation and exits with non-zero code.
@@ -76,6 +55,12 @@ See [Cross-Compile Recipe](/docs/recipes/cross-to-windows).
See [Workspace Recipe](/docs/recipes/multi-package-workspace). See [Workspace Recipe](/docs/recipes/multi-package-workspace).
## Bootloader / pure NASM OS image
Use `kind = "flat-bin"` (NASM `-f bin`) and optional `[archive]` for a FAT disk image.
See [OS-dev recipe](/docs/recipes/os-flat-bin-archive).
## Lock file ## Lock file
`dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`. `dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`.

View File

@@ -70,3 +70,10 @@ dcr test # run tests
```bash ```bash
dcr fmt # clang-format with .clang-format dcr fmt # clang-format with .clang-format
``` ```
## Linting
```bash
dcr lint # clang-tidy checks
dcr lint --fix # apply fixes automatically
```

View File

@@ -0,0 +1,89 @@
---
sidebar_label: OS-dev (flat-bin + archive)
---
# Pure ASM / boot image (flat-bin + archive)
Minimal OS-dev style pipeline: assemble raw binaries with NASM, then pack a FAT floppy/image with an optional boot sector.
## Project layout
```
myos/
dcr.toml
src/
boot.asm # boot sector (512 bytes)
kernel.asm # payload
```
For multiple flat artifacts, use a **workspace** (one member per binary) or separate packages; a single `flat-bin` package produces one binary per source stem.
## Boot package (`flat-bin`)
```toml
[package]
name = "boot"
version = "0.1.0"
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
```bash
dcr build
# → target/<…>/debug/boot.bin (NASM -f bin, no link)
```
## Disk image after build
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
```
* `format`: `fat12`, `fat16`, or `fat32`
* `size`: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default ~1.44 MiB)
* `bootsector`: written only when `offset` is omitted or `0`
* `from` may be a glob; `{profile}` is substituted in paths
## C kernel → flat binary
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldflags = ["-T", "linker.ld"]
```
Pipeline: objects → temporary linked ELF → `objcopy -O binary` → `kernel.bin`. Requires `objcopy` / `llvm-objcopy` in PATH.
## Other assemblers
| Tool | Notes |
| -------- | --------------------------------------------------------------------------------------- |
| **FASM** | Write `format binary` in the source; DCR writes `\<stem>.bin` directly |
| **GAS** | Assemble `.s` → obj → `objcopy -O binary` |
| **LLC** | `language = "llvm_ir"` → obj → objcopy |
| **MASM** | COFF obj → objcopy (needs binutils/LLVM objcopy) |
## Notes
* Single-file `roots` are supported: `roots = ["src/boot.asm"]`.
* `--force` re-runs `build.steps` / `build.post_steps` as well as recompilation.
* Prefer `kind = "elf"` if you need a relocatable ELF kernel without stripping to raw binary.

View File

@@ -56,7 +56,7 @@ moc = "moc {in} -o {out}"
### GAS / NASM / MASM / FASM / LLVM-IR ### GAS / NASM / MASM / FASM / LLVM-IR
* GAS: `-I`, `-c -o`, `--defsym` * GAS: `-I`, `-c -o`, `--defsym`
* NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32) * NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32; **`bin` when `kind = "flat-bin"`**)
* MASM: `/nologo /c /Fo\<obj> <source>` * MASM: `/nologo /c /Fo\<obj> <source>`
* FASM: `<source> \<output>` (output path is the object file) * FASM: `<source> \<output>` (output path is the object file)
* LLVM IR: `-filetype=obj <source> -o \<output>` * LLVM IR: `-filetype=obj <source> -o \<output>`
@@ -79,7 +79,7 @@ Three levels of incrementality:
## Build Kinds ## Build Kinds
| Kind | Type | Path (Linux example) | | Kind | Type | Path (Linux example) |
| ----------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | ----------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) | | `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) |
| `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) | | `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) |
| `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) | | `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) |
@@ -87,6 +87,11 @@ Three levels of incrementality:
| `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` | | `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` |
| `none` | Compile only, no link | — | | `none` | Compile only, no link | — |
| `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` | | `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` |
| `flat-bin` | Raw binary | ASM: `\<stem>.bin` (NASM `-f bin` / FASM / GAS·MASM·LLC via objcopy); C/C++: `\<name>.bin` (link + objcopy) |
## Disk images (`[archive]`)
After a successful build, if `[archive]` is present in `dcr.toml`, DCR formats a FAT volume and copies files from `layout` into the image. See [dcr.toml → archive](/docs/reference/dcr-toml#archive).
## Build Steps ## Build Steps

View File

@@ -57,14 +57,8 @@ dcr build --target aarch64-none-elf
## Target Directory ## Target Directory
On Linux with explicit target: By default, the compilation output directories are structured as follows:
``` * **Linux and BSD**: Always output to `target/\<triple>/\<profile>/` (using host triple if no target is specified).
target/<triple>/<profile>/ * **macOS and Windows (without target)**: Output to `target/\<profile>/`.
``` * **macOS and Windows (with explicit target)**: Output to `target/\<triple>/\<profile>/`.
On macOS/Windows or without target:
```
target/<profile>/
```

View File

@@ -33,6 +33,9 @@ Main project configuration file. Located at the project root.
[run] [run]
# run settings # run settings
[archive]
# optional: pack FAT disk image after build
``` ```
## [package] ## [package]
@@ -61,19 +64,19 @@ author = "John Doe"
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`. * `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description | | Field | Default | Description |
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------- | | ---------------- | ------------- | --------------------------------------------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) | | `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"`, `"llvm_ir"`, `"llvm-ir"`, `"ll"` (optional, defaults to `"c"`) |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) | | `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) | | `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) | | `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` | | `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom`, `flat-bin` |
| `target` | host | Target triple for cross-compilation | | `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi` | | `platform` | `"native"` | `native`, `efi` |
| `cflags` | `[]` | Additional C/C++/ASM flags | | `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags | | `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name | | `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension | | `extension` | `""` | Custom file extension (for `flat-bin`, default is `bin`) |
| `roots` | `["src"]` | Source root directories | | `roots` | `["src"]` | Source roots: directories and/or individual source/header files |
| `exclude` | `[]` | Exclude patterns | | `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories | | `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery | | `src_disable` | `false` | Disable auto source discovery |
@@ -97,7 +100,7 @@ Settings from raw config (not in typed struct):
* `ldscript` — linker script path * `ldscript` — linker script path
* `build.steps` / `build.post_steps` — codegen steps * `build.steps` / `build.post_steps` — codegen steps
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]` ## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`, `[build.llvm_ir]`
Each language can have its own table that overrides the flat `[build]` settings: Each language can have its own table that overrides the flat `[build]` settings:
@@ -117,6 +120,9 @@ compiler = "g++"
[build.asm] [build.asm]
compiler = "nasm" compiler = "nasm"
flags = ["-felf64"] flags = ["-felf64"]
[build.llvm_ir]
compiler = "llc"
``` ```
The flat `[build]` acts as fallback; per-language tables take precedence for their language. The flat `[build]` acts as fallback; per-language tables take precedence for their language.
@@ -174,3 +180,82 @@ Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<tripl
## [workspace] ## [workspace]
See [workspaces](/docs/reference/workspaces). See [workspaces](/docs/reference/workspaces).
## [archive]
Optional post-build step: format a FAT volume and copy built artifacts into a disk image. Runs after a successful package build (and after workspace member builds that define `[archive]`).
| Field | Required | Description |
| ------------ | -------- | ------------------------------------------------------------------------------------------- |
| `output` | yes | Image path relative to project root (`{profile}` allowed) |
| `format` | yes | `fat12`, `fat16`, or `fat32` |
| `size` | no | Image size: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default `1474560` ≈ 1.44 MiB) |
| `offset` | no | Byte offset of the FAT volume inside the image (default `0`) |
| `label` | no | Volume label (max 11 chars, default `VOLUME`) |
| `bootsector` | no | Path to a 512-byte boot sector written at offset 0 when `offset` is 0 (`{profile}` allowed) |
| `layout` | no | List of `{ from, to }` entries (files or globs → path inside the volume) |
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
[[archive.layout]]
from = "assets/*"
to = "/"
```
Typical pairing with `kind = "flat-bin"` (NASM `-f bin`) for bootloaders and pure-ASM OS images.
## `flat-bin` (kind)
Produces a raw binary (default extension `bin`) for boot sectors, kernels, and freestanding payloads.
### Assemblers
| Tool | Language / compiler | How flat-bin is produced |
| ---- | ------------------------------------------ | -------------------------------------------- |
| NASM | `language = "asm"`, `compiler = "nasm"` | `-f bin` → `\<stem>.bin` |
| FASM | `compiler = "fasm"` | direct write (use `format binary` in source) |
| GAS | `compiler = "as"` / `"gas"` | assemble → `objcopy -O binary` |
| MASM | `compiler = "ml"` / `"ml64"` | assemble → `objcopy -O binary` |
| LLC | `language = "llvm_ir"`, `compiler = "llc"` | `-filetype=obj` → `objcopy -O binary` |
```toml
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
### C / C++
Compile all sources, link with `-nostdlib -static` (plus your `ldflags` / `ldscript`), then convert the intermediate ELF/PE with `objcopy -O binary` to `\<filename|name>.bin`.
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldscript = "linker.ld"
ldflags = ["-T", "linker.ld"]
```
Notes:
* Multi-file **ASM** packages emit one `\<stem>.bin` per source; **C/C++** emit a single project binary.
* `objcopy` tools tried in order: `llvm-objcopy`, `objcopy`, `gobjcopy`.
* Incompatible with `build.qt = true`.
* `dcr run` rejects `flat-bin` (not a host executable).

View File

@@ -67,6 +67,8 @@ mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" } mylib = { path = "../relative/path" }
``` ```
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
## dcr.lock ## dcr.lock
Dependency lock file. Contains package names and sources. Dependency lock file. Contains package names and sources.

View File

@@ -11,17 +11,18 @@ DCR normalizes target triples. Short platform names are expanded to full triples
### Linux ### Linux
``` ```
target/<arch>-unknown-linux-gnu/<profile>/ target/<arch>-unknown-linux-<env>/<profile>/
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64`, `i686`, `armv7`, `riscv64` (host-detected).
Environments: `gnu` (default), `musl`.
Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib). Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib).
### macOS ### macOS
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64` (host-detected).
@@ -31,10 +32,11 @@ Extensions: `.dylib` (sharedlib), `.a` (staticlib).
### Windows ### Windows
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64`. Architectures: `x86_64`, `aarch64`.
Environments: `msvc` (default), `gnu` (MinGW).
Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI). Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI).

View File

@@ -43,7 +43,10 @@ dcr build # build all packages in dependency order
dcr build --workspace app # build only app (dependencies built automatically) dcr build --workspace app # build only app (dependencies built automatically)
``` ```
When building a workspace, member outputs (libraries) are automatically added to include/lib paths of dependent packages. When building a workspace, DCR automatically injects include and library paths of dependent workspace members:
* **Include Paths**: Automatically resolves and injects header directories of dependencies, including the member's `src/` directory, local `include/` directory, and the packaged `target/include` directory.
* **Library Paths**: Injects compiled library search paths (`target/lib` as well as target-specific build folders) to allow automatic linking with member libraries.
## Clean ## Clean

View File

@@ -51,8 +51,9 @@ dcr gen vscode
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint * **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue * **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86) * **7 backends** — gcc/clang (unix_cc), MSVC/clang-cl (msvc), GAS, NASM, MASM, FASM, LLVM IR
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom * **8 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom, flat-bin
* **Disk images** — optional `[archive]` packs FAT12/16/32 images after build
* **Cross-compilation** — short names and full triples * **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides * **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort * **Workspaces** — multi-package projects with topological sort

View File

@@ -4,6 +4,108 @@ sidebar_label: Changelog
# Changelog # Changelog
## 0.8.1 (2026-07-20)
### Added
* **`build.kind = "flat-bin"`** — raw binary (default `.bin`) for OS-dev payloads:
* **NASM** — `-f bin` → `\<stem>.bin`
* **FASM** — direct output (`format binary` in source)
* **GAS / MASM / LLC** — object → `objcopy -O binary` → `\<stem>.bin`
* **C/C++** — objects → freestanding link → `objcopy -O binary` → `\<name>.bin`
* Requires `llvm-objcopy` / `objcopy` / `gobjcopy` except for NASM/FASM direct emit
* **`[archive]` section** — after a successful build, pack a FAT disk image (`fatfs`): `output`, `format` (`fat12`/`fat16`/`fat32`), optional `size` (default 1.44 MiB), `offset`, `label`, `bootsector`, and `layout` (`from` → `to`, supports globs). `{profile}` works in paths.
* **Single-file `build.roots`** — a root may be a single source or header file, not only a directory.
### Changed
* **`--force`** also re-runs `build.steps` and `build.post_steps`.
* **`dcr run` on workspace-only root** — if `[run].cmd` is set, run that after build; otherwise delegate to a workspace member.
### Dependencies
* `fatfs = "0.3"` for FAT image packing.
## 0.8.0 (2026-07-18)
### Added
* **Dedicated Build Engine (`src/core/build/engine.rs`)** — decoupled the build orchestration logic completely from the CLI front-end wrapper in `src/cli/build.rs` to a reusable, decoupled core build engine.
* **Polymorphic Language Model (`Language` trait)** — introduced the abstract `Language` trait (`src/core/build/language/mod.rs`). File scanning, compiler resolution, and flags handling are now encapsulated in dedicated language modules for C, C++ (including Qt code generation), LLVM IR, and ASM (GAS, NASM, FASM, MASM).
* **Polymorphic Compilation Dispatch (`Builder` trait)** — introduced the `Builder` trait to generalize builder invocations (`src/core/build/builder/mod.rs`). Consolidated GCC/Clang logic into `builder/cc_common.rs` and Microsoft Visual C++ logic into `builder/msvc/`.
* **Per-Language Configuration overrides (`[build.\<lang>]`)** — introduced support for configuring language-specific compiler, standard, and flags (e.g. `[build.c]`, `[build.cxx]`, `[build.asm]`) independently in `dcr.toml`.
* **Automatic Workspace Dependency Injection** — during workspace builds, include/lib paths of dependent workspace members (including their source headers, local `include/` folders, and build target `target/include` / `target/lib` folders) are automatically resolved and injected.
* **`BuildReporter` Event System** — decoupled build orchestration output into a structured event-driven reporter model (`src/core/build/report.rs`), making DCR suitable for library embedding and IDE integrations without stderr capturing.
* **Build Cancellation Support** — introduced thread-safe cancellation tokens (`Arc\<AtomicBool>`) allowing clients to safely abort compile runs mid-execution.
* **TOML Formatting & Custom Keys Preservation** — migrated the config editor to `toml_edit`, preserving all unknown/user-defined TOML keys, structures, and comments during file write operations (e.g., in `dcr add`).
* **Path Dependencies Target Include Resolution** — local path dependencies configured via tables now correctly expose headers built and packaged into their `target/include` folder to consumer packages.
* **Modular Integration Test Suite** — refactored the monolith `tests/cli_basic.rs` file into clean, specialized integration tests: `cli_build.rs`, `cli_deps.rs`, `cli_lint.rs`, `cli_new.rs`, `cli_qt.rs`, `cli_test.rs`, `cli_workspace.rs`.
### Changed
* **Consolidated Linking and Archiving** — artifact generation (linking executables/shared libraries and archiving static libraries) consolidated into a single `src/core/build/builder/artifact.rs` module.
* **Workspace-Aware member execution** — `dcr run` executed at the workspace root of a `workspace_only` project now triggers the member build inside the workspace context using the `--workspace` parameter, preventing standalone build issues.
* **Elimination of Global State** — removed global variables and states from the build core, encapsulating build logic inside isolated `BuildContext` structs for thread safety.
* **Build Cache Separation** — relocated mtime tracking, incremental caching, and header-dependency checking logic to `src/core/build/cache.rs`.
* **Modularized Pre-build Steps** — decoupled generator scripts and pre-build commands parsing into `src/core/build/steps.rs`.
## 0.7.4 (2026-06-17)
### Added
* **Native Qt support** — automatic meta-object handling (MOC, UIC, RCC) added when `build.qt = true` is set in `dcr.toml`.
* **`dcr lint` command** — C/C++ static analysis via `clang-tidy`. Supports `--fix` for automatic fixes. Respects `build.roots` and `build.src_disable` from config.
* **Three new assembler backends**:
* **MASM** (`compiler = "ml"` / `"ml64"`) — Microsoft Macro Assembler.
* **FASM** (`compiler = "fasm"`) — Flat Assembler.
* **LLVM IR** (`compiler = "llc"`) — compiles `.ll` files via `llc -filetype=obj`.
* **Shared ASM pipeline** — linking and archiving logic consolidated into `core/builder/asm.rs`. Adding a new assembler backend now takes ~30 lines.
* **Filesystem utilities** — `to_hex()` and `home_dir()` extracted to `utils/fs.rs`.
* **Build utilities** — `normalize_target()`, `normalize_kind()`, `normalize_platform()`, `default_profile_flags()` extracted to `utils/build.rs`.
* **Backend helpers** — `asm_lang_flag()`, `source_extensions()`, `elapsed_secs()` added to `core/builder/common.rs`.
* **Full Bare-Metal / Freestanding Automation** — introduced the `build.freestanding = true` configuration option. When enabled (or when a bare-metal target is detected), DCR automatically injects `-ffreestanding` during compilation and both `-nostdlib` and `-static` during linking.
* **Artifact Optimization (LTO & Strip)** — added `build.lto` (auto-injects `-flto` for compiler and linker) and `build.strip` (automatically strips debug symbols via linker `-s` flag) options to `dcr.toml`.
* **Compilation Thread Control** — added the `build.codegen-units` option to strictly limit the maximum number of parallel jobs utilized by the custom `parallel_build` worker pool.
* **Panic Behavior Management** — added `build.panic = "abort"` support. For C++ targets, it automatically strips exception handling and unwind tables via `-fno-exceptions`, `-fno-unwind-tables`, and `-fno-asynchronous-unwind-tables`.
### Changed
* **Intelligent Default Flags Generation** — automated injection of fallback optimization (`-O3`/`-O0`), debug (`-g`), and warning (`-Wall -Wextra`) flags is now suppressed for bare-metal and freestanding builds if `build.cflags` are overridden.
* **Centralized Bare-Metal Detection** — relocated the `is_bare_metal_target` helper to common build utilities (`src/utils/build.rs`) for unified access across the building core.
* **Architectural Refactoring**:
* Renamed `src/config.rs` to `src/templates.rs`.
* Started consolidation of configuration and build orchestration logic.
## 0.7.3 (2026-06-13)
### Added
* **`--vcs` option for `new` and `init` commands** — introduced explicit version control system selection via `--vcs \<git|none>`.
* **Git metadata integration in `--version`** — the CLI now appends the current short commit hash and a `-dirty` suffix if there are uncommitted changes in the DCR repository.
* **Automatic `.gitignore` generation** — Git repository initialization now automatically writes a `.gitignore` file excluding the `/target` directory.
* **Nested repository prevention** — automatic Git initialization is now skipped if `dcr new` or `dcr init` is executed inside an already existing Git repository.
* **VCS verification tests** — added `new_vcs_options_work` and `init_vcs_options_work` integration tests to ensure reliable repository behavior.
### Changed
* **Complete removal of `git2` dependency** — all Git actions (dependency fetching, VCS setup, status checks) are now delegated to the system `git` executable via `Command`. This simplifies compilation and drops the need for `vendored` and `openssl` features.
* **Migrated from `reqwest` to `ureq`** — replaced the heavy `reqwest` crate in `flag_update.rs` with the lightweight synchronous `ureq 2.10` client, reducing overhead and the final binary size.
## 0.7.2 (2026-06-07)
### Added
* `default_target_triple()` now respects `target_env` — Linux (gnu/musl) and Windows (msvc/gnu) use the correct environment instead of hardcoded values.
### Fixed
* **macOS Apple Silicon builds failed with `_main` undefined** — `--target=` is now passed to ldflags, not just cflags. `default_target_triple()` uses `std::env::consts::ARCH` on macOS instead of hardcoded `x86_64`.
* **GitHub Stars and GPL-3.0 badges not rendering in README** — badge block converted to pure HTML.
### Changed
* Default target resolution extracted into shared `default_target_triple()` — removed duplication across build, run, clean.
## 0.7.1 (2026-06-02) ## 0.7.1 (2026-06-02)
### Added ### Added

View File

@@ -13,7 +13,7 @@ dcr build # debug profile
dcr build --release # release build dcr build --release # release build
dcr build --debug # explicit debug dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild dcr build --force # full rebuild (also re-runs build.steps / post_steps)
dcr build --clean # clean + build dcr build --clean # clean + build
dcr build --verbose # show compilation commands dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package dcr build --workspace pkg-a # build specific workspace package
@@ -21,6 +21,8 @@ dcr build --workspace pkg-a # build specific workspace package
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target). Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
With `[archive]` in `dcr.toml`, a FAT disk image is packed after a successful build.
## `dcr run` ## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary. Builds (if sources are newer than artifacts) and runs the binary.
@@ -28,8 +30,11 @@ Builds (if sources are newer than artifacts) and runs the binary.
```bash ```bash
dcr run dcr run
dcr run --release dcr run --release
dcr run --force # force rebuild then run
``` ```
On a **workspace-only** root: if `[run].cmd` is set, that command is used after build; otherwise DCR delegates to a workspace member.
## `dcr clean` ## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`). Removes `target/` directory (or `target/\<target>/\<profile>`).

View File

@@ -46,6 +46,6 @@ CI runs:
* `cargo fmt --check` * `cargo fmt --check`
* `cargo clippy --all-targets -- -D warnings` * `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets` * `cargo check --all-targets --all-features`
* Build on Linux, macOS, Windows * Build on Linux, macOS, Windows
* Integration tests * Integration tests (compilation check)

View File

@@ -39,27 +39,6 @@ which clang
Or specify explicitly via `[toolchain]` in `dcr.toml`. Or specify explicitly via `[toolchain]` in `dcr.toml`.
## openssl-sys build failed
When building DCR from source:
```
error: failed to run custom build command for openssl-sys
```
**Solution:** Install OpenSSL development headers:
```bash
# Ubuntu/Debian
sudo apt install libssl-dev
# Fedora
sudo dnf install openssl-devel
# macOS
brew install openssl
```
## Ctrl+C during build ## Ctrl+C during build
DCR handles SIGINT: interrupts the current compilation and exits with non-zero code. DCR handles SIGINT: interrupts the current compilation and exits with non-zero code.
@@ -76,6 +55,12 @@ See [Cross-Compile Recipe](/docs/recipes/cross-to-windows).
See [Workspace Recipe](/docs/recipes/multi-package-workspace). See [Workspace Recipe](/docs/recipes/multi-package-workspace).
## Bootloader / pure NASM OS image
Use `kind = "flat-bin"` (NASM `-f bin`) and optional `[archive]` for a FAT disk image.
See [OS-dev recipe](/docs/recipes/os-flat-bin-archive).
## Lock file ## Lock file
`dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`. `dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`.

View File

@@ -70,3 +70,10 @@ dcr test # run tests
```bash ```bash
dcr fmt # clang-format with .clang-format dcr fmt # clang-format with .clang-format
``` ```
## Linting
```bash
dcr lint # clang-tidy checks
dcr lint --fix # apply fixes automatically
```

View File

@@ -0,0 +1,89 @@
---
sidebar_label: OS-dev (flat-bin + archive)
---
# Pure ASM / boot image (flat-bin + archive)
Minimal OS-dev style pipeline: assemble raw binaries with NASM, then pack a FAT floppy/image with an optional boot sector.
## Project layout
```
myos/
dcr.toml
src/
boot.asm # boot sector (512 bytes)
kernel.asm # payload
```
For multiple flat artifacts, use a **workspace** (one member per binary) or separate packages; a single `flat-bin` package produces one binary per source stem.
## Boot package (`flat-bin`)
```toml
[package]
name = "boot"
version = "0.1.0"
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
```bash
dcr build
# → target/<…>/debug/boot.bin (NASM -f bin, no link)
```
## Disk image after build
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
```
* `format`: `fat12`, `fat16`, or `fat32`
* `size`: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default ~1.44 MiB)
* `bootsector`: written only when `offset` is omitted or `0`
* `from` may be a glob; `{profile}` is substituted in paths
## C kernel → flat binary
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldflags = ["-T", "linker.ld"]
```
Pipeline: objects → temporary linked ELF → `objcopy -O binary` → `kernel.bin`. Requires `objcopy` / `llvm-objcopy` in PATH.
## Other assemblers
| Tool | Notes |
| -------- | --------------------------------------------------------------------------------------- |
| **FASM** | Write `format binary` in the source; DCR writes `\<stem>.bin` directly |
| **GAS** | Assemble `.s` → obj → `objcopy -O binary` |
| **LLC** | `language = "llvm_ir"` → obj → objcopy |
| **MASM** | COFF obj → objcopy (needs binutils/LLVM objcopy) |
## Notes
* Single-file `roots` are supported: `roots = ["src/boot.asm"]`.
* `--force` re-runs `build.steps` / `build.post_steps` as well as recompilation.
* Prefer `kind = "elf"` if you need a relocatable ELF kernel without stripping to raw binary.

View File

@@ -56,7 +56,7 @@ moc = "moc {in} -o {out}"
### GAS / NASM / MASM / FASM / LLVM-IR ### GAS / NASM / MASM / FASM / LLVM-IR
* GAS: `-I`, `-c -o`, `--defsym` * GAS: `-I`, `-c -o`, `--defsym`
* NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32) * NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32; **`bin` when `kind = "flat-bin"`**)
* MASM: `/nologo /c /Fo\<obj> <source>` * MASM: `/nologo /c /Fo\<obj> <source>`
* FASM: `<source> \<output>` (output path is the object file) * FASM: `<source> \<output>` (output path is the object file)
* LLVM IR: `-filetype=obj <source> -o \<output>` * LLVM IR: `-filetype=obj <source> -o \<output>`
@@ -79,7 +79,7 @@ Three levels of incrementality:
## Build Kinds ## Build Kinds
| Kind | Type | Path (Linux example) | | Kind | Type | Path (Linux example) |
| ----------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | ----------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) | | `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) |
| `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) | | `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) |
| `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) | | `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) |
@@ -87,6 +87,11 @@ Three levels of incrementality:
| `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` | | `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` |
| `none` | Compile only, no link | — | | `none` | Compile only, no link | — |
| `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` | | `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` |
| `flat-bin` | Raw binary | ASM: `\<stem>.bin` (NASM `-f bin` / FASM / GAS·MASM·LLC via objcopy); C/C++: `\<name>.bin` (link + objcopy) |
## Disk images (`[archive]`)
After a successful build, if `[archive]` is present in `dcr.toml`, DCR formats a FAT volume and copies files from `layout` into the image. See [dcr.toml → archive](/docs/reference/dcr-toml#archive).
## Build Steps ## Build Steps

View File

@@ -57,14 +57,8 @@ dcr build --target aarch64-none-elf
## Target Directory ## Target Directory
On Linux with explicit target: By default, the compilation output directories are structured as follows:
``` * **Linux and BSD**: Always output to `target/\<triple>/\<profile>/` (using host triple if no target is specified).
target/<triple>/<profile>/ * **macOS and Windows (without target)**: Output to `target/\<profile>/`.
``` * **macOS and Windows (with explicit target)**: Output to `target/\<triple>/\<profile>/`.
On macOS/Windows or without target:
```
target/<profile>/
```

View File

@@ -33,6 +33,9 @@ Main project configuration file. Located at the project root.
[run] [run]
# run settings # run settings
[archive]
# optional: pack FAT disk image after build
``` ```
## [package] ## [package]
@@ -61,19 +64,19 @@ author = "John Doe"
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`. * `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description | | Field | Default | Description |
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------- | | ---------------- | ------------- | --------------------------------------------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) | | `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"`, `"llvm_ir"`, `"llvm-ir"`, `"ll"` (optional, defaults to `"c"`) |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) | | `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) | | `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) | | `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` | | `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom`, `flat-bin` |
| `target` | host | Target triple for cross-compilation | | `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi` | | `platform` | `"native"` | `native`, `efi` |
| `cflags` | `[]` | Additional C/C++/ASM flags | | `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags | | `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name | | `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension | | `extension` | `""` | Custom file extension (for `flat-bin`, default is `bin`) |
| `roots` | `["src"]` | Source root directories | | `roots` | `["src"]` | Source roots: directories and/or individual source/header files |
| `exclude` | `[]` | Exclude patterns | | `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories | | `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery | | `src_disable` | `false` | Disable auto source discovery |
@@ -97,7 +100,7 @@ Settings from raw config (not in typed struct):
* `ldscript` — linker script path * `ldscript` — linker script path
* `build.steps` / `build.post_steps` — codegen steps * `build.steps` / `build.post_steps` — codegen steps
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]` ## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`, `[build.llvm_ir]`
Each language can have its own table that overrides the flat `[build]` settings: Each language can have its own table that overrides the flat `[build]` settings:
@@ -117,6 +120,9 @@ compiler = "g++"
[build.asm] [build.asm]
compiler = "nasm" compiler = "nasm"
flags = ["-felf64"] flags = ["-felf64"]
[build.llvm_ir]
compiler = "llc"
``` ```
The flat `[build]` acts as fallback; per-language tables take precedence for their language. The flat `[build]` acts as fallback; per-language tables take precedence for their language.
@@ -174,3 +180,82 @@ Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<tripl
## [workspace] ## [workspace]
See [workspaces](/docs/reference/workspaces). See [workspaces](/docs/reference/workspaces).
## [archive]
Optional post-build step: format a FAT volume and copy built artifacts into a disk image. Runs after a successful package build (and after workspace member builds that define `[archive]`).
| Field | Required | Description |
| ------------ | -------- | ------------------------------------------------------------------------------------------- |
| `output` | yes | Image path relative to project root (`{profile}` allowed) |
| `format` | yes | `fat12`, `fat16`, or `fat32` |
| `size` | no | Image size: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default `1474560` ≈ 1.44 MiB) |
| `offset` | no | Byte offset of the FAT volume inside the image (default `0`) |
| `label` | no | Volume label (max 11 chars, default `VOLUME`) |
| `bootsector` | no | Path to a 512-byte boot sector written at offset 0 when `offset` is 0 (`{profile}` allowed) |
| `layout` | no | List of `{ from, to }` entries (files or globs → path inside the volume) |
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
[[archive.layout]]
from = "assets/*"
to = "/"
```
Typical pairing with `kind = "flat-bin"` (NASM `-f bin`) for bootloaders and pure-ASM OS images.
## `flat-bin` (kind)
Produces a raw binary (default extension `bin`) for boot sectors, kernels, and freestanding payloads.
### Assemblers
| Tool | Language / compiler | How flat-bin is produced |
| ---- | ------------------------------------------ | -------------------------------------------- |
| NASM | `language = "asm"`, `compiler = "nasm"` | `-f bin` → `\<stem>.bin` |
| FASM | `compiler = "fasm"` | direct write (use `format binary` in source) |
| GAS | `compiler = "as"` / `"gas"` | assemble → `objcopy -O binary` |
| MASM | `compiler = "ml"` / `"ml64"` | assemble → `objcopy -O binary` |
| LLC | `language = "llvm_ir"`, `compiler = "llc"` | `-filetype=obj` → `objcopy -O binary` |
```toml
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
### C / C++
Compile all sources, link with `-nostdlib -static` (plus your `ldflags` / `ldscript`), then convert the intermediate ELF/PE with `objcopy -O binary` to `\<filename|name>.bin`.
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldscript = "linker.ld"
ldflags = ["-T", "linker.ld"]
```
Notes:
* Multi-file **ASM** packages emit one `\<stem>.bin` per source; **C/C++** emit a single project binary.
* `objcopy` tools tried in order: `llvm-objcopy`, `objcopy`, `gobjcopy`.
* Incompatible with `build.qt = true`.
* `dcr run` rejects `flat-bin` (not a host executable).

View File

@@ -67,6 +67,8 @@ mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" } mylib = { path = "../relative/path" }
``` ```
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
## dcr.lock ## dcr.lock
Dependency lock file. Contains package names and sources. Dependency lock file. Contains package names and sources.

View File

@@ -11,17 +11,18 @@ DCR normalizes target triples. Short platform names are expanded to full triples
### Linux ### Linux
``` ```
target/<arch>-unknown-linux-gnu/<profile>/ target/<arch>-unknown-linux-<env>/<profile>/
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64`, `i686`, `armv7`, `riscv64` (host-detected).
Environments: `gnu` (default), `musl`.
Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib). Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib).
### macOS ### macOS
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64` (host-detected).
@@ -31,10 +32,11 @@ Extensions: `.dylib` (sharedlib), `.a` (staticlib).
### Windows ### Windows
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64`. Architectures: `x86_64`, `aarch64`.
Environments: `msvc` (default), `gnu` (MinGW).
Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI). Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI).

View File

@@ -43,7 +43,10 @@ dcr build # build all packages in dependency order
dcr build --workspace app # build only app (dependencies built automatically) dcr build --workspace app # build only app (dependencies built automatically)
``` ```
When building a workspace, member outputs (libraries) are automatically added to include/lib paths of dependent packages. When building a workspace, DCR automatically injects include and library paths of dependent workspace members:
* **Include Paths**: Automatically resolves and injects header directories of dependencies, including the member's `src/` directory, local `include/` directory, and the packaged `target/include` directory.
* **Library Paths**: Injects compiled library search paths (`target/lib` as well as target-specific build folders) to allow automatic linking with member libraries.
## Clean ## Clean

View File

@@ -51,8 +51,9 @@ dcr gen vscode
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint * **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue * **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86) * **7 backends** — gcc/clang (unix_cc), MSVC/clang-cl (msvc), GAS, NASM, MASM, FASM, LLVM IR
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom * **8 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom, flat-bin
* **Disk images** — optional `[archive]` packs FAT12/16/32 images after build
* **Cross-compilation** — short names and full triples * **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides * **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort * **Workspaces** — multi-package projects with topological sort

View File

@@ -4,6 +4,108 @@ sidebar_label: Changelog
# Changelog # Changelog
## 0.8.1 (2026-07-20)
### Added
* **`build.kind = "flat-bin"`** — raw binary (default `.bin`) for OS-dev payloads:
* **NASM** — `-f bin` → `\<stem>.bin`
* **FASM** — direct output (`format binary` in source)
* **GAS / MASM / LLC** — object → `objcopy -O binary` → `\<stem>.bin`
* **C/C++** — objects → freestanding link → `objcopy -O binary` → `\<name>.bin`
* Requires `llvm-objcopy` / `objcopy` / `gobjcopy` except for NASM/FASM direct emit
* **`[archive]` section** — after a successful build, pack a FAT disk image (`fatfs`): `output`, `format` (`fat12`/`fat16`/`fat32`), optional `size` (default 1.44 MiB), `offset`, `label`, `bootsector`, and `layout` (`from` → `to`, supports globs). `{profile}` works in paths.
* **Single-file `build.roots`** — a root may be a single source or header file, not only a directory.
### Changed
* **`--force`** also re-runs `build.steps` and `build.post_steps`.
* **`dcr run` on workspace-only root** — if `[run].cmd` is set, run that after build; otherwise delegate to a workspace member.
### Dependencies
* `fatfs = "0.3"` for FAT image packing.
## 0.8.0 (2026-07-18)
### Added
* **Dedicated Build Engine (`src/core/build/engine.rs`)** — decoupled the build orchestration logic completely from the CLI front-end wrapper in `src/cli/build.rs` to a reusable, decoupled core build engine.
* **Polymorphic Language Model (`Language` trait)** — introduced the abstract `Language` trait (`src/core/build/language/mod.rs`). File scanning, compiler resolution, and flags handling are now encapsulated in dedicated language modules for C, C++ (including Qt code generation), LLVM IR, and ASM (GAS, NASM, FASM, MASM).
* **Polymorphic Compilation Dispatch (`Builder` trait)** — introduced the `Builder` trait to generalize builder invocations (`src/core/build/builder/mod.rs`). Consolidated GCC/Clang logic into `builder/cc_common.rs` and Microsoft Visual C++ logic into `builder/msvc/`.
* **Per-Language Configuration overrides (`[build.\<lang>]`)** — introduced support for configuring language-specific compiler, standard, and flags (e.g. `[build.c]`, `[build.cxx]`, `[build.asm]`) independently in `dcr.toml`.
* **Automatic Workspace Dependency Injection** — during workspace builds, include/lib paths of dependent workspace members (including their source headers, local `include/` folders, and build target `target/include` / `target/lib` folders) are automatically resolved and injected.
* **`BuildReporter` Event System** — decoupled build orchestration output into a structured event-driven reporter model (`src/core/build/report.rs`), making DCR suitable for library embedding and IDE integrations without stderr capturing.
* **Build Cancellation Support** — introduced thread-safe cancellation tokens (`Arc\<AtomicBool>`) allowing clients to safely abort compile runs mid-execution.
* **TOML Formatting & Custom Keys Preservation** — migrated the config editor to `toml_edit`, preserving all unknown/user-defined TOML keys, structures, and comments during file write operations (e.g., in `dcr add`).
* **Path Dependencies Target Include Resolution** — local path dependencies configured via tables now correctly expose headers built and packaged into their `target/include` folder to consumer packages.
* **Modular Integration Test Suite** — refactored the monolith `tests/cli_basic.rs` file into clean, specialized integration tests: `cli_build.rs`, `cli_deps.rs`, `cli_lint.rs`, `cli_new.rs`, `cli_qt.rs`, `cli_test.rs`, `cli_workspace.rs`.
### Changed
* **Consolidated Linking and Archiving** — artifact generation (linking executables/shared libraries and archiving static libraries) consolidated into a single `src/core/build/builder/artifact.rs` module.
* **Workspace-Aware member execution** — `dcr run` executed at the workspace root of a `workspace_only` project now triggers the member build inside the workspace context using the `--workspace` parameter, preventing standalone build issues.
* **Elimination of Global State** — removed global variables and states from the build core, encapsulating build logic inside isolated `BuildContext` structs for thread safety.
* **Build Cache Separation** — relocated mtime tracking, incremental caching, and header-dependency checking logic to `src/core/build/cache.rs`.
* **Modularized Pre-build Steps** — decoupled generator scripts and pre-build commands parsing into `src/core/build/steps.rs`.
## 0.7.4 (2026-06-17)
### Added
* **Native Qt support** — automatic meta-object handling (MOC, UIC, RCC) added when `build.qt = true` is set in `dcr.toml`.
* **`dcr lint` command** — C/C++ static analysis via `clang-tidy`. Supports `--fix` for automatic fixes. Respects `build.roots` and `build.src_disable` from config.
* **Three new assembler backends**:
* **MASM** (`compiler = "ml"` / `"ml64"`) — Microsoft Macro Assembler.
* **FASM** (`compiler = "fasm"`) — Flat Assembler.
* **LLVM IR** (`compiler = "llc"`) — compiles `.ll` files via `llc -filetype=obj`.
* **Shared ASM pipeline** — linking and archiving logic consolidated into `core/builder/asm.rs`. Adding a new assembler backend now takes ~30 lines.
* **Filesystem utilities** — `to_hex()` and `home_dir()` extracted to `utils/fs.rs`.
* **Build utilities** — `normalize_target()`, `normalize_kind()`, `normalize_platform()`, `default_profile_flags()` extracted to `utils/build.rs`.
* **Backend helpers** — `asm_lang_flag()`, `source_extensions()`, `elapsed_secs()` added to `core/builder/common.rs`.
* **Full Bare-Metal / Freestanding Automation** — introduced the `build.freestanding = true` configuration option. When enabled (or when a bare-metal target is detected), DCR automatically injects `-ffreestanding` during compilation and both `-nostdlib` and `-static` during linking.
* **Artifact Optimization (LTO & Strip)** — added `build.lto` (auto-injects `-flto` for compiler and linker) and `build.strip` (automatically strips debug symbols via linker `-s` flag) options to `dcr.toml`.
* **Compilation Thread Control** — added the `build.codegen-units` option to strictly limit the maximum number of parallel jobs utilized by the custom `parallel_build` worker pool.
* **Panic Behavior Management** — added `build.panic = "abort"` support. For C++ targets, it automatically strips exception handling and unwind tables via `-fno-exceptions`, `-fno-unwind-tables`, and `-fno-asynchronous-unwind-tables`.
### Changed
* **Intelligent Default Flags Generation** — automated injection of fallback optimization (`-O3`/`-O0`), debug (`-g`), and warning (`-Wall -Wextra`) flags is now suppressed for bare-metal and freestanding builds if `build.cflags` are overridden.
* **Centralized Bare-Metal Detection** — relocated the `is_bare_metal_target` helper to common build utilities (`src/utils/build.rs`) for unified access across the building core.
* **Architectural Refactoring**:
* Renamed `src/config.rs` to `src/templates.rs`.
* Started consolidation of configuration and build orchestration logic.
## 0.7.3 (2026-06-13)
### Added
* **`--vcs` option for `new` and `init` commands** — introduced explicit version control system selection via `--vcs \<git|none>`.
* **Git metadata integration in `--version`** — the CLI now appends the current short commit hash and a `-dirty` suffix if there are uncommitted changes in the DCR repository.
* **Automatic `.gitignore` generation** — Git repository initialization now automatically writes a `.gitignore` file excluding the `/target` directory.
* **Nested repository prevention** — automatic Git initialization is now skipped if `dcr new` or `dcr init` is executed inside an already existing Git repository.
* **VCS verification tests** — added `new_vcs_options_work` and `init_vcs_options_work` integration tests to ensure reliable repository behavior.
### Changed
* **Complete removal of `git2` dependency** — all Git actions (dependency fetching, VCS setup, status checks) are now delegated to the system `git` executable via `Command`. This simplifies compilation and drops the need for `vendored` and `openssl` features.
* **Migrated from `reqwest` to `ureq`** — replaced the heavy `reqwest` crate in `flag_update.rs` with the lightweight synchronous `ureq 2.10` client, reducing overhead and the final binary size.
## 0.7.2 (2026-06-07)
### Added
* `default_target_triple()` now respects `target_env` — Linux (gnu/musl) and Windows (msvc/gnu) use the correct environment instead of hardcoded values.
### Fixed
* **macOS Apple Silicon builds failed with `_main` undefined** — `--target=` is now passed to ldflags, not just cflags. `default_target_triple()` uses `std::env::consts::ARCH` on macOS instead of hardcoded `x86_64`.
* **GitHub Stars and GPL-3.0 badges not rendering in README** — badge block converted to pure HTML.
### Changed
* Default target resolution extracted into shared `default_target_triple()` — removed duplication across build, run, clean.
## 0.7.1 (2026-06-02) ## 0.7.1 (2026-06-02)
### Added ### Added

View File

@@ -13,7 +13,7 @@ dcr build # debug profile
dcr build --release # release build dcr build --release # release build
dcr build --debug # explicit debug dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild dcr build --force # full rebuild (also re-runs build.steps / post_steps)
dcr build --clean # clean + build dcr build --clean # clean + build
dcr build --verbose # show compilation commands dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package dcr build --workspace pkg-a # build specific workspace package
@@ -21,6 +21,8 @@ dcr build --workspace pkg-a # build specific workspace package
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target). Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
With `[archive]` in `dcr.toml`, a FAT disk image is packed after a successful build.
## `dcr run` ## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary. Builds (if sources are newer than artifacts) and runs the binary.
@@ -28,8 +30,11 @@ Builds (if sources are newer than artifacts) and runs the binary.
```bash ```bash
dcr run dcr run
dcr run --release dcr run --release
dcr run --force # force rebuild then run
``` ```
On a **workspace-only** root: if `[run].cmd` is set, that command is used after build; otherwise DCR delegates to a workspace member.
## `dcr clean` ## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`). Removes `target/` directory (or `target/\<target>/\<profile>`).

View File

@@ -46,6 +46,6 @@ CI runs:
* `cargo fmt --check` * `cargo fmt --check`
* `cargo clippy --all-targets -- -D warnings` * `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets` * `cargo check --all-targets --all-features`
* Build on Linux, macOS, Windows * Build on Linux, macOS, Windows
* Integration tests * Integration tests (compilation check)

View File

@@ -39,27 +39,6 @@ which clang
Or specify explicitly via `[toolchain]` in `dcr.toml`. Or specify explicitly via `[toolchain]` in `dcr.toml`.
## openssl-sys build failed
When building DCR from source:
```
error: failed to run custom build command for openssl-sys
```
**Solution:** Install OpenSSL development headers:
```bash
# Ubuntu/Debian
sudo apt install libssl-dev
# Fedora
sudo dnf install openssl-devel
# macOS
brew install openssl
```
## Ctrl+C during build ## Ctrl+C during build
DCR handles SIGINT: interrupts the current compilation and exits with non-zero code. DCR handles SIGINT: interrupts the current compilation and exits with non-zero code.
@@ -76,6 +55,12 @@ See [Cross-Compile Recipe](/docs/recipes/cross-to-windows).
See [Workspace Recipe](/docs/recipes/multi-package-workspace). See [Workspace Recipe](/docs/recipes/multi-package-workspace).
## Bootloader / pure NASM OS image
Use `kind = "flat-bin"` (NASM `-f bin`) and optional `[archive]` for a FAT disk image.
See [OS-dev recipe](/docs/recipes/os-flat-bin-archive).
## Lock file ## Lock file
`dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`. `dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`.

View File

@@ -70,3 +70,10 @@ dcr test # run tests
```bash ```bash
dcr fmt # clang-format with .clang-format dcr fmt # clang-format with .clang-format
``` ```
## Linting
```bash
dcr lint # clang-tidy checks
dcr lint --fix # apply fixes automatically
```

View File

@@ -0,0 +1,89 @@
---
sidebar_label: OS-dev (flat-bin + archive)
---
# Pure ASM / boot image (flat-bin + archive)
Minimal OS-dev style pipeline: assemble raw binaries with NASM, then pack a FAT floppy/image with an optional boot sector.
## Project layout
```
myos/
dcr.toml
src/
boot.asm # boot sector (512 bytes)
kernel.asm # payload
```
For multiple flat artifacts, use a **workspace** (one member per binary) or separate packages; a single `flat-bin` package produces one binary per source stem.
## Boot package (`flat-bin`)
```toml
[package]
name = "boot"
version = "0.1.0"
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
```bash
dcr build
# → target/<…>/debug/boot.bin (NASM -f bin, no link)
```
## Disk image after build
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
```
* `format`: `fat12`, `fat16`, or `fat32`
* `size`: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default ~1.44 MiB)
* `bootsector`: written only when `offset` is omitted or `0`
* `from` may be a glob; `{profile}` is substituted in paths
## C kernel → flat binary
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldflags = ["-T", "linker.ld"]
```
Pipeline: objects → temporary linked ELF → `objcopy -O binary` → `kernel.bin`. Requires `objcopy` / `llvm-objcopy` in PATH.
## Other assemblers
| Tool | Notes |
| -------- | --------------------------------------------------------------------------------------- |
| **FASM** | Write `format binary` in the source; DCR writes `\<stem>.bin` directly |
| **GAS** | Assemble `.s` → obj → `objcopy -O binary` |
| **LLC** | `language = "llvm_ir"` → obj → objcopy |
| **MASM** | COFF obj → objcopy (needs binutils/LLVM objcopy) |
## Notes
* Single-file `roots` are supported: `roots = ["src/boot.asm"]`.
* `--force` re-runs `build.steps` / `build.post_steps` as well as recompilation.
* Prefer `kind = "elf"` if you need a relocatable ELF kernel without stripping to raw binary.

View File

@@ -56,7 +56,7 @@ moc = "moc {in} -o {out}"
### GAS / NASM / MASM / FASM / LLVM-IR ### GAS / NASM / MASM / FASM / LLVM-IR
* GAS: `-I`, `-c -o`, `--defsym` * GAS: `-I`, `-c -o`, `--defsym`
* NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32) * NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32; **`bin` when `kind = "flat-bin"`**)
* MASM: `/nologo /c /Fo\<obj> <source>` * MASM: `/nologo /c /Fo\<obj> <source>`
* FASM: `<source> \<output>` (output path is the object file) * FASM: `<source> \<output>` (output path is the object file)
* LLVM IR: `-filetype=obj <source> -o \<output>` * LLVM IR: `-filetype=obj <source> -o \<output>`
@@ -79,7 +79,7 @@ Three levels of incrementality:
## Build Kinds ## Build Kinds
| Kind | Type | Path (Linux example) | | Kind | Type | Path (Linux example) |
| ----------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | ----------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) | | `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) |
| `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) | | `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) |
| `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) | | `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) |
@@ -87,6 +87,11 @@ Three levels of incrementality:
| `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` | | `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` |
| `none` | Compile only, no link | — | | `none` | Compile only, no link | — |
| `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` | | `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` |
| `flat-bin` | Raw binary | ASM: `\<stem>.bin` (NASM `-f bin` / FASM / GAS·MASM·LLC via objcopy); C/C++: `\<name>.bin` (link + objcopy) |
## Disk images (`[archive]`)
After a successful build, if `[archive]` is present in `dcr.toml`, DCR formats a FAT volume and copies files from `layout` into the image. See [dcr.toml → archive](/docs/reference/dcr-toml#archive).
## Build Steps ## Build Steps

View File

@@ -57,14 +57,8 @@ dcr build --target aarch64-none-elf
## Target Directory ## Target Directory
On Linux with explicit target: By default, the compilation output directories are structured as follows:
``` * **Linux and BSD**: Always output to `target/\<triple>/\<profile>/` (using host triple if no target is specified).
target/<triple>/<profile>/ * **macOS and Windows (without target)**: Output to `target/\<profile>/`.
``` * **macOS and Windows (with explicit target)**: Output to `target/\<triple>/\<profile>/`.
On macOS/Windows or without target:
```
target/<profile>/
```

View File

@@ -33,6 +33,9 @@ Main project configuration file. Located at the project root.
[run] [run]
# run settings # run settings
[archive]
# optional: pack FAT disk image after build
``` ```
## [package] ## [package]
@@ -61,19 +64,19 @@ author = "John Doe"
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`. * `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description | | Field | Default | Description |
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------- | | ---------------- | ------------- | --------------------------------------------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) | | `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"`, `"llvm_ir"`, `"llvm-ir"`, `"ll"` (optional, defaults to `"c"`) |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) | | `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) | | `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) | | `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` | | `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom`, `flat-bin` |
| `target` | host | Target triple for cross-compilation | | `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi` | | `platform` | `"native"` | `native`, `efi` |
| `cflags` | `[]` | Additional C/C++/ASM flags | | `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags | | `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name | | `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension | | `extension` | `""` | Custom file extension (for `flat-bin`, default is `bin`) |
| `roots` | `["src"]` | Source root directories | | `roots` | `["src"]` | Source roots: directories and/or individual source/header files |
| `exclude` | `[]` | Exclude patterns | | `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories | | `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery | | `src_disable` | `false` | Disable auto source discovery |
@@ -97,7 +100,7 @@ Settings from raw config (not in typed struct):
* `ldscript` — linker script path * `ldscript` — linker script path
* `build.steps` / `build.post_steps` — codegen steps * `build.steps` / `build.post_steps` — codegen steps
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]` ## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`, `[build.llvm_ir]`
Each language can have its own table that overrides the flat `[build]` settings: Each language can have its own table that overrides the flat `[build]` settings:
@@ -117,6 +120,9 @@ compiler = "g++"
[build.asm] [build.asm]
compiler = "nasm" compiler = "nasm"
flags = ["-felf64"] flags = ["-felf64"]
[build.llvm_ir]
compiler = "llc"
``` ```
The flat `[build]` acts as fallback; per-language tables take precedence for their language. The flat `[build]` acts as fallback; per-language tables take precedence for their language.
@@ -174,3 +180,82 @@ Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<tripl
## [workspace] ## [workspace]
See [workspaces](/docs/reference/workspaces). See [workspaces](/docs/reference/workspaces).
## [archive]
Optional post-build step: format a FAT volume and copy built artifacts into a disk image. Runs after a successful package build (and after workspace member builds that define `[archive]`).
| Field | Required | Description |
| ------------ | -------- | ------------------------------------------------------------------------------------------- |
| `output` | yes | Image path relative to project root (`{profile}` allowed) |
| `format` | yes | `fat12`, `fat16`, or `fat32` |
| `size` | no | Image size: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default `1474560` ≈ 1.44 MiB) |
| `offset` | no | Byte offset of the FAT volume inside the image (default `0`) |
| `label` | no | Volume label (max 11 chars, default `VOLUME`) |
| `bootsector` | no | Path to a 512-byte boot sector written at offset 0 when `offset` is 0 (`{profile}` allowed) |
| `layout` | no | List of `{ from, to }` entries (files or globs → path inside the volume) |
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
[[archive.layout]]
from = "assets/*"
to = "/"
```
Typical pairing with `kind = "flat-bin"` (NASM `-f bin`) for bootloaders and pure-ASM OS images.
## `flat-bin` (kind)
Produces a raw binary (default extension `bin`) for boot sectors, kernels, and freestanding payloads.
### Assemblers
| Tool | Language / compiler | How flat-bin is produced |
| ---- | ------------------------------------------ | -------------------------------------------- |
| NASM | `language = "asm"`, `compiler = "nasm"` | `-f bin` → `\<stem>.bin` |
| FASM | `compiler = "fasm"` | direct write (use `format binary` in source) |
| GAS | `compiler = "as"` / `"gas"` | assemble → `objcopy -O binary` |
| MASM | `compiler = "ml"` / `"ml64"` | assemble → `objcopy -O binary` |
| LLC | `language = "llvm_ir"`, `compiler = "llc"` | `-filetype=obj` → `objcopy -O binary` |
```toml
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
### C / C++
Compile all sources, link with `-nostdlib -static` (plus your `ldflags` / `ldscript`), then convert the intermediate ELF/PE with `objcopy -O binary` to `\<filename|name>.bin`.
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldscript = "linker.ld"
ldflags = ["-T", "linker.ld"]
```
Notes:
* Multi-file **ASM** packages emit one `\<stem>.bin` per source; **C/C++** emit a single project binary.
* `objcopy` tools tried in order: `llvm-objcopy`, `objcopy`, `gobjcopy`.
* Incompatible with `build.qt = true`.
* `dcr run` rejects `flat-bin` (not a host executable).

View File

@@ -67,6 +67,8 @@ mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" } mylib = { path = "../relative/path" }
``` ```
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
## dcr.lock ## dcr.lock
Dependency lock file. Contains package names and sources. Dependency lock file. Contains package names and sources.

View File

@@ -11,17 +11,18 @@ DCR normalizes target triples. Short platform names are expanded to full triples
### Linux ### Linux
``` ```
target/<arch>-unknown-linux-gnu/<profile>/ target/<arch>-unknown-linux-<env>/<profile>/
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64`, `i686`, `armv7`, `riscv64` (host-detected).
Environments: `gnu` (default), `musl`.
Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib). Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib).
### macOS ### macOS
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64` (host-detected).
@@ -31,10 +32,11 @@ Extensions: `.dylib` (sharedlib), `.a` (staticlib).
### Windows ### Windows
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64`. Architectures: `x86_64`, `aarch64`.
Environments: `msvc` (default), `gnu` (MinGW).
Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI). Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI).

View File

@@ -43,7 +43,10 @@ dcr build # build all packages in dependency order
dcr build --workspace app # build only app (dependencies built automatically) dcr build --workspace app # build only app (dependencies built automatically)
``` ```
When building a workspace, member outputs (libraries) are automatically added to include/lib paths of dependent packages. When building a workspace, DCR automatically injects include and library paths of dependent workspace members:
* **Include Paths**: Automatically resolves and injects header directories of dependencies, including the member's `src/` directory, local `include/` directory, and the packaged `target/include` directory.
* **Library Paths**: Injects compiled library search paths (`target/lib` as well as target-specific build folders) to allow automatic linking with member libraries.
## Clean ## Clean

View File

@@ -51,8 +51,9 @@ dcr gen vscode
* **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint * **Incremental builds** — mtime + `.d` headers + SHA256 fingerprint
* **Parallel compilation** — thread::scope, atomic task queue * **Parallel compilation** — thread::scope, atomic task queue
* **4 backends** — gcc/clang, MSVC/clang-cl, GAS (ARM), NASM (x86) * **7 backends** — gcc/clang (unix_cc), MSVC/clang-cl (msvc), GAS, NASM, MASM, FASM, LLVM IR
* **7 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom * **8 project kinds** — bin, staticlib, sharedlib, efi, elf, none, custom, flat-bin
* **Disk images** — optional `[archive]` packs FAT12/16/32 images after build
* **Cross-compilation** — short names and full triples * **Cross-compilation** — short names and full triples
* **Profiles** — debug / release with field overrides * **Profiles** — debug / release with field overrides
* **Workspaces** — multi-package projects with topological sort * **Workspaces** — multi-package projects with topological sort

View File

@@ -4,6 +4,108 @@ sidebar_label: Changelog
# Changelog # Changelog
## 0.8.1 (2026-07-20)
### Added
* **`build.kind = "flat-bin"`** — raw binary (default `.bin`) for OS-dev payloads:
* **NASM** — `-f bin` → `\<stem>.bin`
* **FASM** — direct output (`format binary` in source)
* **GAS / MASM / LLC** — object → `objcopy -O binary` → `\<stem>.bin`
* **C/C++** — objects → freestanding link → `objcopy -O binary` → `\<name>.bin`
* Requires `llvm-objcopy` / `objcopy` / `gobjcopy` except for NASM/FASM direct emit
* **`[archive]` section** — after a successful build, pack a FAT disk image (`fatfs`): `output`, `format` (`fat12`/`fat16`/`fat32`), optional `size` (default 1.44 MiB), `offset`, `label`, `bootsector`, and `layout` (`from` → `to`, supports globs). `{profile}` works in paths.
* **Single-file `build.roots`** — a root may be a single source or header file, not only a directory.
### Changed
* **`--force`** also re-runs `build.steps` and `build.post_steps`.
* **`dcr run` on workspace-only root** — if `[run].cmd` is set, run that after build; otherwise delegate to a workspace member.
### Dependencies
* `fatfs = "0.3"` for FAT image packing.
## 0.8.0 (2026-07-18)
### Added
* **Dedicated Build Engine (`src/core/build/engine.rs`)** — decoupled the build orchestration logic completely from the CLI front-end wrapper in `src/cli/build.rs` to a reusable, decoupled core build engine.
* **Polymorphic Language Model (`Language` trait)** — introduced the abstract `Language` trait (`src/core/build/language/mod.rs`). File scanning, compiler resolution, and flags handling are now encapsulated in dedicated language modules for C, C++ (including Qt code generation), LLVM IR, and ASM (GAS, NASM, FASM, MASM).
* **Polymorphic Compilation Dispatch (`Builder` trait)** — introduced the `Builder` trait to generalize builder invocations (`src/core/build/builder/mod.rs`). Consolidated GCC/Clang logic into `builder/cc_common.rs` and Microsoft Visual C++ logic into `builder/msvc/`.
* **Per-Language Configuration overrides (`[build.\<lang>]`)** — introduced support for configuring language-specific compiler, standard, and flags (e.g. `[build.c]`, `[build.cxx]`, `[build.asm]`) independently in `dcr.toml`.
* **Automatic Workspace Dependency Injection** — during workspace builds, include/lib paths of dependent workspace members (including their source headers, local `include/` folders, and build target `target/include` / `target/lib` folders) are automatically resolved and injected.
* **`BuildReporter` Event System** — decoupled build orchestration output into a structured event-driven reporter model (`src/core/build/report.rs`), making DCR suitable for library embedding and IDE integrations without stderr capturing.
* **Build Cancellation Support** — introduced thread-safe cancellation tokens (`Arc\<AtomicBool>`) allowing clients to safely abort compile runs mid-execution.
* **TOML Formatting & Custom Keys Preservation** — migrated the config editor to `toml_edit`, preserving all unknown/user-defined TOML keys, structures, and comments during file write operations (e.g., in `dcr add`).
* **Path Dependencies Target Include Resolution** — local path dependencies configured via tables now correctly expose headers built and packaged into their `target/include` folder to consumer packages.
* **Modular Integration Test Suite** — refactored the monolith `tests/cli_basic.rs` file into clean, specialized integration tests: `cli_build.rs`, `cli_deps.rs`, `cli_lint.rs`, `cli_new.rs`, `cli_qt.rs`, `cli_test.rs`, `cli_workspace.rs`.
### Changed
* **Consolidated Linking and Archiving** — artifact generation (linking executables/shared libraries and archiving static libraries) consolidated into a single `src/core/build/builder/artifact.rs` module.
* **Workspace-Aware member execution** — `dcr run` executed at the workspace root of a `workspace_only` project now triggers the member build inside the workspace context using the `--workspace` parameter, preventing standalone build issues.
* **Elimination of Global State** — removed global variables and states from the build core, encapsulating build logic inside isolated `BuildContext` structs for thread safety.
* **Build Cache Separation** — relocated mtime tracking, incremental caching, and header-dependency checking logic to `src/core/build/cache.rs`.
* **Modularized Pre-build Steps** — decoupled generator scripts and pre-build commands parsing into `src/core/build/steps.rs`.
## 0.7.4 (2026-06-17)
### Added
* **Native Qt support** — automatic meta-object handling (MOC, UIC, RCC) added when `build.qt = true` is set in `dcr.toml`.
* **`dcr lint` command** — C/C++ static analysis via `clang-tidy`. Supports `--fix` for automatic fixes. Respects `build.roots` and `build.src_disable` from config.
* **Three new assembler backends**:
* **MASM** (`compiler = "ml"` / `"ml64"`) — Microsoft Macro Assembler.
* **FASM** (`compiler = "fasm"`) — Flat Assembler.
* **LLVM IR** (`compiler = "llc"`) — compiles `.ll` files via `llc -filetype=obj`.
* **Shared ASM pipeline** — linking and archiving logic consolidated into `core/builder/asm.rs`. Adding a new assembler backend now takes ~30 lines.
* **Filesystem utilities** — `to_hex()` and `home_dir()` extracted to `utils/fs.rs`.
* **Build utilities** — `normalize_target()`, `normalize_kind()`, `normalize_platform()`, `default_profile_flags()` extracted to `utils/build.rs`.
* **Backend helpers** — `asm_lang_flag()`, `source_extensions()`, `elapsed_secs()` added to `core/builder/common.rs`.
* **Full Bare-Metal / Freestanding Automation** — introduced the `build.freestanding = true` configuration option. When enabled (or when a bare-metal target is detected), DCR automatically injects `-ffreestanding` during compilation and both `-nostdlib` and `-static` during linking.
* **Artifact Optimization (LTO & Strip)** — added `build.lto` (auto-injects `-flto` for compiler and linker) and `build.strip` (automatically strips debug symbols via linker `-s` flag) options to `dcr.toml`.
* **Compilation Thread Control** — added the `build.codegen-units` option to strictly limit the maximum number of parallel jobs utilized by the custom `parallel_build` worker pool.
* **Panic Behavior Management** — added `build.panic = "abort"` support. For C++ targets, it automatically strips exception handling and unwind tables via `-fno-exceptions`, `-fno-unwind-tables`, and `-fno-asynchronous-unwind-tables`.
### Changed
* **Intelligent Default Flags Generation** — automated injection of fallback optimization (`-O3`/`-O0`), debug (`-g`), and warning (`-Wall -Wextra`) flags is now suppressed for bare-metal and freestanding builds if `build.cflags` are overridden.
* **Centralized Bare-Metal Detection** — relocated the `is_bare_metal_target` helper to common build utilities (`src/utils/build.rs`) for unified access across the building core.
* **Architectural Refactoring**:
* Renamed `src/config.rs` to `src/templates.rs`.
* Started consolidation of configuration and build orchestration logic.
## 0.7.3 (2026-06-13)
### Added
* **`--vcs` option for `new` and `init` commands** — introduced explicit version control system selection via `--vcs \<git|none>`.
* **Git metadata integration in `--version`** — the CLI now appends the current short commit hash and a `-dirty` suffix if there are uncommitted changes in the DCR repository.
* **Automatic `.gitignore` generation** — Git repository initialization now automatically writes a `.gitignore` file excluding the `/target` directory.
* **Nested repository prevention** — automatic Git initialization is now skipped if `dcr new` or `dcr init` is executed inside an already existing Git repository.
* **VCS verification tests** — added `new_vcs_options_work` and `init_vcs_options_work` integration tests to ensure reliable repository behavior.
### Changed
* **Complete removal of `git2` dependency** — all Git actions (dependency fetching, VCS setup, status checks) are now delegated to the system `git` executable via `Command`. This simplifies compilation and drops the need for `vendored` and `openssl` features.
* **Migrated from `reqwest` to `ureq`** — replaced the heavy `reqwest` crate in `flag_update.rs` with the lightweight synchronous `ureq 2.10` client, reducing overhead and the final binary size.
## 0.7.2 (2026-06-07)
### Added
* `default_target_triple()` now respects `target_env` — Linux (gnu/musl) and Windows (msvc/gnu) use the correct environment instead of hardcoded values.
### Fixed
* **macOS Apple Silicon builds failed with `_main` undefined** — `--target=` is now passed to ldflags, not just cflags. `default_target_triple()` uses `std::env::consts::ARCH` on macOS instead of hardcoded `x86_64`.
* **GitHub Stars and GPL-3.0 badges not rendering in README** — badge block converted to pure HTML.
### Changed
* Default target resolution extracted into shared `default_target_triple()` — removed duplication across build, run, clean.
## 0.7.1 (2026-06-02) ## 0.7.1 (2026-06-02)
### Added ### Added

View File

@@ -13,7 +13,7 @@ dcr build # debug profile
dcr build --release # release build dcr build --release # release build
dcr build --debug # explicit debug dcr build --debug # explicit debug
dcr build --target aarch64-unknown-linux-gnu dcr build --target aarch64-unknown-linux-gnu
dcr build --force # full rebuild dcr build --force # full rebuild (also re-runs build.steps / post_steps)
dcr build --clean # clean + build dcr build --clean # clean + build
dcr build --verbose # show compilation commands dcr build --verbose # show compilation commands
dcr build --workspace pkg-a # build specific workspace package dcr build --workspace pkg-a # build specific workspace package
@@ -21,6 +21,8 @@ dcr build --workspace pkg-a # build specific workspace package
Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target). Artifacts: `target/\<triple>/\<profile>/\<binary-name>` (Linux with explicit target).
With `[archive]` in `dcr.toml`, a FAT disk image is packed after a successful build.
## `dcr run` ## `dcr run`
Builds (if sources are newer than artifacts) and runs the binary. Builds (if sources are newer than artifacts) and runs the binary.
@@ -28,8 +30,11 @@ Builds (if sources are newer than artifacts) and runs the binary.
```bash ```bash
dcr run dcr run
dcr run --release dcr run --release
dcr run --force # force rebuild then run
``` ```
On a **workspace-only** root: if `[run].cmd` is set, that command is used after build; otherwise DCR delegates to a workspace member.
## `dcr clean` ## `dcr clean`
Removes `target/` directory (or `target/\<target>/\<profile>`). Removes `target/` directory (or `target/\<target>/\<profile>`).

View File

@@ -46,6 +46,6 @@ CI runs:
* `cargo fmt --check` * `cargo fmt --check`
* `cargo clippy --all-targets -- -D warnings` * `cargo clippy --all-targets -- -D warnings`
* `cargo test --all-targets` * `cargo check --all-targets --all-features`
* Build on Linux, macOS, Windows * Build on Linux, macOS, Windows
* Integration tests * Integration tests (compilation check)

View File

@@ -39,27 +39,6 @@ which clang
Or specify explicitly via `[toolchain]` in `dcr.toml`. Or specify explicitly via `[toolchain]` in `dcr.toml`.
## openssl-sys build failed
When building DCR from source:
```
error: failed to run custom build command for openssl-sys
```
**Solution:** Install OpenSSL development headers:
```bash
# Ubuntu/Debian
sudo apt install libssl-dev
# Fedora
sudo dnf install openssl-devel
# macOS
brew install openssl
```
## Ctrl+C during build ## Ctrl+C during build
DCR handles SIGINT: interrupts the current compilation and exits with non-zero code. DCR handles SIGINT: interrupts the current compilation and exits with non-zero code.
@@ -76,6 +55,12 @@ See [Cross-Compile Recipe](/docs/recipes/cross-to-windows).
See [Workspace Recipe](/docs/recipes/multi-package-workspace). See [Workspace Recipe](/docs/recipes/multi-package-workspace).
## Bootloader / pure NASM OS image
Use `kind = "flat-bin"` (NASM `-f bin`) and optional `[archive]` for a FAT disk image.
See [OS-dev recipe](/docs/recipes/os-flat-bin-archive).
## Lock file ## Lock file
`dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`. `dcr.lock` is created during builds (`dcr build`) when registry dependencies are present. To force an update — delete `dcr.lock` and run `dcr build`.

View File

@@ -70,3 +70,10 @@ dcr test # run tests
```bash ```bash
dcr fmt # clang-format with .clang-format dcr fmt # clang-format with .clang-format
``` ```
## Linting
```bash
dcr lint # clang-tidy checks
dcr lint --fix # apply fixes automatically
```

View File

@@ -0,0 +1,89 @@
---
sidebar_label: OS-dev (flat-bin + archive)
---
# Pure ASM / boot image (flat-bin + archive)
Minimal OS-dev style pipeline: assemble raw binaries with NASM, then pack a FAT floppy/image with an optional boot sector.
## Project layout
```
myos/
dcr.toml
src/
boot.asm # boot sector (512 bytes)
kernel.asm # payload
```
For multiple flat artifacts, use a **workspace** (one member per binary) or separate packages; a single `flat-bin` package produces one binary per source stem.
## Boot package (`flat-bin`)
```toml
[package]
name = "boot"
version = "0.1.0"
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
```bash
dcr build
# → target/<…>/debug/boot.bin (NASM -f bin, no link)
```
## Disk image after build
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
```
* `format`: `fat12`, `fat16`, or `fat32`
* `size`: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default ~1.44 MiB)
* `bootsector`: written only when `offset` is omitted or `0`
* `from` may be a glob; `{profile}` is substituted in paths
## C kernel → flat binary
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldflags = ["-T", "linker.ld"]
```
Pipeline: objects → temporary linked ELF → `objcopy -O binary` → `kernel.bin`. Requires `objcopy` / `llvm-objcopy` in PATH.
## Other assemblers
| Tool | Notes |
| -------- | --------------------------------------------------------------------------------------- |
| **FASM** | Write `format binary` in the source; DCR writes `\<stem>.bin` directly |
| **GAS** | Assemble `.s` → obj → `objcopy -O binary` |
| **LLC** | `language = "llvm_ir"` → obj → objcopy |
| **MASM** | COFF obj → objcopy (needs binutils/LLVM objcopy) |
## Notes
* Single-file `roots` are supported: `roots = ["src/boot.asm"]`.
* `--force` re-runs `build.steps` / `build.post_steps` as well as recompilation.
* Prefer `kind = "elf"` if you need a relocatable ELF kernel without stripping to raw binary.

View File

@@ -56,7 +56,7 @@ moc = "moc {in} -o {out}"
### GAS / NASM / MASM / FASM / LLVM-IR ### GAS / NASM / MASM / FASM / LLVM-IR
* GAS: `-I`, `-c -o`, `--defsym` * GAS: `-I`, `-c -o`, `--defsym`
* NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32) * NASM: `-I`, `-o`, `-D`, `-f` (format: win64/elf64/macho64/macho32/elf32; **`bin` when `kind = "flat-bin"`**)
* MASM: `/nologo /c /Fo\<obj> <source>` * MASM: `/nologo /c /Fo\<obj> <source>`
* FASM: `<source> \<output>` (output path is the object file) * FASM: `<source> \<output>` (output path is the object file)
* LLVM IR: `-filetype=obj <source> -o \<output>` * LLVM IR: `-filetype=obj <source> -o \<output>`
@@ -79,7 +79,7 @@ Three levels of incrementality:
## Build Kinds ## Build Kinds
| Kind | Type | Path (Linux example) | | Kind | Type | Path (Linux example) |
| ----------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | ----------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) | | `bin` | Executable | `target/\<triple>/\<profile>/\<name>` (.exe on Windows) |
| `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) | | `staticlib` | Static library | `target/\<triple>/\<profile>/lib\<name>.a` (.lib) |
| `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) | | `sharedlib` | Dynamic library | `target/\<triple>/\<profile>/lib\<name>.so` (.dll/.dylib) |
@@ -87,6 +87,11 @@ Three levels of incrementality:
| `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` | | `elf` | ELF without stdlib | `target/\<triple>/\<profile>/\<name>` |
| `none` | Compile only, no link | — | | `none` | Compile only, no link | — |
| `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` | | `custom` | Full filename+extension control | `target/\<triple>/\<profile>/\<filename>.\<extension>` |
| `flat-bin` | Raw binary | ASM: `\<stem>.bin` (NASM `-f bin` / FASM / GAS·MASM·LLC via objcopy); C/C++: `\<name>.bin` (link + objcopy) |
## Disk images (`[archive]`)
After a successful build, if `[archive]` is present in `dcr.toml`, DCR formats a FAT volume and copies files from `layout` into the image. See [dcr.toml → archive](/docs/reference/dcr-toml#archive).
## Build Steps ## Build Steps

View File

@@ -57,14 +57,8 @@ dcr build --target aarch64-none-elf
## Target Directory ## Target Directory
On Linux with explicit target: By default, the compilation output directories are structured as follows:
``` * **Linux and BSD**: Always output to `target/\<triple>/\<profile>/` (using host triple if no target is specified).
target/<triple>/<profile>/ * **macOS and Windows (without target)**: Output to `target/\<profile>/`.
``` * **macOS and Windows (with explicit target)**: Output to `target/\<triple>/\<profile>/`.
On macOS/Windows or without target:
```
target/<profile>/
```

View File

@@ -33,6 +33,9 @@ Main project configuration file. Located at the project root.
[run] [run]
# run settings # run settings
[archive]
# optional: pack FAT disk image after build
``` ```
## [package] ## [package]
@@ -61,19 +64,19 @@ author = "John Doe"
* `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`. * `build.qt` — (bool) Enable automatic Qt meta-object handling (MOC, UIC, RCC). Requires `qt6` modules installed via `pkg-config`.
| Field | Default | Description | | Field | Default | Description |
| ---------------- | ------------- | ---------------------------------------------------------------------------------------------------- | | ---------------- | ------------- | --------------------------------------------------------------------------------------------------------- |
| `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"` (optional, defaults to `"c"`) | | `language` | `"c"` | `"c"`, `"c++"`, `"cpp"`, `"cxx"`, `"asm"`, `"llvm_ir"`, `"llvm-ir"`, `"ll"` (optional, defaults to `"c"`) |
| `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) | | `standard` | `"c11"` | C standard (`c11`, `c17`, `c23`) |
| `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) | | `cxx_standard` | — | C++ standard (`c++17`, `c++20`, `c++23`) |
| `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) | | `compiler` | `"clang"` | Preferred compiler (optional, defaults to `"clang"`) |
| `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom` | | `kind` | `"bin"` | `bin`, `staticlib`, `sharedlib`, `efi`, `elf`, `none`, `custom`, `flat-bin` |
| `target` | host | Target triple for cross-compilation | | `target` | host | Target triple for cross-compilation |
| `platform` | `"native"` | `native`, `efi` | | `platform` | `"native"` | `native`, `efi` |
| `cflags` | `[]` | Additional C/C++/ASM flags | | `cflags` | `[]` | Additional C/C++/ASM flags |
| `ldflags` | `[]` | Additional linker flags | | `ldflags` | `[]` | Additional linker flags |
| `filename` | `""` | Custom output file name | | `filename` | `""` | Custom output file name |
| `extension` | `""` | Custom file extension | | `extension` | `""` | Custom file extension (for `flat-bin`, default is `bin`) |
| `roots` | `["src"]` | Source root directories | | `roots` | `["src"]` | Source roots: directories and/or individual source/header files |
| `exclude` | `[]` | Exclude patterns | | `exclude` | `[]` | Exclude patterns |
| `include` | `[]` | Additional include directories | | `include` | `[]` | Additional include directories |
| `src_disable` | `false` | Disable auto source discovery | | `src_disable` | `false` | Disable auto source discovery |
@@ -97,7 +100,7 @@ Settings from raw config (not in typed struct):
* `ldscript` — linker script path * `ldscript` — linker script path
* `build.steps` / `build.post_steps` — codegen steps * `build.steps` / `build.post_steps` — codegen steps
## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]` ## Per-language overrides: `[build.c]`, `[build.cxx]`, `[build.asm]`, `[build.llvm_ir]`
Each language can have its own table that overrides the flat `[build]` settings: Each language can have its own table that overrides the flat `[build]` settings:
@@ -117,6 +120,9 @@ compiler = "g++"
[build.asm] [build.asm]
compiler = "nasm" compiler = "nasm"
flags = ["-felf64"] flags = ["-felf64"]
[build.llvm_ir]
compiler = "llc"
``` ```
The flat `[build]` acts as fallback; per-language tables take precedence for their language. The flat `[build]` acts as fallback; per-language tables take precedence for their language.
@@ -174,3 +180,82 @@ Default `cmd` = `./target/{profile}/{name}` (macOS/Windows) or `./target/\<tripl
## [workspace] ## [workspace]
See [workspaces](/docs/reference/workspaces). See [workspaces](/docs/reference/workspaces).
## [archive]
Optional post-build step: format a FAT volume and copy built artifacts into a disk image. Runs after a successful package build (and after workspace member builds that define `[archive]`).
| Field | Required | Description |
| ------------ | -------- | ------------------------------------------------------------------------------------------- |
| `output` | yes | Image path relative to project root (`{profile}` allowed) |
| `format` | yes | `fat12`, `fat16`, or `fat32` |
| `size` | no | Image size: bytes or `K`/`KB`/`M`/`MB`/`G`/`GB` (default `1474560` ≈ 1.44 MiB) |
| `offset` | no | Byte offset of the FAT volume inside the image (default `0`) |
| `label` | no | Volume label (max 11 chars, default `VOLUME`) |
| `bootsector` | no | Path to a 512-byte boot sector written at offset 0 when `offset` is 0 (`{profile}` allowed) |
| `layout` | no | List of `{ from, to }` entries (files or globs → path inside the volume) |
```toml
[archive]
output = "target/{profile}/disk.img"
format = "fat12"
size = "1440K"
label = "MYOS"
bootsector = "target/{profile}/boot.bin"
[[archive.layout]]
from = "target/{profile}/kernel.bin"
to = "KERNEL.BIN"
[[archive.layout]]
from = "assets/*"
to = "/"
```
Typical pairing with `kind = "flat-bin"` (NASM `-f bin`) for bootloaders and pure-ASM OS images.
## `flat-bin` (kind)
Produces a raw binary (default extension `bin`) for boot sectors, kernels, and freestanding payloads.
### Assemblers
| Tool | Language / compiler | How flat-bin is produced |
| ---- | ------------------------------------------ | -------------------------------------------- |
| NASM | `language = "asm"`, `compiler = "nasm"` | `-f bin` → `\<stem>.bin` |
| FASM | `compiler = "fasm"` | direct write (use `format binary` in source) |
| GAS | `compiler = "as"` / `"gas"` | assemble → `objcopy -O binary` |
| MASM | `compiler = "ml"` / `"ml64"` | assemble → `objcopy -O binary` |
| LLC | `language = "llvm_ir"`, `compiler = "llc"` | `-filetype=obj` → `objcopy -O binary` |
```toml
[build]
language = "asm"
compiler = "nasm"
kind = "flat-bin"
extension = "bin"
roots = ["src/boot.asm"]
```
### C / C++
Compile all sources, link with `-nostdlib -static` (plus your `ldflags` / `ldscript`), then convert the intermediate ELF/PE with `objcopy -O binary` to `\<filename|name>.bin`.
```toml
[build]
language = "c"
compiler = "clang"
kind = "flat-bin"
freestanding = true
filename = "kernel"
extension = "bin"
ldscript = "linker.ld"
ldflags = ["-T", "linker.ld"]
```
Notes:
* Multi-file **ASM** packages emit one `\<stem>.bin` per source; **C/C++** emit a single project binary.
* `objcopy` tools tried in order: `llvm-objcopy`, `objcopy`, `gobjcopy`.
* Incompatible with `build.qt = true`.
* `dcr run` rejects `flat-bin` (not a host executable).

View File

@@ -67,6 +67,8 @@ mylib = { path = "/abs/path/to/lib" }
mylib = { path = "../relative/path" } mylib = { path = "../relative/path" }
``` ```
*Note: Header resolution automatically checks the packaged `target/include` directory of path dependencies, ensuring consumer packages can find headers from compiled static or dynamic libraries.*
## dcr.lock ## dcr.lock
Dependency lock file. Contains package names and sources. Dependency lock file. Contains package names and sources.

View File

@@ -11,17 +11,18 @@ DCR normalizes target triples. Short platform names are expanded to full triples
### Linux ### Linux
``` ```
target/<arch>-unknown-linux-gnu/<profile>/ target/<arch>-unknown-linux-<env>/<profile>/
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64`, `i686`, `armv7`, `riscv64` (host-detected).
Environments: `gnu` (default), `musl`.
Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib). Artifact type: ELF. Extensions: `.so` (sharedlib), `.a` (staticlib).
### macOS ### macOS
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64` (host-detected). Architectures: `x86_64`, `aarch64` (host-detected).
@@ -31,10 +32,11 @@ Extensions: `.dylib` (sharedlib), `.a` (staticlib).
### Windows ### Windows
``` ```
target/<profile>/ target/<profile>/ (default) or target/<triple>/<profile>/ (with target)
``` ```
Architectures: `x86_64`, `aarch64`. Architectures: `x86_64`, `aarch64`.
Environments: `msvc` (default), `gnu` (MinGW).
Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI). Extensions: `.exe` (bin), `.lib` (staticlib), `.dll` (sharedlib), `.efi` (UEFI).

View File

@@ -43,7 +43,10 @@ dcr build # build all packages in dependency order
dcr build --workspace app # build only app (dependencies built automatically) dcr build --workspace app # build only app (dependencies built automatically)
``` ```
When building a workspace, member outputs (libraries) are automatically added to include/lib paths of dependent packages. When building a workspace, DCR automatically injects include and library paths of dependent workspace members:
* **Include Paths**: Automatically resolves and injects header directories of dependencies, including the member's `src/` directory, local `include/` directory, and the packaged `target/include` directory.
* **Library Paths**: Injects compiled library search paths (`target/lib` as well as target-specific build folders) to allow automatic linking with member libraries.
## Clean ## Clean