first commit

This commit is contained in:
Lorenzo Torres 2026-02-24 14:28:56 +01:00
commit b574d39a39
23 changed files with 8604 additions and 0 deletions

102
build.zig Normal file
View file

@ -0,0 +1,102 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.addModule("wasm_runtime", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
});
const exe = b.addExecutable(.{
.name = "wasm_runtime",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "wasm_runtime", .module = mod },
},
}),
});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| run_cmd.addArgs(args);
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const lib_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_lib_tests = b.addRunArtifact(lib_tests);
const binary_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/wasm/binary.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_binary_tests = b.addRunArtifact(binary_tests);
const validator_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/wasm/validator.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_validator_tests = b.addRunArtifact(validator_tests);
const runtime_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/wasm/runtime.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_runtime_tests = b.addRunArtifact(runtime_tests);
const instance_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/wasm/instance.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_instance_tests = b.addRunArtifact(instance_tests);
const host_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/wasm/host.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_host_tests = b.addRunArtifact(host_tests);
const jit_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("src/wasm/jit_tests.zig"),
.target = target,
.optimize = optimize,
}),
});
const run_jit_tests = b.addRunArtifact(jit_tests);
const test_step = b.step("test", "Run all tests");
test_step.dependOn(&run_lib_tests.step);
test_step.dependOn(&run_binary_tests.step);
test_step.dependOn(&run_validator_tests.step);
test_step.dependOn(&run_runtime_tests.step);
test_step.dependOn(&run_instance_tests.step);
test_step.dependOn(&run_host_tests.step);
test_step.dependOn(&run_jit_tests.step);
}