authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-04 22:55:50-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-07 17:27:09-07:00
log211ac00f8380629653ae475d7c347b0a67b480af
treed715ebb92d1f983a9c5f3d2b134472567aba5834
parent76e306ad0fa18a205c6c74032b36b33e17a9e454

build: -lversion -luuid on windows and -DNDEBUG=1 for clang sources


1 files changed, 12 insertions(+), 3 deletions(-)

build.zig+12-3
......@@ -106,7 +106,7 @@ pub fn build(b: *Builder) !void {
106106 softfloat.addCSourceFiles(&softfloat_sources, &[_][]const u8{ "-std=c99", "-O3" });
107107 exe.linkLibrary(softfloat);
108108
109 const exe_cflags = &[_][]const u8{
109 const exe_cflags = [_][]const u8{
110110 "-std=c++14",
111111 "-D__STDC_CONSTANT_MACROS",
112112 "-D__STDC_FORMAT_MACROS",
......@@ -119,9 +119,13 @@ pub fn build(b: *Builder) !void {
119119 "-Wno-missing-braces",
120120 "-Wno-comment",
121121 };
122 exe.addCSourceFiles(&stage1_sources, exe_cflags);
122 exe.addCSourceFiles(&stage1_sources, &exe_cflags);
123123 exe.addCSourceFiles(&optimized_c_sources, &[_][]const u8{ "-std=c99", "-O3" });
124 exe.addCSourceFiles(&zig_cpp_sources, exe_cflags);
124 // We need this because otherwise zig_clang_cc1_main.cpp ends up pulling
125 // in a dependency on llvm::cfg::Update<llvm::BasicBlock*>::dump() which is
126 // unavailable when LLVM is compiled in Release mode.
127 const zig_cpp_cflags = exe_cflags ++ [_][]const u8{"-DNDEBUG=1"};
128 exe.addCSourceFiles(&zig_cpp_sources, &zig_cpp_cflags);
125129 }
126130
127131 for (clang_libs) |lib_name| {
......@@ -138,6 +142,11 @@ pub fn build(b: *Builder) !void {
138142
139143 // This means we rely on clang-or-zig-built LLVM, Clang, LLD libraries.
140144 exe.linkSystemLibrary("c++");
145
146 if (target.getOs().tag == .windows) {
147 exe.linkSystemLibrary("version");
148 exe.linkSystemLibrary("uuid");
149 }
141150 }
142151 if (link_libc) {
143152 exe.linkLibC();