make the ecs subsystem be a separate module

This commit is contained in:
Lorenzo Torres 2025-03-23 19:38:34 +01:00
parent 874134f3ff
commit 1d720c790d
4 changed files with 40 additions and 27 deletions

View file

@ -56,10 +56,16 @@ pub fn build(b: *std.Build) void {
glfw.linkLibC();
const mods = b.addModule("mods", .{
.root_source_file = b.path("src/mods/mods.zig"),
.target = target,
.optimize = optimize,
});
.root_source_file = b.path("src/mods/mods.zig"),
.target = target,
.optimize = optimize,
});
const ecs = b.addModule("ecs", .{
.root_source_file = b.path("src/ecs/ecs.zig"),
.target = target,
.optimize = optimize,
});
const exe = b.addExecutable(.{
.root_source_file = b.path("src/main.zig"),
@ -68,9 +74,9 @@ pub fn build(b: *std.Build) void {
.name = "sideros",
});
exe.root_module.addImport("mods", mods);
exe.root_module.addImport("ecs", ecs);
exe.addIncludePath(b.path("ext/glfw/include"));
exe.linkSystemLibrary("vulkan");
compileAllShaders(b, exe);
exe.linkLibrary(glfw);
@ -78,25 +84,25 @@ pub fn build(b: *std.Build) void {
b.installArtifact(exe);
// TODO: This does not generate documentation correctly?
// TODO: This does not generate documentation correctly?
const install_docs = b.addInstallDirectory(.{
.source_dir = exe.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs",
.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
// NOTE: This is a hack to generate documentation
const mods_lib = b.addStaticLibrary(.{
.root_module = mods,
.name = "mods",
.root_module = mods,
.name = "mods",
});
const mods_docs = b.addInstallDirectory(.{
.source_dir = mods_lib.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs/mods",
});
.source_dir = mods_lib.getEmittedDocs(),
.install_dir = .prefix,
.install_subdir = "docs/mods",
});
docs_step.dependOn(&mods_docs.step);
const run_cmd = b.addRunArtifact(exe);