zig-objc/build.zig

29 lines
826 B
Zig
Raw Normal View History

2023-01-02 14:48:21 -08:00
const std = @import("std");
const system_sdk = @import("vendor/mach/libs/glfw/system_sdk.zig");
/// Use this with addPackage in your project.
pub const pkg = std.build.Pkg{
.name = "objc",
.source = .{ .path = thisDir() ++ "/src/main.zig" },
};
pub fn build(b: *std.build.Builder) !void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const tests = b.addTestExe("objc-test", "src/main.zig");
tests.setBuildMode(mode);
tests.setTarget(target);
tests.linkSystemLibrary("objc");
system_sdk.include(b, tests, .{});
tests.install();
const test_step = b.step("test", "Run tests");
const tests_run = tests.run();
test_step.dependOn(&tests_run.step);
}
fn thisDir() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}