-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
61 lines (53 loc) · 2.18 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
51
52
53
54
55
56
57
58
59
60
61
const std = @import("std");
pub fn build(b: *std.Build) void {
// Core module
const core_module = b.addModule("core", .{
.root_source_file = .{ .cwd_relative = "src/framework/core.zig" },
});
// Schema module
const schema_module = b.addModule("schema", .{
.root_source_file = .{ .cwd_relative = "src/framework/trpc/schema.zig" },
.imports = &.{
.{ .name = "core", .module = core_module },
},
});
// Runtime Router module
const runtime_router_module = b.addModule("runtime_router", .{
.root_source_file = .{ .cwd_relative = "src/framework/trpc/runtime_router.zig" },
.imports = &.{
.{ .name = "core", .module = core_module },
.{ .name = "schema", .module = schema_module },
},
});
// gRPC Router module
const grpc_router_module = b.addModule("grpc_router", .{
.root_source_file = .{ .cwd_relative = "src/framework/trpc/grpc_router.zig" },
.imports = &.{
.{ .name = "core", .module = core_module },
.{ .name = "schema", .module = schema_module },
.{ .name = "runtime_router", .module = runtime_router_module },
},
});
// Framework module
const framework_module = b.addModule("framework", .{
.root_source_file = .{ .cwd_relative = "src/framework/server.zig" },
.imports = &.{
.{ .name = "core", .module = core_module },
.{ .name = "schema", .module = schema_module },
.{ .name = "grpc_router", .module = grpc_router_module },
},
});
// API module
const zup_api = b.addStaticLibrary(.{
.name = "zup-api",
.root_source_file = .{ .cwd_relative = "src/root.zig" },
.target = b.standardTargetOptions(.{}),
.optimize = b.standardOptimizeOption(.{}),
});
zup_api.root_module.addImport("core", core_module);
zup_api.root_module.addImport("framework", framework_module);
zup_api.root_module.addImport("schema", schema_module);
zup_api.root_module.addImport("runtime_router", runtime_router_module);
zup_api.root_module.addImport("grpc_router", grpc_router_module);
b.installArtifact(zup_api);
}