diff --git a/.zig-version b/.zig-version index 0008f35..ac454c6 100644 --- a/.zig-version +++ b/.zig-version @@ -1 +1 @@ -0.12.0-dev.2541+894493549 +0.12.0 diff --git a/build.zig b/build.zig index e0da4f8..d4832c9 100644 --- a/build.zig +++ b/build.zig @@ -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); @@ -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" }, diff --git a/src/lib.zig b/src/lib.zig index 4592275..6ee8205 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -74,3 +74,5 @@ comptime { @export(Wrapper.decode, .{ .name = "fl_delta_decode_" ++ @typeName(E) }); } } + +pub fn main() void {}