diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -1,4 +1,5 @@ const std = @import("std"); +const Translator = @import("translate_c").Translator; const sokol = @import("sokol"); const cimgui = @import("cimgui"); const shdc = sokol.shdc; @@ -7,6 +8,7 @@ pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); + // imgui + sokol const cimgui_conf = cimgui.getConfig(true); const dep_sokol = b.dependency("sokol", .{ @@ -14,7 +16,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .with_sokol_imgui = true, .with_tracing = true, - }); + }); const dep_cimgui = b.dependency("cimgui", .{ .target = target, .optimize = optimize, @@ -22,6 +24,24 @@ pub fn build(b: *std.Build) void { dep_sokol.artifact("sokol_clib").root_module.addIncludePath(dep_cimgui.path(cimgui_conf.include_dir)); + // stb + const translate_c = b.dependency("translate_c", .{}); + + const tc_stb: Translator = .init(translate_c, .{ + .c_source_file = b.path("deps/stb/stb_image.h"), + .target = target, + .optimize = optimize, + .link_libc = true, + .default_init = false, + }); + + // zimg + const zigimg_dependency = b.dependency("zigimg", .{ + .target = target, + .optimize = optimize, + }); + + // core const shader = shdc.createSourceFile(b, .{ .shdc_dep = b.dependency("shdc", .{}), .input = "src/shaders/main.glsl", @@ -37,6 +57,7 @@ pub fn build(b: *std.Build) void { .spirv_vk = true, }, .reflection = true, + .bytecode = true, }) catch undefined; const exe = b.addExecutable(.{ @@ -46,6 +67,8 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, .imports = &.{ + .{ .name = "stbi", .module = tc_stb.mod }, + .{ .name = "zigimg", .module = zigimg_dependency.module("zigimg") }, .{ .name = "sokol", .module = dep_sokol.module("sokol") }, .{ .name = cimgui_conf.module_name, .module = dep_cimgui.module(cimgui_conf.module_name) }, }, @@ -54,6 +77,7 @@ pub fn build(b: *std.Build) void { exe.root_module.linkLibrary(dep_sokol.artifact("sokol_clib")); exe.root_module.link_libc = true; + exe.root_module.addCSourceFile(.{.file = b.path("deps/stb/stb_image.c")}); exe.step.dependOn(shader); if (target.result.os.tag == .windows) { |
