-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
51 lines (45 loc) · 1.65 KB
/
Copy pathbuild.zig
File metadata and controls
51 lines (45 loc) · 1.65 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
const std = @import("std");
pub fn build(b: *std.Build) void {
// Standard CLI-configurable target / optimize options:
// Use: zig build -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseSmall
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe_mod = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
exe_mod.linkSystemLibrary("SDL2_ttf", .{});
exe_mod.link_libc = true;
const exe = b.addExecutable(.{
.name = "zignes",
.root_module = exe_mod,
});
// Install the executable to zig-out/bin by default (user chooses prefix).
b.installArtifact(exe);
// Convenience "zig build run" step
const run_exe = b.addRunArtifact(exe);
if (b.args) |args| run_exe.addArgs(args);
const run_step = b.step("run", "Run the application");
run_step.dependOn(&run_exe.step);
// WASM build: pure emulator core, no SDL, freestanding.
const wasm_target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
});
const wasm = b.addExecutable(.{
.name = "zignes",
.root_module = b.createModule(.{
.root_source_file = b.path("src/wasm.zig"),
.target = wasm_target,
.optimize = .ReleaseSmall,
}),
});
wasm.entry = .disabled;
wasm.rdynamic = true;
const wasm_install = b.addInstallArtifact(wasm, .{
.dest_dir = .{ .override = .{ .custom = "wasm" } },
});
const wasm_step = b.step("wasm", "Build the WASM module");
wasm_step.dependOn(&wasm_install.step);
}