docs: document --target cross-compilation flag

- Add cross-compilation to README.md features and quick start
- Add cross-compilation section to docs/BuildAndTest.md
This commit is contained in:
2026-06-10 20:26:31 +03:00
parent e4e4e0d8ef
commit 8f68a9da1a
2 changed files with 22 additions and 0 deletions
+4
View File
@@ -24,6 +24,9 @@ cd hello
# Build and run # Build and run
bux run bux run
# Cross-compile for ARM Linux (requires clang)
bux build --target aarch64-linux-gnu
``` ```
--- ---
@@ -201,6 +204,7 @@ func Main() -> int {
| **CTFE** | `const func` — compile-time function execution | | **CTFE** | `const func` — compile-time function execution |
| **Trait Bounds** | `func Max<T: Comparable>(a: T, b: T) -> T` | | **Trait Bounds** | `func Max<T: Comparable>(a: T, b: T) -> T` |
| **Package Manager** | `bux add`, `bux install`, `bux.lock`, path + git deps | | **Package Manager** | `bux add`, `bux install`, `bux.lock`, path + git deps |
| **Cross-Compilation** | `--target <triple>` via clang (e.g. `aarch64-linux-gnu`) |
| **Tooling** | `bux new`, `bux build`, `bux run`, `bux test`, `bux check` | | **Tooling** | `bux new`, `bux build`, `bux run`, `bux test`, `bux check` |
--- ---
+18
View File
@@ -107,6 +107,24 @@ Output = "Bin"
Build output goes to `build/` by default. Build output goes to `build/` by default.
### Cross-Compilation
Use `--target <triple>` to cross-compile for a different platform. Bux generates C code and uses `clang` with the `-target` flag for cross-compilation.
```bash
# Cross-compile for ARM Linux
./buxc build --target aarch64-linux-gnu
# Cross-compile for x86_64 Linux (explicit)
./buxc build --target x86_64-linux-gnu
# Cross-compile and run project build
./buxc project --target x86_64-linux-gnu
./buxc run --target aarch64-linux-gnu
```
> **Note:** `clang` must be installed for cross-compilation. Without `--target`, Bux uses the system `cc` compiler.
--- ---
## Running Tests ## Running Tests