vrischmann / zig-sqlite

zig-sqlite is a small wrapper around sqlite's C API, making it easier to use with Zig.
MIT License
367 stars 49 forks source link

build.zig: Configure module to be used downstream #154

Closed JacobCrabill closed 6 months ago

JacobCrabill commented 8 months ago

Description

With the recent Zig build system changes, Modules now work much like CMake library targets, in that settings applied to one module are applied to any other module which imports that module as a dependency. For example, with my current changes, I'm able to do the following (at least for my use case):

// Example setup in build.zig
const sqlite = b.dependency("sqlite", .{
    .target = target,
    .optimize = optimize,
    .use_bundled = true,
});
exe.root_module.addImport("sqlite", sqlite.module("sqlite"));
// Note that we no longer need to access and link to the "sqlite" artifact,
// nor add any include directories
vrischmann commented 6 months ago

Sorry for the long delay, thanks for the PR