diff --git a/.zig-version b/.zig-version index 4cda27b6..07a24b14 100644 --- a/.zig-version +++ b/.zig-version @@ -1 +1 @@ -0.12.0-dev.1746+19af8aac8 \ No newline at end of file +0.12.0-dev.2150+63de8a598 \ No newline at end of file diff --git a/build.zig b/build.zig index a1b134c7..ddc7462c 100644 --- a/build.zig +++ b/build.zig @@ -1,11 +1,12 @@ const std = @import("std"); -pub fn build(b: *std.build.Builder) !void { +pub fn build(b: *std.Build) !void { // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); + const t = target.result; // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. @@ -15,6 +16,7 @@ pub fn build(b: *std.build.Builder) !void { .root_source_file = .{.path = "src/main.zig"}, .target = target, .optimize = optimize, + //.sanitize_thread = true, }); exe.linkLibC(); exe.linkLibCpp(); @@ -29,27 +31,32 @@ pub fn build(b: *std.build.Builder) !void { exe.linkSystemLibrary("cubyz_deps"); exe.addRPath(deps.path("lib")); // TODO: Maybe move the library next to the executable, to make this more portable? - if(target.getOsTag() == .windows) { + if(t.os.tag == .windows) { exe.linkSystemLibrary("ole32"); exe.linkSystemLibrary("winmm"); exe.linkSystemLibrary("uuid"); exe.linkSystemLibrary("gdi32"); exe.linkSystemLibrary("opengl32"); exe.linkSystemLibrary("ws2_32"); - } else if(target.getOsTag() == .linux) { + } else if(t.os.tag == .linux) { exe.linkSystemLibrary("asound"); exe.linkSystemLibrary("x11"); exe.linkSystemLibrary("GL"); } else { - std.log.err("Unsupported target: {}\n", .{ target.getOsTag() }); + std.log.err("Unsupported target: {}\n", .{t.os.tag}); } - exe.addAnonymousModule("gui", .{.source_file = .{.path = "src/gui/gui.zig"}}); - exe.addAnonymousModule("server", .{.source_file = .{.path = "src/server/server.zig"}}); + exe.root_module.addAnonymousImport("gui", .{ + .target = target, + .optimize = optimize, + .root_source_file = .{.path = "src/gui/gui.zig"}, + }); + exe.root_module.addAnonymousImport("server", .{ + .target = target, + .optimize = optimize, + .root_source_file = .{.path = "src/server/server.zig"}, + }); - //exe.strip = true; // Improves compile-time - //exe.sanitize_thread = true; - exe.disable_stack_probing = true; // Improves tracing of stack overflow errors. b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); diff --git a/src/graphics.zig b/src/graphics.zig index ac752adf..01c15d2f 100644 --- a/src/graphics.zig +++ b/src/graphics.zig @@ -1126,7 +1126,7 @@ pub const Shader = struct { const self = try Shader.init(vertex, fragment); inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).Struct.fields) |field| { if(field.type == c_int) { - @field(ptrToUniformStruct, field.name) = c.glGetUniformLocation(self.id, field.name[0..] ++ "\x00"); // TODO: #16072 + @field(ptrToUniformStruct, field.name) = c.glGetUniformLocation(self.id, field.name[0..]); } } return self; @@ -1143,7 +1143,7 @@ pub const Shader = struct { const self = try Shader.initCompute(compute); inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).Struct.fields) |field| { if(field.type == c_int) { - @field(ptrToUniformStruct, field.name) = c.glGetUniformLocation(self.id, field.name[0..] ++ "\x00"); // TODO: #16072 + @field(ptrToUniformStruct, field.name) = c.glGetUniformLocation(self.id, field.name[0..]); } } return self;