summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-07-03 23:37:10 -0300
committerGabriel Schneider <[email protected]>2026-08-01 15:02:07 -0300
commitf3f0e27372d8cf111269dde674d4581cf4cb0c41 (patch)
tree4cc53bb5893ece129ec4c3908380c46d0e691378 /build.zig
parenta354d34329de597b80943c78e2afd84f235ee505 (diff)
downloadpardes-f3f0e27372d8cf111269dde674d4581cf4cb0c41.tar.gz
pardes-f3f0e27372d8cf111269dde674d4581cf4cb0c41.zip
sdl: main + ui_sdl rework, build.zig updates
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig33
1 files changed, 30 insertions, 3 deletions
diff --git a/build.zig b/build.zig
index fa987360..b3ae8e37 100644
--- a/build.zig
+++ b/build.zig
@@ -57,18 +57,21 @@ pub fn build(b: *std.Build) void {
, .{ sysroot, sysroot, sysroot }));
} else null;
+ const exe_name = targetBinaryName(b, "pardes", target.result);
+ const replay_name = targetBinaryName(b, "pardes-replay", target.result);
const exe = b.addExecutable(.{
- .name = "pardes",
+ .name = exe_name,
.linkage = exe_linkage,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.root_source_file = b.path("main.zig"),
.strip = strip,
+ .link_libc = true,
}),
});
const replay = b.addExecutable(.{
- .name = "pardes-replay",
+ .name = replay_name,
.linkage = exe_linkage,
.root_module = b.createModule(.{
.target = target,
@@ -146,12 +149,16 @@ pub fn build(b: *std.Build) void {
// You'll want to use a lazy dependency here so that ghostty is only
// downloaded if you actually need it.
var ghostty_vt_for_tests: ?*std.Build.Module = null;
+ const ghostty_simd = switch (target.result.os.tag) {
+ .emscripten, .openbsd => false,
+ else => true,
+ };
if (b.lazyDependency("ghostty", .{
// Setting simd to false will force a pure static build that
// doesn't even require libc, but it has a significant performance
// penalty. If your embedding app requires libc anyway, you should
// always keep simd enabled.
- .simd = !is_emscripten,
+ .simd = ghostty_simd,
})) |dep| {
// Accessing ghostty's modules runs its build(), which (because vaxis is
// a shared dependency, deduplicated to the same module) wires ghostty's
@@ -664,6 +671,26 @@ fn detectEmscriptenSysroot(b: *std.Build) ?[]const u8 {
return null;
}
+fn targetBinaryName(b: *std.Build, base: []const u8, target: std.Target) []const u8 {
+ return switch (target.os.tag) {
+ .linux, .emscripten => base,
+ .macos, .freebsd, .openbsd, .netbsd, .dragonfly => b.fmt("{s}-{s}-{s}", .{
+ base,
+ @tagName(target.os.tag),
+ archName(target.cpu.arch),
+ }),
+ else => base,
+ };
+}
+
+fn archName(arch: std.Target.Cpu.Arch) []const u8 {
+ return switch (arch) {
+ .x86_64 => "x64",
+ .aarch64 => "arm64",
+ else => @tagName(arch),
+ };
+}
+
fn envPath(b: *std.Build, name: []const u8) ?[]const u8 {
return b.graph.environ_map.get(name);
}