Moved build.zig to root

- Ignore .zig-cache
This commit is contained in:
Tony Bark 2025-02-18 14:37:48 -05:00
parent 60d28a2879
commit 99c122a138
2 changed files with 9 additions and 6 deletions

4
.gitignore vendored
View file

@ -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

View file

@ -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,
});