From 99c122a13872f3accbe39815b630642ac184afd9 Mon Sep 17 00:00:00 2001 From: Tony Bark Date: Tue, 18 Feb 2025 14:37:48 -0500 Subject: [PATCH] Moved build.zig to root - Ignore .zig-cache --- .gitignore | 4 ++-- server/build.zig => build.zig | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) rename server/build.zig => build.zig (93%) diff --git a/.gitignore b/.gitignore index 16c0ad6..38098ad 100644 --- a/.gitignore +++ b/.gitignore @@ -114,10 +114,10 @@ $RECYCLE.BIN/ ### zig ### # Zig programming language -zig-cache/ +.zig-cache/ zig-out/ build/ build-*/ docgen_tmp/ -# End of https://www.toptal.com/developers/gitignore/api/godot,visualstudiocode,macos,linux,windows,zig +# End of https://www.toptal.com/developers/gitignore/api/godot,visualstudiocode,macos,linux,windows,zig \ No newline at end of file diff --git a/server/build.zig b/build.zig similarity index 93% rename from server/build.zig rename to build.zig index 3fb65ab..64d6f8b 100644 --- a/server/build.zig +++ b/build.zig @@ -4,6 +4,9 @@ const std = @import("std"); // declaratively construct a build graph that will be executed by an external // runner. pub fn build(b: *std.Build) void { + const server = "server/src/main.zig"; + const tests = "server/src/root.zig"; + // 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 @@ -19,7 +22,7 @@ pub fn build(b: *std.Build) void { .name = "server", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. - .root_source_file = b.path("src/root.zig"), + .root_source_file = b.path(tests), .target = target, .optimize = optimize, }); @@ -31,7 +34,7 @@ pub fn build(b: *std.Build) void { const exe = b.addExecutable(.{ .name = "server", - .root_source_file = b.path("src/main.zig"), + .root_source_file = b.path(server), .target = target, .optimize = optimize, }); @@ -67,7 +70,7 @@ pub fn build(b: *std.Build) void { // Creates a step for unit testing. This only builds the test executable // but does not run it. const lib_unit_tests = b.addTest(.{ - .root_source_file = b.path("src/root.zig"), + .root_source_file = b.path(tests), .target = target, .optimize = optimize, }); @@ -75,7 +78,7 @@ pub fn build(b: *std.Build) void { const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); const exe_unit_tests = b.addTest(.{ - .root_source_file = b.path("src/main.zig"), + .root_source_file = b.path(server), .target = target, .optimize = optimize, });