Skip to content

Commit

Permalink
readme: add some info about using aro as a module
Browse files Browse the repository at this point in the history
  • Loading branch information
ehaas committed Aug 2, 2024
1 parent 3f0b946 commit 45e41b2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,34 @@ $ zig build && ./zig-out/bin/arocc hello.c -o hello
$ ./hello
Hello, world!
```
---
# Using aro as a module
The following assumes that your package has a `build.zig.zon` file.
```sh-session
zig fetch --save git+https://github.com/Vexu/arocc.git
```

Add the following to your `build.zig`:

```zig
const aro = b.dependency("aro", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("aro", aro.module("aro"));
// Optional; this will make aro's builtin includes (the `include` directory of this repo) available to `Toolchain`
b.installDirectory(.{
.source_dir = aro.path("include"),
.install_dir = .prefix,
.install_subdir = "include",
});
```

Now you can do
```zig
const aro = @import("aro");
```
in your Zig code.

0 comments on commit 45e41b2

Please sign in to comment.