mirror of
https://github.com/zigzap/zap.git
synced 2025-10-21 07:34: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:
commit
6d7d1523cc
2 changed files with 5 additions and 13 deletions
|
@ -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.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
|
From then on, you can use the Zap package in your project. Check out the
|
||||||
|
|
17
build.zig
17
build.zig
|
@ -19,15 +19,14 @@ pub fn build(b: *std.Build) !void {
|
||||||
break :blk false;
|
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", .{
|
const zap_module = b.addModule("zap", .{
|
||||||
.root_source_file = .{ .path = "src/zap.zig" },
|
.root_source_file = .{ .path = "src/zap.zig" },
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
zap_module.linkLibrary(facilio);
|
||||||
// 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);
|
|
||||||
|
|
||||||
const all_step = b.step("all", "build all examples");
|
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.root_module.addImport("zap", zap_module);
|
||||||
example.linkLibrary(facilio);
|
|
||||||
|
|
||||||
// const example_run = example.run();
|
// const example_run = example.run();
|
||||||
const example_run = b.addRunArtifact(example);
|
const example_run = b.addRunArtifact(example);
|
||||||
|
@ -139,7 +137,6 @@ pub fn build(b: *std.Build) !void {
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
auth_tests.linkLibrary(facilio);
|
|
||||||
auth_tests.root_module.addImport("zap", zap_module);
|
auth_tests.root_module.addImport("zap", zap_module);
|
||||||
|
|
||||||
const run_auth_tests = b.addRunArtifact(auth_tests);
|
const run_auth_tests = b.addRunArtifact(auth_tests);
|
||||||
|
@ -152,7 +149,6 @@ pub fn build(b: *std.Build) !void {
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
mustache_tests.linkLibrary(facilio);
|
|
||||||
mustache_tests.root_module.addImport("zap", zap_module);
|
mustache_tests.root_module.addImport("zap", zap_module);
|
||||||
|
|
||||||
const run_mustache_tests = b.addRunArtifact(mustache_tests);
|
const run_mustache_tests = b.addRunArtifact(mustache_tests);
|
||||||
|
@ -166,7 +162,6 @@ pub fn build(b: *std.Build) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
httpparams_tests.linkLibrary(facilio);
|
|
||||||
httpparams_tests.root_module.addImport("zap", zap_module);
|
httpparams_tests.root_module.addImport("zap", zap_module);
|
||||||
|
|
||||||
const run_httpparams_tests = b.addRunArtifact(httpparams_tests);
|
const run_httpparams_tests = b.addRunArtifact(httpparams_tests);
|
||||||
|
@ -184,7 +179,6 @@ pub fn build(b: *std.Build) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
sendfile_tests.linkLibrary(facilio);
|
|
||||||
sendfile_tests.root_module.addImport("zap", zap_module);
|
sendfile_tests.root_module.addImport("zap", zap_module);
|
||||||
const run_sendfile_tests = b.addRunArtifact(sendfile_tests);
|
const run_sendfile_tests = b.addRunArtifact(sendfile_tests);
|
||||||
const install_sendfile_tests = b.addInstallArtifact(sendfile_tests, .{});
|
const install_sendfile_tests = b.addInstallArtifact(sendfile_tests, .{});
|
||||||
|
@ -238,7 +232,6 @@ pub fn build(b: *std.Build) !void {
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
docserver_exe.linkLibrary(facilio);
|
|
||||||
docserver_exe.root_module.addImport("zap", zap_module);
|
docserver_exe.root_module.addImport("zap", zap_module);
|
||||||
var docserver_step = b.step("docserver", "Build docserver");
|
var docserver_step = b.step("docserver", "Build docserver");
|
||||||
const docserver_build_step = b.addInstallArtifact(docserver_exe, .{});
|
const docserver_build_step = b.addInstallArtifact(docserver_exe, .{});
|
||||||
|
|
Loading…
Add table
Reference in a new issue