https://github.com/kassane/llvm-zig
LLVM bindings written in Zig
https://github.com/kassane/llvm-zig
ffi-bindings libclang llvm llvm-bindings llvm-c llvm-c-api zig zig-package
Last synced: 3 months ago
JSON representation
LLVM bindings written in Zig
- Host: GitHub
- URL: https://github.com/kassane/llvm-zig
- Owner: kassane
- License: mit
- Created: 2023-04-21T16:26:20.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-19T14:04:45.000Z (11 months ago)
- Last Synced: 2025-03-28T19:13:14.954Z (4 months ago)
- Topics: ffi-bindings, libclang, llvm, llvm-bindings, llvm-c, llvm-c-api, zig, zig-package
- Language: Zig
- Homepage:
- Size: 96.7 KB
- Stars: 44
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LLVM bindings for Zig
The purpose of this repository is to learn about the [`llvm`][llvm] compiler
infrastructure and practice some [`zig`][zig].### Requirement
- [zig v0.14.0](https://ziglang.org/download) or higher.
### How to use
Make your project using
```console
zig init
```
Add this llvm-zig module
in `build.zig.zon`:
```console
zig fetch --save=llvm git+https://github.com/kassane/llvm-zig
```
in `build.zig`:```zig
// [...]
const llvm_dep = b.dependency("llvm", .{ // <== as declared in build.zig.zon
.target = target, // the same as passing `-Dtarget=<...>` to the library's build.zig script
.optimize = optimize, // ditto for `-Doptimize=<...>`
});
const llvm_mod = llvm_dep.module("llvm"); // <== get llvm bindings module
// and/or
const clang_mod = llvm_dep.module("clang"); // <== get clang bindings module
/// your executable config
exe.root_module.addImport("llvm", llvm_mod); // <== add llvm module
exe.root_module.addImport("clang", clang_mod); // <== add llvm module
// [...]
```### License
This project is licensed under the [MIT](LICENSE) license.
[llvm]: https://llvm.org
[zig]: https://ziglang.org