From ea78fc7ac81d5cc616d9fd758acc753d30522743 Mon Sep 17 00:00:00 2001 From: clickingbuttons Date: Mon, 20 May 2024 13:13:25 -0400 Subject: [PATCH] simplify build.zig --- build.zig | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/build.zig b/build.zig index 97eedbe..8b80f66 100644 --- a/build.zig +++ b/build.zig @@ -1,35 +1,16 @@ const std = @import("std"); pub fn build(b: *std.Build) void { - const target = b.standardTargetOptions(.{}); - const optimize = b.standardOptimizeOption(.{}); - - const datetime = b.addModule("datetime", .{ - .root_source_file = b.path("src/root.zig"), - }); - - const lib = b.addStaticLibrary(.{ - .name = "datetime", - .root_source_file = b.path("src/root.zig"), - .target = target, - .optimize = optimize, - }); - b.installArtifact(lib); - - const lib_unit_tests = b.addTest(.{ - .root_source_file = b.path("src/root.zig"), - .target = target, - .optimize = optimize, - }); + const entry = b.path("src/root.zig"); + const lib = b.addModule("datetime", .{ .root_source_file = entry }); + const lib_unit_tests = b.addTest(.{ .root_source_file = entry }); const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); const demo = b.addTest(.{ .name = "demo", - .root_source_file = .{ .path = "./demos.zig" }, - .target = target, - .optimize = optimize, + .root_source_file = b.path("demos.zig"), }); - demo.root_module.addImport("datetime", datetime); + demo.root_module.addImport("datetime", lib); const run_demo = b.addRunArtifact(demo); const test_step = b.step("test", "Run unit tests");