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" },
|
|
|
|
};
|
|
|
|
|
2023-02-14 18:03:43 -08:00
|
|
|
/// Returns the module for libxev. The recommended approach is to depend
|
|
|
|
/// on libxev in your build.zig.zon file, then use
|
|
|
|
/// `b.dependency("libxev").module("xev")`. But if you're not using
|
|
|
|
/// a build.zig.zon yet this will work.
|
|
|
|
pub fn module(b: *std.Build) *std.Build.Module {
|
|
|
|
return b.createModule(.{
|
|
|
|
.source_file = .{ .path = (comptime thisDir()) ++ "/src/main.zig" },
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn build(b: *std.Build) !void {
|
|
|
|
const optimize = b.standardOptimizeOption(.{});
|
2023-01-02 14:48:21 -08:00
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
|
2023-02-14 18:03:43 -08:00
|
|
|
const tests = b.addTest(.{
|
|
|
|
.name = "objc-test",
|
|
|
|
.kind = .test_exe,
|
|
|
|
.root_source_file = .{ .path = "src/main.zig" },
|
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
2023-01-02 14:48:21 -08:00
|
|
|
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 ".";
|
|
|
|
}
|