mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
Update zig version
This commit is contained in:
parent
d3ad1b4d01
commit
8a8af8e46f
@ -1 +1 @@
|
|||||||
0.12.0-dev.1746+19af8aac8
|
0.12.0-dev.2150+63de8a598
|
25
build.zig
25
build.zig
@ -1,11 +1,12 @@
|
|||||||
const std = @import("std");
|
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
|
// Standard target options allows the person running `zig build` to choose
|
||||||
// what target to build for. Here we do not override the defaults, which
|
// 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
|
// means any target is allowed, and the default is native. Other options
|
||||||
// for restricting supported target set are available.
|
// for restricting supported target set are available.
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const t = target.result;
|
||||||
|
|
||||||
// Standard release options allow the person running `zig build` to select
|
// Standard release options allow the person running `zig build` to select
|
||||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
// 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"},
|
.root_source_file = .{.path = "src/main.zig"},
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
//.sanitize_thread = true,
|
||||||
});
|
});
|
||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
exe.linkLibCpp();
|
exe.linkLibCpp();
|
||||||
@ -29,27 +31,32 @@ pub fn build(b: *std.build.Builder) !void {
|
|||||||
exe.linkSystemLibrary("cubyz_deps");
|
exe.linkSystemLibrary("cubyz_deps");
|
||||||
exe.addRPath(deps.path("lib")); // TODO: Maybe move the library next to the executable, to make this more portable?
|
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("ole32");
|
||||||
exe.linkSystemLibrary("winmm");
|
exe.linkSystemLibrary("winmm");
|
||||||
exe.linkSystemLibrary("uuid");
|
exe.linkSystemLibrary("uuid");
|
||||||
exe.linkSystemLibrary("gdi32");
|
exe.linkSystemLibrary("gdi32");
|
||||||
exe.linkSystemLibrary("opengl32");
|
exe.linkSystemLibrary("opengl32");
|
||||||
exe.linkSystemLibrary("ws2_32");
|
exe.linkSystemLibrary("ws2_32");
|
||||||
} else if(target.getOsTag() == .linux) {
|
} else if(t.os.tag == .linux) {
|
||||||
exe.linkSystemLibrary("asound");
|
exe.linkSystemLibrary("asound");
|
||||||
exe.linkSystemLibrary("x11");
|
exe.linkSystemLibrary("x11");
|
||||||
exe.linkSystemLibrary("GL");
|
exe.linkSystemLibrary("GL");
|
||||||
} else {
|
} 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.root_module.addAnonymousImport("gui", .{
|
||||||
exe.addAnonymousModule("server", .{.source_file = .{.path = "src/server/server.zig"}});
|
.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);
|
b.installArtifact(exe);
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(exe);
|
const run_cmd = b.addRunArtifact(exe);
|
||||||
|
@ -1126,7 +1126,7 @@ pub const Shader = struct {
|
|||||||
const self = try Shader.init(vertex, fragment);
|
const self = try Shader.init(vertex, fragment);
|
||||||
inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).Struct.fields) |field| {
|
inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).Struct.fields) |field| {
|
||||||
if(field.type == c_int) {
|
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;
|
return self;
|
||||||
@ -1143,7 +1143,7 @@ pub const Shader = struct {
|
|||||||
const self = try Shader.initCompute(compute);
|
const self = try Shader.initCompute(compute);
|
||||||
inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).Struct.fields) |field| {
|
inline for(@typeInfo(@TypeOf(ptrToUniformStruct.*)).Struct.fields) |field| {
|
||||||
if(field.type == c_int) {
|
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;
|
return self;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user