-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
35 lines (26 loc) · 1.09 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
const std = @import("std");
pub fn build(b: *std.Build) void {
// import dependencies
const jstring_build = @import("jstring");
const jstrings = b.dependency("jstring", .{});
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "tokenizig",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("jstring", jstrings.module("jstring"));
jstring_build.linkPCRE(exe, jstrings);
b.installArtifact(exe);
const runArtifact = b.addRunArtifact(exe);
const runStep = b.step("run", "Run the app");
runStep.dependOn(&runArtifact.step);
// Setup tests for the app
const exe_test = b.addTest(.{ .root_source_file = .{ .path = "src/root.zig" } });
exe_test.root_module.addImport("jstring", jstrings.module("jstring"));
jstring_build.linkPCRE(exe_test, jstrings);
const testStep = b.step("test", "test the app");
testStep.dependOn(&b.addRunArtifact(exe_test).step);
}