dcr 0.7.3

DCR is a utility for managing C/C++ projects in a Cargo-like style.
---
sidebar_label: Cross-compilation
---

# Cross-Compilation

## Short Names

DCR supports short platform names:

| Short Name | Full Triple |
|-----------|-------------|
| `linux` | `x86_64-unknown-linux-gnu` |
| `macos` | `x86_64-apple-darwin` |
| `windows` | `x86_64-pc-windows-msvc` |

```bash
dcr build --target windows
```

## Full Triples

```bash
dcr build --target aarch64-unknown-linux-gnu
dcr build --target x86_64-pc-windows-gnu      # mingw
dcr build --target armv7-unknown-linux-gnueabihf
```

## clang --target

When using clang, DCR injects `--target=<triple>` into CFLAGS.

```toml
[build]
compiler = "clang"
target = "aarch64-unknown-linux-gnu"
# Auto: cflags += ["--target=aarch64-unknown-linux-gnu"]
```

## Bare-Metal

For targets containing `none`, `-elf`, `eabi`, or `baremetal`, DCR default flags are disabled (no system include paths, no `-l` libc).

```bash
dcr build --target aarch64-none-elf
```

## Target Directory

On Linux with explicit target:

```
target/<triple>/<profile>/
```

On macOS/Windows or without target:

```
target/<profile>/
```