build: don't archive libcombat

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I39a9ff0e253cf277bf4959a16e05fcff6a6a6964
This commit is contained in:
raf 2026-04-10 20:04:22 +03:00
commit 3ab42c3f65
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -49,8 +49,10 @@ pub fn build(b: *std.Build) void {
// utils.h is co-located with map.c
map_lib.addIncludePath(b.path("libs/map"));
// Zig combat library
const combat_lib = b.addLibrary(.{
// Zig combat library. This must be compiled as an object and linked
// directly to bypassing the archive step, or it yields a corrupt
// archive that forces the user to clear the cache each time.
const combat_obj = b.addObject(.{
.name = "combat",
.root_module = b.createModule(.{
.root_source_file = b.path("libs/combat/combat.zig"),
@ -60,8 +62,8 @@ pub fn build(b: *std.Build) void {
}),
});
// common.h and settings.h live in src/; rng.h exposed bare from libs/rng
combat_lib.addIncludePath(b.path("src"));
combat_lib.addIncludePath(b.path("libs/rng"));
combat_obj.addIncludePath(b.path("src"));
combat_obj.addIncludePath(b.path("libs/rng"));
// C sources remaining in src/
const c_sources = [_][]const u8{
@ -96,7 +98,7 @@ pub fn build(b: *std.Build) void {
exe.linkLibrary(rng_lib);
exe.linkLibrary(map_lib);
exe.linkLibrary(combat_lib);
exe.addObject(combat_obj);
exe.linkSystemLibrary("raylib");
exe.linkSystemLibrary("m");
exe.linkSystemLibrary("pthread");