forked from NotAShelf/rogged
various: upgrade Zig version
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ia97044bd7d44c776f217f2223e35ae3b6a6a6964
This commit is contained in:
parent
4bcacb59ac
commit
bb10fb88f0
6 changed files with 45 additions and 35 deletions
48
build.zig
48
build.zig
|
|
@ -29,11 +29,11 @@ pub fn build(b: *std.Build) void {
|
|||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
rng_lib.addCSourceFiles(.{
|
||||
rng_lib.root_module.addCSourceFiles(.{
|
||||
.files = &[_][]const u8{"libs/rng/rng.c"},
|
||||
.flags = c_flags,
|
||||
});
|
||||
rng_lib.addIncludePath(b.path("libs/rng"));
|
||||
rng_lib.root_module.addIncludePath(b.path("libs/rng"));
|
||||
|
||||
// Map library
|
||||
const map_lib = b.addLibrary(.{
|
||||
|
|
@ -44,7 +44,7 @@ pub fn build(b: *std.Build) void {
|
|||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
map_lib.addCSourceFiles(.{
|
||||
map_lib.root_module.addCSourceFiles(.{
|
||||
.files = &[_][]const u8{
|
||||
"libs/map/map.c",
|
||||
"libs/map/utils.c",
|
||||
|
|
@ -52,11 +52,11 @@ pub fn build(b: *std.Build) void {
|
|||
.flags = c_flags,
|
||||
});
|
||||
// map.h includes common.h and settings.h which live in src/
|
||||
map_lib.addIncludePath(b.path("src"));
|
||||
map_lib.root_module.addIncludePath(b.path("src"));
|
||||
// map.c includes rng/rng.h via libs/ root
|
||||
map_lib.addIncludePath(b.path("libs"));
|
||||
map_lib.root_module.addIncludePath(b.path("libs"));
|
||||
// utils.h is co-located with map.c
|
||||
map_lib.addIncludePath(b.path("libs/map"));
|
||||
map_lib.root_module.addIncludePath(b.path("libs/map"));
|
||||
|
||||
// Tileset library
|
||||
const tileset_obj = b.addObject(.{
|
||||
|
|
@ -67,7 +67,7 @@ pub fn build(b: *std.Build) void {
|
|||
.link_libc = true,
|
||||
}),
|
||||
});
|
||||
tileset_obj.addCSourceFiles(.{
|
||||
tileset_obj.root_module.addCSourceFiles(.{
|
||||
.files = &[_][]const u8{
|
||||
"libs/tileset/tileset.c",
|
||||
"libs/tileset/tileset_paint.c",
|
||||
|
|
@ -75,10 +75,10 @@ pub fn build(b: *std.Build) void {
|
|||
.flags = c_flags,
|
||||
});
|
||||
// tileset.h includes settings.h which lives in src/
|
||||
tileset_obj.addIncludePath(b.path("src"));
|
||||
tileset_obj.root_module.addIncludePath(b.path("src"));
|
||||
// tileset.c includes tileset.h which is co-located
|
||||
tileset_obj.addIncludePath(b.path("libs/tileset"));
|
||||
tileset_obj.linkSystemLibrary("raylib");
|
||||
tileset_obj.root_module.addIncludePath(b.path("libs/tileset"));
|
||||
tileset_obj.root_module.linkSystemLibrary("raylib", .{});
|
||||
|
||||
// Zig combat library. This must be compiled as an object and linked
|
||||
// directly to bypassing the archive step, or it yields a corrupt
|
||||
|
|
@ -93,8 +93,8 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
// common.h and settings.h live in src/; rng.h exposed bare from libs/rng
|
||||
combat_obj.addIncludePath(b.path("src"));
|
||||
combat_obj.addIncludePath(b.path("libs/rng"));
|
||||
combat_obj.root_module.addIncludePath(b.path("src"));
|
||||
combat_obj.root_module.addIncludePath(b.path("libs/rng"));
|
||||
|
||||
// C sources remaining in src/
|
||||
const c_sources = [_][]const u8{
|
||||
|
|
@ -118,24 +118,24 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
|
||||
exe.addCSourceFiles(.{
|
||||
exe.root_module.addCSourceFiles(.{
|
||||
.files = &c_sources,
|
||||
.flags = c_flags,
|
||||
});
|
||||
|
||||
// src/ for own headers; libs/ so "rng/rng.h" and "map/map.h" resolve
|
||||
exe.addIncludePath(b.path("src"));
|
||||
exe.addIncludePath(b.path("libs"));
|
||||
exe.root_module.addIncludePath(b.path("src"));
|
||||
exe.root_module.addIncludePath(b.path("libs"));
|
||||
|
||||
exe.linkLibrary(rng_lib);
|
||||
exe.linkLibrary(map_lib);
|
||||
exe.addObject(tileset_obj);
|
||||
exe.addObject(combat_obj);
|
||||
exe.linkSystemLibrary("raylib");
|
||||
exe.linkSystemLibrary("m");
|
||||
exe.linkSystemLibrary("pthread");
|
||||
exe.linkSystemLibrary("dl");
|
||||
exe.linkSystemLibrary("rt");
|
||||
exe.root_module.linkLibrary(rng_lib);
|
||||
exe.root_module.linkLibrary(map_lib);
|
||||
exe.root_module.addObject(tileset_obj);
|
||||
exe.root_module.addObject(combat_obj);
|
||||
exe.root_module.linkSystemLibrary("raylib", .{});
|
||||
exe.root_module.linkSystemLibrary("m", .{});
|
||||
exe.root_module.linkSystemLibrary("pthread", .{});
|
||||
exe.root_module.linkSystemLibrary("dl", .{});
|
||||
exe.root_module.linkSystemLibrary("rt", .{});
|
||||
|
||||
b.installArtifact(exe);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue