-
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
// SPDX-FileCopyrightText: 2025 Shota FUJI <pockawoooh@gmail.com>
// SPDX-License-Identifier: AGPL-3.0-only
//! Zig のビルドスクリプト。
const std = @import("std");
const ProtoGenStep = @import("gremlin").ProtoGenStep;
pub fn build(b: *std.Build) void {
const proto_gen = ProtoGenStep.create(b, .{
.proto_sources = b.path("../proto/"),
.target = b.path("src/proto"),
});
// === WASM
const wasm_target = b.resolveTargetQuery(.{
.os_tag = .freestanding,
.cpu_arch = .wasm32,
});
// ファイルサイズが大きくなってきたら ReleaseSmall に置き換えるが、
// アプリケーションであるため初回ダウンロードよりも継続的な実行速度
// を重視したビルド設定になっている。
const wasm_optimize: std.builtin.OptimizeMode = .ReleaseSmall;
const wasm = b.addExecutable(.{
.name = "yamori_backend",
.root_source_file = b.path("src/wasm.zig"),
.target = wasm_target,
.optimize = wasm_optimize,
});
wasm.root_module.addImport(
"gremlin",
b.dependency("gremlin", .{
.target = wasm_target,
.optimize = wasm_optimize,
}).module("gremlin"),
);
// WASM モジュールを出力するために必要。
wasm.rdynamic = true;
wasm.entry = .disabled;
wasm.step.dependOn(&proto_gen.step);
b.installArtifact(wasm);
}