Skip to content

Commit

Permalink
Merge pull request #99 from leroycep/link-module-to-facil.io
Browse files Browse the repository at this point in the history
feat: streamline depending on zap by linking facil.io to module
  • Loading branch information
renerocksai authored Apr 24, 2024
2 parents 0de5c8f + 5f65c65 commit 6d7d152
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ Then, in your `build.zig`'s `build` function, add the following before
});
exe.root_module.addImport("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));
```

From then on, you can use the Zap package in your project. Check out the
Expand Down
17 changes: 5 additions & 12 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,14 @@ pub fn build(b: *std.Build) !void {
break :blk false;
};

// create a module to be used internally.
const facilio = try build_facilio("facil.io", b, target, optimize, use_openssl);

const zap_module = b.addModule("zap", .{
.root_source_file = .{ .path = "src/zap.zig" },
.target = target,
.optimize = optimize,
});

// register the module so it can be referenced using the package manager.
// try b.modules.put(b.dupe("zap"), zap_module);

const facilio = try build_facilio("facil.io", b, target, optimize, use_openssl);
zap_module.linkLibrary(facilio);

const all_step = b.step("all", "build all examples");

Expand Down Expand Up @@ -101,7 +100,6 @@ pub fn build(b: *std.Build) !void {
});

example.root_module.addImport("zap", zap_module);
example.linkLibrary(facilio);

// const example_run = example.run();
const example_run = b.addRunArtifact(example);
Expand Down Expand Up @@ -139,7 +137,6 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
});
auth_tests.linkLibrary(facilio);
auth_tests.root_module.addImport("zap", zap_module);

const run_auth_tests = b.addRunArtifact(auth_tests);
Expand All @@ -152,7 +149,6 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
});
mustache_tests.linkLibrary(facilio);
mustache_tests.root_module.addImport("zap", zap_module);

const run_mustache_tests = b.addRunArtifact(mustache_tests);
Expand All @@ -166,7 +162,6 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});

httpparams_tests.linkLibrary(facilio);
httpparams_tests.root_module.addImport("zap", zap_module);

const run_httpparams_tests = b.addRunArtifact(httpparams_tests);
Expand All @@ -184,7 +179,6 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});

sendfile_tests.linkLibrary(facilio);
sendfile_tests.root_module.addImport("zap", zap_module);
const run_sendfile_tests = b.addRunArtifact(sendfile_tests);
const install_sendfile_tests = b.addInstallArtifact(sendfile_tests, .{});
Expand Down Expand Up @@ -238,7 +232,6 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
});
docserver_exe.linkLibrary(facilio);
docserver_exe.root_module.addImport("zap", zap_module);
var docserver_step = b.step("docserver", "Build docserver");
const docserver_build_step = b.addInstallArtifact(docserver_exe, .{});
Expand Down

0 comments on commit 6d7d152

Please sign in to comment.