anyascii.zig/build.zig
Madeorsk 6da1ed2e4c
Initial commit.
+ Add anyascii function from its C implementation (`2023-08-01` version).
+ Add utf8ToAscii helper function.
+ Add unit tests.
2025-01-08 19:53:23 +01:00

37 lines
1.1 KiB
Zig

const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Anyascii zig module.
const anyascii = b.addModule("anyascii", .{
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
});
anyascii.link_libc = true;
anyascii.addIncludePath(b.path("anyascii"));
anyascii.addCSourceFile(.{
.file = b.path("anyascii/anyascii.c"),
});
// Library unit tests.
const lib_unit_tests = b.addTest(.{
.root_source_file = b.path("src/lib.zig"),
.target = target,
.optimize = optimize,
});
lib_unit_tests.linkLibC();
lib_unit_tests.addIncludePath(b.path("anyascii"));
lib_unit_tests.addCSourceFile(.{
.file = b.path("anyascii/anyascii.c"),
});
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
}