mirror of
https://git.s-ol.nu/glsl-view
synced 2025-08-01 22:20:07 +02:00
60 lines
2 KiB
Zig
60 lines
2 KiB
Zig
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 have_renderdoc = b.option(bool, "renderdoc", "enable OpenGL dbeugging (needs renderdoc)") 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);
|
|
options.addOption(bool, "have_renderdoc", have_renderdoc);
|
|
exe.root_module.addOptions("build_config", options);
|
|
|
|
exe.linkLibC();
|
|
exe.linkSystemLibrary("glfw3");
|
|
exe.linkSystemLibrary("epoxy");
|
|
exe.linkSystemLibrary("liblo");
|
|
|
|
if (have_ffmpeg) {
|
|
exe.linkSystemLibrary("libavcodec");
|
|
exe.linkSystemLibrary("libavformat");
|
|
exe.linkSystemLibrary("libavdevice");
|
|
exe.linkSystemLibrary("libavutil");
|
|
exe.linkSystemLibrary("libswscale");
|
|
}
|
|
|
|
if (have_ffmpeg and have_hap) {
|
|
exe.addIncludePath(b.path("lib"));
|
|
exe.addCSourceFile(.{ .file = b.path("lib/hap.c") });
|
|
exe.linkSystemLibrary("snappy");
|
|
}
|
|
|
|
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);
|
|
}
|