aboutsummaryrefslogtreecommitdiff
path: root/lib/std/special
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-26 14:33:36 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-02-28 14:51:54 -0500
commitcebcacd872a05d8ee3edaafe3eff5cc6e73657b7 (patch)
tree3dec36b8ae09ca06bfe242edbcaf74d809d96120 /lib/std/special
parentcf233bad5884b9bd782256eb6808fcc6abda645c (diff)
downloadzig-cebcacd872a05d8ee3edaafe3eff5cc6e73657b7.tar.gz
zig-cebcacd872a05d8ee3edaafe3eff5cc6e73657b7.zip
fix standardTargetOptions and improve init-exe to use it
Diffstat (limited to 'lib/std/special')
-rw-r--r--lib/std/special/init-exe/build.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/special/init-exe/build.zig b/lib/std/special/init-exe/build.zig
index 0b7410f2ad..fd71588c5f 100644
--- a/lib/std/special/init-exe/build.zig
+++ b/lib/std/special/init-exe/build.zig
@@ -1,8 +1,18 @@
const Builder = @import("std").build.Builder;
pub fn build(b: *Builder) void {
+ // Standard target options allows the person running `zig build` to choose
+ // what target to build for. Here we do not override the defaults, which
+ // means any target is allowed, and the default is native. Other options
+ // for restricting supported target set are available.
+ const target = b.standardTargetOptions(.{});
+
+ // Standard release options allow the person running `zig build` to select
+ // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
+
const exe = b.addExecutable("$", "src/main.zig");
+ exe.setTarget(target);
exe.setBuildMode(mode);
exe.install();