aboutsummaryrefslogtreecommitdiff
path: root/lib/init-lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib/init-lib')
-rw-r--r--lib/init-lib/build.zig17
-rw-r--r--lib/init-lib/src/main.zig10
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/init-lib/build.zig b/lib/init-lib/build.zig
new file mode 100644
index 0000000000..b3876691a2
--- /dev/null
+++ b/lib/init-lib/build.zig
@@ -0,0 +1,17 @@
+const std = @import("std");
+
+pub fn build(b: *std.build.Builder) void {
+ // Standard release options allow the person running `zig build` to select
+ // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
+ const mode = b.standardReleaseOptions();
+
+ const lib = b.addStaticLibrary("$", "src/main.zig");
+ lib.setBuildMode(mode);
+ lib.install();
+
+ const main_tests = b.addTest("src/main.zig");
+ main_tests.setBuildMode(mode);
+
+ const test_step = b.step("test", "Run library tests");
+ test_step.dependOn(&main_tests.step);
+}
diff --git a/lib/init-lib/src/main.zig b/lib/init-lib/src/main.zig
new file mode 100644
index 0000000000..ecfeade1a3
--- /dev/null
+++ b/lib/init-lib/src/main.zig
@@ -0,0 +1,10 @@
+const std = @import("std");
+const testing = std.testing;
+
+export fn add(a: i32, b: i32) i32 {
+ return a + b;
+}
+
+test "basic add functionality" {
+ try testing.expect(add(3, 7) == 10);
+}