Skip to content

Commit

Permalink
simplify build.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
clickingbuttons committed May 20, 2024
1 parent 688910b commit ea78fc7
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions build.zig
Original file line number Diff line number Diff line change
@@ -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");
Expand Down

0 comments on commit ea78fc7

Please sign in to comment.