const std = @import("std"); pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const target = b.standardTargetOptions(.{}); const have_ffmpeg = b.option(bool, "ffmpeg", "enable image/video support (needs ffmpeg)") orelse true; const have_hap = have_ffmpeg and b.option(bool, "hap", "enable HAP GPU upload support (needs snappy)") orelse true; const have_tsv = b.option(bool, "texture-share-vk", "enable GPU image sharing (needs texture-share-vk)") orelse false; const exe = b.addExecutable(.{ .name = "glsl-view", .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); const options = b.addOptions(); options.addOption(bool, "have_ffmpeg", have_ffmpeg); options.addOption(bool, "have_hap", have_hap); options.addOption(bool, "have_tsv", have_tsv); exe.root_module.addOptions("build_config", options); exe.linkLibC(); exe.linkSystemLibrary("glfw3.dll"); exe.linkSystemLibrary("epoxy.dll"); exe.linkSystemLibrary("lo.dll"); if (have_ffmpeg) { exe.linkSystemLibrary("avcodec.dll"); exe.linkSystemLibrary("avformat.dll"); exe.linkSystemLibrary("avdevice.dll"); exe.linkSystemLibrary("avutil.dll"); exe.linkSystemLibrary("swscale.dll"); } if (have_ffmpeg and have_hap) { exe.addIncludePath(b.path("lib")); exe.addCSourceFile(.{ .file = b.path("lib/hap.c") }); exe.linkSystemLibrary("snappy.dll"); } if (have_tsv) { exe.linkSystemLibrary("texture_share_gl_client"); } b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); }