anotherBuildStep
is a project designed to leverage the Zig build system (build.zig
) for building projects with various other toolchains. This allows developers to use Zig as a unified build system across different environments and toolsets.
- ldc2 support
- rustc (no cargo) support
-
rustc (cargo) support(need to figure out how to get the cargo build system to work)
- zig v0.12.0 or master
Make new project or add to existing project:
In project folder, add this package, as dependency on your build.zig.zon
$ zig fetch --save git+https://github.com/kassane/anotherBuildStep#{commit-tag}
- add
@import("anotherBuildStep")
tobuild.zig
const std = @import("std");
// get build.zig from pkg to extend your build.zig project (only pub content module)
const abs = @import("anotherBuildStep");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = try abs.ldcBuildStep(b, .{
.name = "helloD",
.target = target,
.optimize = optimize,
.sources = &.{"src/main.d"},
.dflags = &.{
"-w",
},
});
b.default_step.dependOn(&exe.step);
// or
const exeRust = try abs.rustcBuildStep(b, .{
.name = "helloRust",
.target = target,
.optimize = optimize,
.source = "src/main.rs",
.rflags = &.{
"-C",
"panic=abort",
},
});
b.default_step.dependOn(&exeRust.step);
}