prime31 / zig-ecs

MIT License
251 stars 39 forks source link

Install instruction #48

Open eunier opened 1 month ago

eunier commented 1 month ago

Hi, thanks for this work. Could you add install instruction for the zig nooby like myself, thanks!

eunier commented 1 month ago

I figured out be looking into your build.zig file.

Path: deps/... in my case:

    const ecs_module = b.addModule("zig-ecs", .{
        .root_source_file = b.path("deps/zig-ecs/src/ecs.zig"),
        .optimize = optimize,
        .target = target,
    });

    exe.root_module.addImport("ecs", ecs_module);

I still think the request could be useful.

lumorsunil commented 3 weeks ago

Hi, I added it like this:

    const ecs_dep = b.dependency("entt", .{
        .target = target,
        .optimize = optimize,
    });
    const ecs = ecs_dep.module("zig-ecs");
    exe.root_module.addImport("ecs", ecs);

Although I had to look up the name of the module for b.dependency("entt", ... as well as for ecs_dep.module("zig-ecs"). I think this is a deeper problem with zig's dependency system, but yeah it's always nice with some installation instructions.