-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.zig
40 lines (34 loc) · 1.33 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const std = @import("std");
const assert = std.debug.assert;
pub fn build(b: *std.Build) !void {
const genent = b.addExecutable(.{
.name = "generate_entities",
.root_source_file = b.path("src/generate_entities.zig"),
.target = b.host,
});
const genent_step = b.addRunArtifact(genent);
const genent_out = genent_step.addOutputFileArg("entities.zig");
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.addModule("htmlentities", .{
.root_source_file = b.path("src/main.zig"),
.optimize = optimize,
.target = target,
});
mod.addAnonymousImport("entities", .{ .root_source_file = genent_out });
const lib = b.addStaticLibrary(.{
.name = "htmlentities.zig",
.root_source_file = b.path("src/main.zig"),
.optimize = optimize,
.target = target,
});
lib.root_module.addAnonymousImport("entities", .{ .root_source_file = genent_out });
b.installArtifact(lib);
var main_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.optimize = optimize,
});
main_tests.root_module.addAnonymousImport("entities", .{ .root_source_file = genent_out });
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);
}