Skip to content

Commit 20f7075

Browse files
gHashTagona-agent
andcommitted
Add build.zig for Zig 0.15.x compatibility
Co-authored-by: Ona <no-reply@ona.com>
1 parent 3b972f3 commit 20f7075

1 file changed

Lines changed: 29 additions & 39 deletions

File tree

build_zig15.zig

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
// build.zig для Zig 0.15.x
2-
// Используй этот файл если у тебя Zig 0.15.x (Homebrew на macOS)
3-
// Переименуй в build.zig: mv build_zig15.zig build.zig
4-
51
const std = @import("std");
62

73
pub fn build(b: *std.Build) void {
84
const target = b.standardTargetOptions(.{});
95
const optimize = b.standardOptimizeOption(.{});
106

11-
// Library module (Zig 0.15.x syntax)
12-
const trinity_mod = b.createModule(.{
7+
// Library module
8+
const trinity_mod = b.addModule("trinity", .{
139
.root_source_file = b.path("src/trinity.zig"),
1410
.target = target,
1511
.optimize = optimize,
@@ -83,9 +79,7 @@ pub fn build(b: *std.Build) void {
8379
.root_source_file = b.path("examples/memory.zig"),
8480
.target = target,
8581
.optimize = optimize,
86-
.imports = &.{
87-
.{ .name = "trinity", .module = trinity_mod },
88-
},
82+
.imports = &.{.{ .name = "trinity", .module = trinity_mod }},
8983
}),
9084
});
9185
b.installArtifact(example_memory);
@@ -96,9 +90,7 @@ pub fn build(b: *std.Build) void {
9690
.root_source_file = b.path("examples/sequence.zig"),
9791
.target = target,
9892
.optimize = optimize,
99-
.imports = &.{
100-
.{ .name = "trinity", .module = trinity_mod },
101-
},
93+
.imports = &.{.{ .name = "trinity", .module = trinity_mod }},
10294
}),
10395
});
10496
b.installArtifact(example_sequence);
@@ -109,9 +101,7 @@ pub fn build(b: *std.Build) void {
109101
.root_source_file = b.path("examples/vm.zig"),
110102
.target = target,
111103
.optimize = optimize,
112-
.imports = &.{
113-
.{ .name = "trinity", .module = trinity_mod },
114-
},
104+
.imports = &.{.{ .name = "trinity", .module = trinity_mod }},
115105
}),
116106
});
117107
b.installArtifact(example_vm);
@@ -166,39 +156,17 @@ pub fn build(b: *std.Build) void {
166156
const run_wasm_tests = b.addRunArtifact(wasm_tests);
167157
test_step.dependOn(&run_wasm_tests.step);
168158

169-
// Extension WASM tests
170-
const extension_tests = b.addTest(.{
171-
.root_module = b.createModule(.{
172-
.root_source_file = b.path("src/firebird/extension_wasm.zig"),
173-
.target = target,
174-
.optimize = optimize,
175-
}),
176-
});
177-
const run_extension_tests = b.addRunArtifact(extension_tests);
178-
test_step.dependOn(&run_extension_tests.step);
179-
180-
// DePIN tests
181-
const depin_tests = b.addTest(.{
182-
.root_module = b.createModule(.{
183-
.root_source_file = b.path("src/firebird/depin.zig"),
184-
.target = target,
185-
.optimize = optimize,
186-
}),
187-
});
188-
const run_depin_tests = b.addRunArtifact(depin_tests);
189-
test_step.dependOn(&run_depin_tests.step);
190-
191159
// Cross-platform release builds
192160
const release_step = b.step("release", "Build release binaries for all platforms");
193161

194-
const release_targets: []const std.Target.Query = &.{
162+
const targets: []const std.Target.Query = &.{
195163
.{ .cpu_arch = .x86_64, .os_tag = .linux },
196164
.{ .cpu_arch = .x86_64, .os_tag = .macos },
197165
.{ .cpu_arch = .aarch64, .os_tag = .macos },
198166
.{ .cpu_arch = .x86_64, .os_tag = .windows },
199167
};
200168

201-
for (release_targets) |t| {
169+
for (targets) |t| {
202170
const release_target = b.resolveTargetQuery(t);
203171
const release_exe = b.addExecutable(.{
204172
.name = "firebird",
@@ -222,4 +190,26 @@ pub fn build(b: *std.Build) void {
222190

223191
release_step.dependOn(&target_output.step);
224192
}
193+
194+
// Extension WASM tests
195+
const extension_tests = b.addTest(.{
196+
.root_module = b.createModule(.{
197+
.root_source_file = b.path("src/firebird/extension_wasm.zig"),
198+
.target = target,
199+
.optimize = optimize,
200+
}),
201+
});
202+
const run_extension_tests = b.addRunArtifact(extension_tests);
203+
test_step.dependOn(&run_extension_tests.step);
204+
205+
// DePIN tests
206+
const depin_tests = b.addTest(.{
207+
.root_module = b.createModule(.{
208+
.root_source_file = b.path("src/firebird/depin.zig"),
209+
.target = target,
210+
.optimize = optimize,
211+
}),
212+
});
213+
const run_depin_tests = b.addRunArtifact(depin_tests);
214+
test_step.dependOn(&run_depin_tests.step);
225215
}

0 commit comments

Comments
 (0)