Skip to content

Instantly share code, notes, and snippets.

@sortofsleepy
Created January 24, 2023 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sortofsleepy/717b998d2cf81aa3b71500d84cfc687a to your computer and use it in GitHub Desktop.
Save sortofsleepy/717b998d2cf81aa3b71500d84cfc687a to your computer and use it in GitHub Desktop.
Zig build script - passing command line value example
const Builder = @import("std").build.Builder;
const std = @import("std");
pub const OptionsStep = @import("std").build.OptionsStep;
pub fn build(b: *Builder) void {
var option = b.option(bool,"Desktop", "Set to true to build desktop focused library");
if(option == true){
std.log.info("TODO",.{});
}else {
const exe = b.addExecutable("zig_gl", "src/main.zig");
exe.setTarget(.{.cpu_arch = .wasm32, .os_tag = .freestanding});
exe.setOutputDir("client");
// finally build wasm.
b.default_step.dependOn(&exe.step);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment