mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 18:59:41 +00:00
71 lines
1.6 KiB
Plaintext
71 lines
1.6 KiB
Plaintext
---
|
||
sidebar_label: Кросс-компиляция
|
||
---
|
||
|
||
# Кросс-компиляция
|
||
|
||
## Short Names
|
||
|
||
DCR поддерживает короткие имена платформ, которые автоматически раскрываются в полные triples:
|
||
|
||
| 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
|
||
dcr build --target armv7-unknown-linux-gnueabihf
|
||
```
|
||
|
||
## clang --target
|
||
|
||
При использовании clang DCR автоматически inject-ит `--target=\<triple>` в CFLAGS/CXXFLAGS.
|
||
|
||
```toml
|
||
[build]
|
||
compiler = "clang"
|
||
target = "aarch64-unknown-linux-gnu"
|
||
# Авто: cflags = ["--target=aarch64-unknown-linux-gnu"]
|
||
```
|
||
|
||
## Bare-Metal
|
||
|
||
For targets containing `none`, `-elf`, `eabi`, or `baremetal`, DCR automatically:
|
||
|
||
1. Для none/elf/eabi/bare-metal target-ов отключаются DCR default флаги (нет `-I` системных путей, нет `-l` libc).
|
||
2. **Injects `-ffreestanding`** at compile time and `-nostdlib -static` at link time
|
||
|
||
You can also enable freestanding mode explicitly:
|
||
|
||
```toml
|
||
[build]
|
||
freestanding = true
|
||
```
|
||
|
||
```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>/
|
||
```
|