-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
79 lines (68 loc) · 3.04 KB
/
build.zig
File metadata and controls
79 lines (68 loc) · 3.04 KB
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
const std = @import("std");
const Builder = std.build.Builder;
pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const windows = b.option(bool, "windows", "create windows build") orelse false;
const pi = b.option(bool, "pi", "create pi build") orelse false;
const mac = b.option(bool, "mac", "create mac build") orelse false;
const vcpkg = b.option(bool, "vcpkg", "Add vcpkg paths to the build") orelse false;
_ = vcpkg;
var exe = b.addExecutable(.{
.name = "ziguencer",
.root_module = b.addModule("ziguencer", .{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
}),
});
// exe.addCSourceFile("stb_image-2.22/stb_image_impl.c", &[_][]const u8{"-std=c99"});
//exe.setBuildMode(mode);
if (windows) {
// exe.setTarget(.{
// .cpu_arch = .x86_64,
// .os_tag = .windows,
// .abi = .gnu,
// });
}
if (pi) {
// exe.setTarget(.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .musleabi });
//exe.setMCPU("arm1176jzf_s");
// exe.addLibraryPath(.{ .path = "rpi" });
} else {
// exe.addLibraryPath(.{ .cwd_relative = "../portmidi" });
}
// if (vcpkg) {
// exe.addVcpkgPaths(.static) catch @panic("Cannot add vcpkg paths.");
// }
// exe.addIncludePath(.{ .path = "../portmidi/pm_common" });
// exe.addIncludePath(.{ .path = "../portmidi/porttime" });
// important
// exe.addLibraryPath(.{ .path = "/opt/homebrew/lib" });
if (pi) {
exe.root_module.addIncludePath(.{ .cwd_relative = "raspberry_pi_deps/include" });
exe.root_module.addObjectFile(.{ .cwd_relative = "raspberry_pi_deps/libportmidi.so" });
exe.root_module.addObjectFile(.{ .cwd_relative = "raspberry_pi_deps/libnotcurses-core.so" });
exe.root_module.addObjectFile(.{ .cwd_relative = "raspberry_pi_deps/libnotcurses-ffi.so" });
exe.root_module.addObjectFile(.{ .cwd_relative = "raspberry_pi_deps/libnotcurses.so" });
} else if (mac) {
exe.root_module.addIncludePath(.{ .cwd_relative = "/opt/homebrew/include" });
exe.root_module.addObjectFile(.{ .cwd_relative = "/opt/homebrew/lib/libportmidi.dylib" });
// `-core` is important ...
exe.root_module.addObjectFile(.{ .cwd_relative = "/opt/homebrew/lib/libnotcurses-core.dylib" });
} else {
// linux - at least x86
exe.root_module.linkSystemLibrary("portmidi", .{});
exe.root_module.linkSystemLibrary("notcurses", .{});
}
exe.root_module.linkSystemLibrary("c", .{});
// exe.addLibraryPath(.{ .path = "/opt/homebrew/lib" });
// exe.linkSystemLibrary("notcurses");
// exe.linkSystemLibrary("glfw");
// exe.linkSystemLibrary("epoxy");
b.installArtifact(exe);
// const play = b.step("play", "Play the game");
const run = b.addRunArtifact(exe);
run.step.dependOn(b.getInstallStep());
// play.dependOn(&run.step);
}