-
-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(leb128): Zig v0.11-dev syntax & build updates
- Loading branch information
1 parent
4a4359d
commit cae6541
Showing
3 changed files
with
53 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const std = @import("std"); | ||
|
||
pub fn build(b: *std.Build) void { | ||
const lib = b.addSharedLibrary(.{ | ||
.name = "leb128", | ||
// In this case the main source file is merely a path, however, in more | ||
// complicated build scripts, this could be a generated file. | ||
.root_source_file = .{ .path = "zig/leb128.zig" }, | ||
.target = .{ | ||
.cpu_arch = .wasm32, | ||
.os_tag = .freestanding, | ||
}, | ||
.optimize = .ReleaseSmall, | ||
}); | ||
// Add all symbols to the dynamic symbol table | ||
lib.rdynamic = true; | ||
|
||
b.installArtifact(lib); | ||
|
||
// Creates a step for unit testing. This only builds the test executable | ||
// but does not run it. | ||
const main_tests = b.addTest(.{ | ||
.root_source_file = .{ .path = "zig/leb128.zig" }, | ||
.target = b.standardTargetOptions(.{}), | ||
.optimize = b.standardOptimizeOption(.{}), | ||
}); | ||
|
||
const run_main_tests = b.addRunArtifact(main_tests); | ||
|
||
// This creates a build step. It will be visible in the `zig build --help` menu, | ||
// and can be selected like this: `zig build test` | ||
// This will evaluate the `test` step rather than the default, which is "install". | ||
const test_step = b.step("test", "Run library tests"); | ||
test_step.dependOn(&run_main_tests.step); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters