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

2
.gitignore vendored
View file

@ -114,7 +114,7 @@ $RECYCLE.BIN/
### zig ### ### zig ###
# Zig programming language # Zig programming language
zig-cache/ .zig-cache/
zig-out/ zig-out/
build/ build/
build-*/ build-*/

View file

@ -4,6 +4,9 @@ const std = @import("std");
// declaratively construct a build graph that will be executed by an external // declaratively construct a build graph that will be executed by an external
// runner. // runner.
pub fn build(b: *std.Build) void { 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 // Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which // 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 // 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", .name = "server",
// In this case the main source file is merely a path, however, in more // In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file. // 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, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -31,7 +34,7 @@ pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "server", .name = "server",
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path(server),
.target = target, .target = target,
.optimize = optimize, .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 // Creates a step for unit testing. This only builds the test executable
// but does not run it. // but does not run it.
const lib_unit_tests = b.addTest(.{ const lib_unit_tests = b.addTest(.{
.root_source_file = b.path("src/root.zig"), .root_source_file = b.path(tests),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -75,7 +78,7 @@ pub fn build(b: *std.Build) void {
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const exe_unit_tests = b.addTest(.{ const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path(server),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });