Skip to content

Commit

Permalink
feat: use the new module system (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
usdogu authored Oct 31, 2023
1 parent 8a2e963 commit ffb49c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ zig-out/
/debug/
/build/
/build-*/
/docgen_tmp/
/docgen_tmp/
*.log
14 changes: 5 additions & 9 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const lib = b.addStaticLibrary(.{
.name = "extism",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
const extism_module = b.addModule("extism", .{
.source_file = .{ .path = "src/main.zig" },
});
b.installArtifact(lib);

var tests = b.addTest(.{
.name = "Library Tests",
Expand All @@ -28,7 +24,7 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

tests.addAnonymousModule("extism", .{ .source_file = .{ .path = "src/main.zig" } });
tests.addModule("extism", extism_module);
tests.linkLibC();
tests.addIncludePath(.{ .path = "/usr/local/include" });
tests.addLibraryPath(.{ .path = "/usr/local/lib" });
Expand All @@ -45,13 +41,13 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});

example.addAnonymousModule("extism", .{ .source_file = .{ .path = "src/main.zig" } });
example.addModule("extism", extism_module);
example.linkLibC();
example.addIncludePath(.{ .path = "/usr/local/include" });
example.addLibraryPath(.{ .path = "/usr/local/lib" });
example.linkSystemLibrary("extism");
const example_run_step = b.addRunArtifact(example);

const example_step = b.step("run_example", "Build basic_example");
const example_step = b.step("run_example", "Run the basic example");
example_step.dependOn(&example_run_step.step);
}

0 comments on commit ffb49c2

Please sign in to comment.