1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

Merge pull request #99 from leroycep/link-module-to-facil.io

feat: streamline depending on zap by linking facil.io to module
This commit is contained in:
Rene Schallner 2024-04-24 02:34:44 +02:00 committed by GitHub
commit 6d7d1523cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 13 deletions

View file

@ -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

View file

@ -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");
@ -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);
@ -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);
@ -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);
@ -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);
@ -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, .{});
@ -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, .{});