8113ef70e0
this changes the semantics of `comptimeEncode`; users will need to, e.g. use ```zig const encoding = comptimeEncode(T); passToObjc(&encoding) ``` to pass the encoding by pointer rather than by value.
31 lines
1 KiB
Zig
31 lines
1 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
const target = b.standardTargetOptions(.{});
|
|
const add_paths = b.option(bool, "add-paths", "add macos SDK paths from dependency") orelse false;
|
|
|
|
const objc = b.addModule("objc", .{
|
|
.root_source_file = .{ .path = "src/main.zig" },
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
if (add_paths) @import("macos_sdk").addPathsModule(objc);
|
|
objc.linkSystemLibrary("objc", .{});
|
|
objc.linkFramework("Foundation", .{});
|
|
|
|
const tests = b.addTest(.{
|
|
.name = "objc-test",
|
|
.root_source_file = .{ .path = "src/main.zig" },
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
tests.linkSystemLibrary("objc");
|
|
tests.linkFramework("Foundation");
|
|
@import("macos_sdk").addPaths(tests);
|
|
b.installArtifact(tests);
|
|
|
|
const test_step = b.step("test", "Run tests");
|
|
const tests_run = b.addRunArtifact(tests);
|
|
test_step.dependOn(&tests_run.step);
|
|
}
|