git.s-ol.nu zig-imgui / master build.zig
master

Tree @master (Download .tar.gz)

build.zig @masterraw · history · blame

const Builder = @import("std").build.Builder;
const builtin = @import("builtin");

pub fn build(b: *Builder) void {
  const mode = b.standardReleaseOptions();
  const windows = b.option(bool, "windows", "create windows build") orelse false;

  var exe = b.addExecutable("test", "src/main.zig");
  exe.setBuildMode(mode);

  if (windows) {
    exe.setTarget(builtin.Arch.x86_64, builtin.Os.windows, builtin.Abi.gnu);
  }

  exe.linkSystemLibrary("c");
  exe.linkSystemLibrary("glfw");
  exe.linkSystemLibrary("epoxy");
  exe.addIncludeDir("cimgui");
  exe.linkSystemLibraryName("cimgui/cimgui.so");
  exe.install();

  const play = b.step("play", "Play the game");
  const run = exe.run();
  run.step.dependOn(b.getInstallStep());
  play.dependOn(&run.step);
}