zig-zyrup/build.zig
2023-07-18 00:27:28 -07:00

48 lines
1.5 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const opts = .{ .target = target, .optimize = optimize };
const getty_mod = b.dependency("getty", opts).module("getty");
const lib = b.addStaticLibrary(.{
.name = "zyrup",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
lib.addModule("getty", getty_mod);
b.installArtifact(lib);
const ser_tests = b.addTest(.{
.name = "serializer test",
.root_source_file = .{ .path = "src/ser.zig" },
.target = target,
.optimize = optimize,
});
ser_tests.addModule("getty", getty_mod);
ser_tests.addAnonymousModule("zoo.bin", .{ .source_file = std.Build.FileSource.relative("test-data/zoo.bin") });
const utf8_tests = b.addTest(.{
.name = "utf8 string test",
.root_source_file = .{ .path = "src/utf8_string.zig" },
.target = target,
.optimize = optimize,
});
const record_tests = b.addTest(.{
.name = "record test",
.root_source_file = .{ .path = "src/record.zig" },
.target = target,
.optimize = optimize,
});
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&b.addRunArtifact(ser_tests).step);
test_step.dependOn(&b.addRunArtifact(utf8_tests).step);
test_step.dependOn(&b.addRunArtifact(record_tests).step);
}