2017-04-11 11:14:46 +01:00
|
|
|
const Builder = @import("std").build.Builder;
|
2017-05-02 22:34:21 +01:00
|
|
|
const Mode = @import("builtin").Mode;
|
2017-04-11 11:14:46 +01:00
|
|
|
|
|
|
|
pub fn build(b: &Builder) {
|
2017-05-02 22:34:21 +01:00
|
|
|
const release_safe = b.option(bool, "--release-safe", "optimizations on and safety on") ?? false;
|
|
|
|
const release_fast = b.option(bool, "--release-fast", "optimizations on and safety off") ?? false;
|
|
|
|
|
|
|
|
const build_mode = if (release_safe) {
|
|
|
|
Mode.ReleaseSafe
|
|
|
|
} else if (release_fast) {
|
|
|
|
Mode.ReleaseFast
|
|
|
|
} else {
|
|
|
|
Mode.Debug
|
|
|
|
};
|
2017-04-11 11:14:46 +01:00
|
|
|
|
2017-04-19 06:13:15 +01:00
|
|
|
const exe = b.addExecutable("YOUR_NAME_HERE", "src/main.zig");
|
2017-05-02 22:34:21 +01:00
|
|
|
exe.setBuildMode(build_mode);
|
2017-04-19 06:13:15 +01:00
|
|
|
|
|
|
|
b.default_step.dependOn(&exe.step);
|
2017-04-11 11:14:46 +01:00
|
|
|
}
|