const std = @import("std"); const name = "minimgui"; pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); const emit_exe = b.option(bool, "emit-exe", "emit executable file") orelse false; const emit_lib = b.option(bool, "emit-lib", "emit shared object file") orelse false; const strip = b.option(bool, "strip", "strip debug symbols") orelse true; const mod = b.createModule(.{ .root_source_file = b.path(switch (target.result.os.tag) { .linux => "src/linux.zig", else => return error.UnsupportedOs, }), .target = target, .optimize = optimize, .link_libc = true, .strip = strip, }); mod.linkSystemLibrary("x11", .{}); mod.linkSystemLibrary("xext", .{}); mod.addIncludePath(b.path("lib/stb_image/")); mod.addCSourceFile(.{.file = b.path("lib/stb_image/stb_image.c"), .flags = &.{}}); mod.addIncludePath(b.path("lib/stb_truetype/")); mod.addCSourceFile(.{.file = b.path("lib/stb_truetype/stb_truetype.c"), .flags = &.{}}); const use_llvm = !strip or optimize != .Debug; if (emit_exe) { const exe = b.addExecutable(.{ .name = name, .root_module = mod, .use_llvm = use_llvm, }); b.installArtifact(exe); } if (emit_lib) { const lib = b.addLibrary(.{ .name = name, .root_module = mod, .linkage = .dynamic, .use_llvm = use_llvm, }); b.installArtifact(lib); } }