Skip to content

Commit 21de0f0

Browse files
committed
Add same compiler flags as "official" build scripts
1 parent 0fbf27f commit 21de0f0

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

spirv-tools-sys/build.rs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,45 @@ fn main() {
242242
opt(&mut build);
243243
}
244244

245-
if !build.get_compiler().is_like_msvc() {
245+
let compiler = build.get_compiler();
246+
247+
if compiler.is_like_gnu() {
248+
build
249+
.flag("-Wall")
250+
.flag("-Wextra")
251+
.flag("-Wnon-virtual-dtor")
252+
.flag("-Wno-missing-field-initializers")
253+
.flag("-Werror")
254+
.flag("-std=c++11")
255+
.flag("-fno-exceptions")
256+
.flag("-fno-rtti")
257+
.flag("-Wno-long-long")
258+
.flag("-Wshadow")
259+
.flag("-Wundef")
260+
.flag("-Wconversion")
261+
.flag("-Wno-sign-conversion")
262+
.flag("-std=gnu++11")
263+
.flag("-Wno-error=switch");
264+
} else if compiler.is_like_clang() {
246265
build
266+
.flag("-Wextra-semi")
267+
.flag("-Wall")
268+
.flag("-Wextra")
269+
.flag("-Wnon-virtual-dtor")
270+
.flag("-Wno-missing-field-initializers")
271+
.flag("-Wno-self-assign")
272+
.flag("-Werror")
247273
.flag("-std=c++11")
248274
.flag("-fno-exceptions")
249-
.flag("-fno-rtti");
275+
.flag("-fno-rtti")
276+
.flag("-Wno-long-long")
277+
.flag("-Wshadow")
278+
.flag("-Wundef")
279+
.flag("-Wconversion")
280+
.flag("-Wno-sign-conversion")
281+
.flag("-ftemplate-depth=1024")
282+
.flag("-std=gnu++11")
283+
.flag("-Wno-error=switch");
250284
}
251285

252286
build.cpp(true);

0 commit comments

Comments
 (0)