zig-examples/zig-with-c/build.zig

28 lines
688 B
Zig
Raw Normal View History

2024-08-22 21:51:43 +00:00
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "zig-with-c",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.use_llvm = false,
.use_lld = false,
});
exe.addCSourceFile(.{
.file = b.path("src/lib.c"),
});
exe.addIncludePath(b.path("include"));
b.installArtifact(exe);
const run_exe = b.addRunArtifact(exe);
const run_step = b.step("run", "Run the application");
run_step.dependOn(&run_exe.step);
}