zcc 0.1.6
D library to build C/C++ code using zig
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
zcc-d
A D library for building C/C++ code using Zig as a cross-compilation toolchain, inspired by cc-rs and cargo-zigbuild.
Features
- Cross-compilation support via Zig's C/C++ compiler
- Target triple and CPU architecture configuration
- Automatic C++ mode detection based on file extensions
- Flag transformation and filtering
- Build output logging
- Exception handling for build failures
Requirements
- D compiler
- Zig compiler
- dub or redub package manager
Installation
dub add zcc
Usage
library
// Compile C/C++ code
auto b = new Builder();
// Use `zig cc` or `zig c++`
b.file("source.cpp") // Auto-detects C++ mode
.setTargetTriple("aarch64-linux-gnu")
.setCpu("generic")
.addArg("-Wall")
.execute();
// Build library
auto lb = new Builder();
// use `zig build-lib -lc` or `zig build-lib -lc++`
lb.files(["source.cpp", "resource.cc"]) // Auto-detects C++ mode
.setTargetTriple("riscv64-linux-gnu")
.setCpu("baseline")
.addArg("-Wall")
.buildLibrary("libname");
See more in samples.
executable
dub run zcc:cc -- <clang-flags> <source-files>
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
- 0.1.6 released 2 days ago
- kassane/zcc-d
- MIT
- Authors:
- Sub packages:
- zcc:cc
- Dependencies:
- none
- Versions:
-
0.1.6 2025-May-15 0.1.5 2025-May-14 0.1.4 2025-May-14 0.1.3 2025-May-14 0.1.2 2025-May-14 - Download Stats:
-
-
1 downloads today
-
143 downloads this week
-
143 downloads this month
-
143 downloads total
-
- Score:
- 1.7
- Short URL:
- zcc.dub.pm