authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-15 02:02:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-15 02:02:36-07:00
loga38042e3ac446194ae1496513d9b4634b1dd94b8
tree5e541657bdf7949de3f963ff0119a46af12e2e21
parentfa633a658f75d461da00fad9a72456e1420d2d62

ci: windows: proper flags to zig build


3 files changed, 11 insertions(+), 6 deletions(-)

build.zig+3-2
......@@ -55,6 +55,7 @@ pub fn build(b: *Builder) !void {
5555
5656 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
5757 const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false;
58 const omit_stage2 = b.option(bool, "omit-stage2", "Do not include stage2 behind a feature flag inside stage1") orelse false;
5859 const static_llvm = b.option(bool, "static-llvm", "Disable integration with system-installed LLVM, Clang, LLD, and libc++") orelse false;
5960 const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);
6061 const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h");
......@@ -196,7 +197,7 @@ pub fn build(b: *Builder) !void {
196197 exe.addBuildOption(bool, "enable_logging", enable_logging);
197198 exe.addBuildOption(bool, "enable_tracy", tracy != null);
198199 exe.addBuildOption(bool, "is_stage1", is_stage1);
199 exe.addBuildOption(bool, "omit_stage2", false);
200 exe.addBuildOption(bool, "omit_stage2", omit_stage2);
200201 if (tracy) |tracy_path| {
201202 const client_cpp = fs.path.join(
202203 b.allocator,
......@@ -219,7 +220,7 @@ pub fn build(b: *Builder) !void {
219220
220221 test_stage2.addBuildOption(bool, "skip_non_native", skip_non_native);
221222 test_stage2.addBuildOption(bool, "is_stage1", is_stage1);
222 test_stage2.addBuildOption(bool, "omit_stage2", false);
223 test_stage2.addBuildOption(bool, "omit_stage2", omit_stage2);
223224 test_stage2.addBuildOption(bool, "have_llvm", enable_llvm);
224225 test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled);
225226 test_stage2.addBuildOption(bool, "enable_wine", is_wine_enabled);
ci/azure/windows_script+3-1
......@@ -27,7 +27,9 @@ git fetch --tags
2727
2828mkdir build
2929cd build
30"$ZIG" build -Dstage1 -Dtarget=x86_64-windows-gnu \
30"$ZIG" build -Dstage1 -Domit-stage2 -Drelease \
31 -Dtarget=x86_64-windows-gnu \
32 -Dcpu=x86_64_v2 \
3133 --search-prefix "$PREFIX" \
3234 --override-lib-dir "$ZIGDIR/lib" \
3335 --prefix "$(pwd)/dist"
lib/std/build.zig+5-3
......@@ -675,17 +675,19 @@ pub const Builder = struct {
675675
676676 /// Exposes standard `zig build` options for choosing a target.
677677 pub fn standardTargetOptions(self: *Builder, args: StandardTargetOptionsArgs) CrossTarget {
678 const triple = self.option(
678 const maybe_triple = self.option(
679679 []const u8,
680680 "target",
681681 "The CPU architecture, OS, and ABI to build for",
682 ) orelse return args.default_target;
682 );
683 const mcpu = self.option([]const u8, "cpu", "Target CPU");
683684
684 // TODO add cpu and features as part of the target triple
685 const triple = maybe_triple orelse return args.default_target;
685686
686687 var diags: CrossTarget.ParseOptions.Diagnostics = .{};
687688 const selected_target = CrossTarget.parse(.{
688689 .arch_os_abi = triple,
690 .cpu_features = mcpu,
689691 .diagnostics = &diags,
690692 }) catch |err| switch (err) {
691693 error.UnknownCpuModel => {