summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorErnesto Lanchares <elancha98@proton.me>2025-03-23 18:20:38 +0000
committerLorenzo Torres <torres@sideros.org>2025-03-23 19:32:10 +0100
commit874134f3ff726d969fd901fee18c1aceb415c03b (patch)
tree5cd25aba47d6dc91737a2794622fe8dc21a8b9f6 /build.zig
parentb7854d7325dfe35ca41e56dcccfb8fb7b7d0aa22 (diff)
PROPOSAL: IR
This is a proposal of a custom IR to run wasm. At the moment only `ir.zig` has some parts related to this IR. The idea of the IR is to be a subset of the one defined in wasm. There are some gaps (mostly in wasm instructions that have opcode 0xFC) but in wasm they don't use all of the opcodes for some reason so maybe we could try to utilize them and be a superset of wasm.
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig29
1 files changed, 29 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 6e17bb6..0fbbc59 100644
--- a/build.zig
+++ b/build.zig
@@ -55,14 +55,22 @@ pub fn build(b: *std.Build) void {
}, .flags = &[_][]const u8{ "-D_GLFW_X11", "-Wall", "-Wextra" } });
glfw.linkLibC();
+ const mods = b.addModule("mods", .{
+ .root_source_file = b.path("src/mods/mods.zig"),
+ .target = target,
+ .optimize = optimize,
+ });
+
const exe = b.addExecutable(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.name = "sideros",
});
+ exe.root_module.addImport("mods", mods);
exe.addIncludePath(b.path("ext/glfw/include"));
+
exe.linkSystemLibrary("vulkan");
compileAllShaders(b, exe);
exe.linkLibrary(glfw);
@@ -70,6 +78,27 @@ pub fn build(b: *std.Build) void {
b.installArtifact(exe);
+ // TODO: This does not generate documentation correctly?
+ const install_docs = b.addInstallDirectory(.{
+ .source_dir = exe.getEmittedDocs(),
+ .install_dir = .prefix,
+ .install_subdir = "docs",
+ });
+ const docs_step = b.step("docs", "Generate documentation");
+ docs_step.dependOn(&install_docs.step);
+
+ // NOTE: This is a hack to generate documentation
+ const mods_lib = b.addStaticLibrary(.{
+ .root_module = mods,
+ .name = "mods",
+ });
+ const mods_docs = b.addInstallDirectory(.{
+ .source_dir = mods_lib.getEmittedDocs(),
+ .install_dir = .prefix,
+ .install_subdir = "docs/mods",
+ });
+ docs_step.dependOn(&mods_docs.step);
+
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());