Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
WASM target (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn authored May 3, 2024
1 parent 7823fc6 commit 9c72163
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .zig-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.0-dev.2541+894493549
0.12.0
14 changes: 14 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ pub fn build(b: *std.Build) void {
const dylib_header = b.addInstallFile(.{ .path = "zig-cache/fastlanez.h" }, "include/fastlanez.h");
dylib_header.step.dependOn(&dylib.step);

// Freestanding Executable (required for WASM)
const freestanding = b.addExecutable(.{
.name = "fastlanez",
.target = target,
.optimize = optimize,
.root_source_file = .{ .path = "src/lib.zig" },
});
freestanding.rdynamic = true;
freestanding.entry = .disabled;
const freestanding_install = b.addInstallArtifact(freestanding, .{});

const lib_step = b.step("lib", "Build static C library");
lib_step.dependOn(&lib_header.step);
lib_step.dependOn(&lib_install.step);
Expand All @@ -71,6 +82,9 @@ pub fn build(b: *std.Build) void {
dylib_step.dependOn(&lib_header.step);
dylib_step.dependOn(&dylib_install.step);

const freestanding_step = b.step("freestanding", "Build a freestanding executable");
freestanding_step.dependOn(&freestanding_install.step);

// Unit Tests
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/fastlanez.zig" },
Expand Down
2 changes: 2 additions & 0 deletions src/lib.zig
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ comptime {
@export(Wrapper.decode, .{ .name = "fl_delta_decode_" ++ @typeName(E) });
}
}

pub fn main() void {}

0 comments on commit 9c72163

Please sign in to comment.