-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
50 lines (46 loc) · 1.5 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
41
42
43
44
45
46
47
48
49
50
const std = @import("std");
const zine = @import("zine");
pub fn build(b: *std.Build) !void {
const wasm_target = b.resolveTargetQuery(.{
.cpu_arch = .wasm32,
.os_tag = .freestanding,
});
// Vendored version of https://github.com/ziglang/zig/tree/0.13.0/lib/docs/wasm
const docs_wasm = b.addExecutable(.{
.name = "main",
.target = wasm_target,
.optimize = .Debug,
.root_source_file = .{ .cwd_relative = "zig_docs/main.zig" },
});
docs_wasm.entry = .disabled;
docs_wasm.rdynamic = true;
const Walk = b.addModule("Walk", .{
.root_source_file = .{ .cwd_relative = "zig_docs/Walk.zig" },
});
docs_wasm.root_module.addImport("Walk", Walk);
zine.website(b, .{
.title = "ZML Documentation Website",
.host_url = "https://docs.zml.ai",
.content_dir_path = "content",
.layouts_dir_path = "layouts",
.assets_dir_path = "assets",
.static_assets = &.{
"zml_api.js",
"zml.no_light.svg",
},
.build_assets = &.{
.{ .name = "main.wasm", .lp = docs_wasm.getEmittedBin(), .install_path = "main.wasm", .install_always = true },
staticAsset(b, "main.js"),
staticAsset(b, "sources.tar"),
},
.debug = true,
});
}
fn staticAsset(b: *std.Build, name: []const u8) zine.BuildAsset {
return .{
.name = name,
.lp = b.path(name),
.install_path = name,
.install_always = true,
};
}