-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
68 lines (51 loc) · 1.79 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const std = @import("std");
const builtin = @import("builtin");
pub fn build(b: *std.build.Builder) void {
const all = b.step("all", "");
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
{
const lib = b.addSharedLibrary("debug", "src/webview.zig", .unversioned);
lib.strip = true;
lib.want_lto = .macos != target.getOsTag();
lib.linkLibC();
lib.setTarget(target);
lib.setBuildMode(mode);
lib.setOutputDir("bin/");
b.default_step.dependOn(&lib.step);
b.default_step.dependOn(&b.addSystemCommand(&[_][]const u8 {"rm", "bin/debug.o"}).step);
}
{
const lib = b.addSharedLibrary("linux.x64", "src/webview.zig", .unversioned);
lib.strip = true;
lib.want_lto = true;
lib.linkLibC();
lib.setBuildMode(mode);
lib.setOutputDir("bin/");
lib.setTarget(.{ .os_tag = .linux, .cpu_arch = .x86_64 });
all.dependOn(&lib.step);
all.dependOn(&b.addSystemCommand(&[_][]const u8 {"rm", "bin/linux.x64.o"}).step);
}
{
const lib = b.addSharedLibrary("darwin.x64", "src/webview.zig", .unversioned);
lib.strip = true;
lib.want_lto = false;
lib.linkLibC();
lib.setBuildMode(mode);
lib.setOutputDir("bin/");
lib.setTarget(.{ .os_tag = .macos, .cpu_arch = .x86_64 });
all.dependOn(&lib.step);
all.dependOn(&b.addSystemCommand(&[_][]const u8 {"rm", "bin/darwin.x64.o"}).step);
}
{
const lib = b.addSharedLibrary("darwin.arm64", "src/webview.zig", .unversioned);
lib.strip = true;
lib.want_lto = false;
lib.linkLibC();
lib.setBuildMode(mode);
lib.setOutputDir("bin/");
lib.setTarget(.{ .os_tag = .macos, .cpu_arch = .aarch64 });
all.dependOn(&lib.step);
all.dependOn(&b.addSystemCommand(&[_][]const u8 {"rm", "bin/darwin.arm64.o"}).step);
}
}