From f3f0e27372d8cf111269dde674d4581cf4cb0c41 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 3 Jul 2026 23:37:10 -0300 Subject: sdl: main + ui_sdl rework, build.zig updates --- build.zig | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'build.zig') 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); } -- cgit v1.3