forked from robbielyman/seamstress-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
89 lines (80 loc) · 2.87 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "seamstress",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
b.installArtifact(exe);
exe.headerpad_max_install_names = true;
const install_lua_files = b.addInstallDirectory(.{
.source_dir = .{ .path = "lua" },
.install_dir = .{ .custom = "share/seamstress" },
.install_subdir = "lua",
});
const install_resources = b.addInstallDirectory(.{
.source_dir = .{ .path = "resources" },
.install_dir = .{ .custom = "share/seamstress" },
.install_subdir = "resources",
});
const install_examples = b.addInstallDirectory(.{
.source_dir = .{ .path = "examples" },
.install_dir = .{ .custom = "share/seamstress" },
.install_subdir = "examples",
});
b.getInstallStep().dependOn(&install_resources.step);
b.getInstallStep().dependOn(&install_lua_files.step);
b.getInstallStep().dependOn(&install_examples.step);
const zig_sdl = b.dependency("SDL", .{
.target = target,
.optimize = optimize,
});
exe.linkLibrary(zig_sdl.artifact("SDL2"));
exe.linkLibrary(zig_sdl.artifact("SDL2_ttf"));
exe.linkLibrary(zig_sdl.artifact("SDL_image"));
const zig_lua = b.dependency("Lua", .{
.target = target,
.optimize = optimize,
});
exe.addModule("ziglua", zig_lua.module("ziglua"));
exe.linkLibrary(zig_lua.artifact("lua"));
const zig_link = b.dependency("link", .{
.target = target,
.optimize = optimize,
});
exe.linkLibrary(zig_link.artifact("abl_link"));
const zig_readline = b.dependency("readline", .{
.target = target,
.optimize = optimize,
});
exe.linkLibrary(zig_readline.artifact("readline"));
exe.linkSystemLibrary("ncurses");
const zig_liblo = b.dependency("liblo", .{
.target = target,
.optimize = .ReleaseFast,
});
exe.linkLibrary(zig_liblo.artifact("liblo"));
const zig_rtmidi = b.dependency("rtmidi", .{
.target = target,
.optimize = optimize,
});
exe.linkLibrary(zig_rtmidi.artifact("rtmidi"));
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}