update to Zig 2024.1.0-mach
helps hexops/mach#1135 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
e8d3deacdc
commit
0fdefbd764
2 changed files with 19 additions and 26 deletions
41
build.zig
41
build.zig
|
@ -1,24 +1,19 @@
|
|||
const builtin = @import("builtin");
|
||||
const std = @import("std");
|
||||
const Build = std.Build;
|
||||
|
||||
pub fn build(b: *Build) !void {
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const glfw_dep = b.dependency("glfw", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const module = b.addModule("mach-glfw", .{
|
||||
.root_source_file = .{ .path = "src/main.zig" },
|
||||
});
|
||||
module.addIncludePath(b.dependency("glfw", .{}).path("include"));
|
||||
|
||||
const lib = b.addStaticLibrary(.{
|
||||
.name = "mach-glfw",
|
||||
.root_source_file = b.addWriteFiles().add("empty.c", ""),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
link(b, lib);
|
||||
b.installArtifact(lib);
|
||||
module.linkLibrary(glfw_dep.artifact("glfw"));
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
const main_tests = b.addTest(.{
|
||||
|
@ -27,22 +22,20 @@ pub fn build(b: *Build) !void {
|
|||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
main_tests.linkLibrary(lib);
|
||||
link(b, main_tests);
|
||||
main_tests.linkLibrary(glfw_dep.artifact("glfw"));
|
||||
addPaths(main_tests);
|
||||
b.installArtifact(main_tests);
|
||||
|
||||
test_step.dependOn(&b.addRunArtifact(main_tests).step);
|
||||
}
|
||||
|
||||
pub fn link(b: *std.Build, step: *std.Build.Step.Compile) void {
|
||||
const target_triple: []const u8 = step.rootModuleTarget().zigTriple(b.allocator) catch @panic("OOM");
|
||||
const cpu_opts: []const u8 = step.root_module.resolved_target.?.query.serializeCpuAlloc(b.allocator) catch @panic("OOM");
|
||||
const glfw_dep = b.dependency("glfw", .{
|
||||
.target = target_triple,
|
||||
.cpu = cpu_opts,
|
||||
.optimize = step.root_module.optimize.?,
|
||||
});
|
||||
@import("glfw").link(glfw_dep.builder, step);
|
||||
step.linkLibrary(glfw_dep.artifact("glfw"));
|
||||
_ = b;
|
||||
_ = step;
|
||||
|
||||
@panic(".link(b, step) has been replaced by .addPaths(step)");
|
||||
}
|
||||
|
||||
pub fn addPaths(step: *std.Build.Step.Compile) void {
|
||||
@import("glfw").addPaths(step);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
},
|
||||
.dependencies = .{
|
||||
.glfw = .{
|
||||
.url = "https://github.com/der-teufel-programming/glfw/archive/523dc59dc16ceabd7665b38aabf969e330decaf6.tar.gz",
|
||||
.hash = "1220dbfb5484019e82fb064090afbe09c83b2d6ab80aac11ceb43a37af78a792cf52",
|
||||
.url = "https://pkg.machengine.org/glfw/4a39c70a6347419ae95f0718684b6b10e65e015a.tar.gz",
|
||||
.hash = "12209e5e9c8850f4beebf1e620c73ba9daa5cf587ffa5dbd5376b8a4f18bb0e1c819",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue