Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: streamline depending on zap by linking facil.io to module #99

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading