diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-03-05 17:12:36 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-05 17:35:57 +0000 |
| commit | a514ba9eebd9316136c45ae6396b4ca6984b6859 (patch) | |
| tree | 06bf0f85c721a4c954a563fdc4bb6a7d540f58e6 /build.zig | |
| parent | fix shader reloading wrt Textures (diff) | |
| download | glsl-view-a514ba9eebd9316136c45ae6396b4ca6984b6859.tar.gz glsl-view-a514ba9eebd9316136c45ae6396b4ca6984b6859.zip | |
allow disabling texture/ffmpeg support at build time
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -4,21 +4,32 @@ pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const target = b.standardTargetOptions(.{}); + const have_ffmpeg = b.option(bool, "textures", "enable texture/video support (needs ffmpeg)") orelse true; + 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); + exe.root_module.addOptions("build_config", options); + exe.linkLibC(); exe.linkSystemLibrary("yaml-0.1"); exe.linkSystemLibrary("glfw3"); exe.linkSystemLibrary("epoxy"); exe.linkSystemLibrary("liblo"); - exe.linkSystemLibrary("libavcodec"); - exe.linkSystemLibrary("libavformat"); - exe.linkSystemLibrary("libavutil"); - exe.linkSystemLibrary("libswscale"); + + if (have_ffmpeg) { + exe.linkSystemLibrary("libavcodec"); + exe.linkSystemLibrary("libavformat"); + exe.linkSystemLibrary("libavutil"); + exe.linkSystemLibrary("libswscale"); + } + b.installArtifact(exe); const run_cmd = b.addRunArtifact(exe); |
