38 lines
1.2 KiB
Zig
38 lines
1.2 KiB
Zig
const std = @import("std");
|
|
const Build = std.Build;
|
|
const LazyPath = Build.LazyPath;
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
buildSTBModule(b, target, optimize, "stb_image", b.path("src/stb_image.zig"), b.path("src/stb_image_impl.c"));
|
|
buildSTBModule(b, target, optimize, "stb_vorbis", b.path("src/stb_vorbis.zig"), b.path("src/stb_vorbis_impl.c"));
|
|
buildSTBModule(b, target, optimize, "stb_rect_pack", b.path("src/stb_rect_pack.zig"), b.path("src/stb_rect_pack_impl.c"));
|
|
buildSTBModule(b, target, optimize, "stb_truetype", b.path("src/stb_truetype.zig"), b.path("src/stb_truetype_impl.c"));
|
|
}
|
|
|
|
fn buildSTBModule(
|
|
b: *std.Build,
|
|
target: Build.ResolvedTarget,
|
|
optimize: std.builtin.OptimizeMode,
|
|
name: []const u8,
|
|
zig_file: LazyPath,
|
|
impl_file: LazyPath
|
|
) void {
|
|
const stb_dependency = b.dependency("stb", .{});
|
|
|
|
const mod = b.addModule(name, .{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.root_source_file = zig_file,
|
|
.link_libc = true,
|
|
});
|
|
|
|
mod.addIncludePath(stb_dependency.path("."));
|
|
mod.addCSourceFile(.{
|
|
.file = impl_file,
|
|
.flags = &.{}
|
|
});
|
|
}
|