Skip to content

Commit e116db4

Browse files
committed
reorder windows checks.
1 parent e66438c commit e116db4

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

snmalloc-rs/snmalloc-sys/build.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,28 @@ fn configure_platform(config: &mut BuildConfig) {
303303

304304
// Platform-specific configurations
305305
match () {
306+
_ if config.is_msvc() => {
307+
let msvc_flags = vec![
308+
"/nologo", "/W4", "/WX", "/wd4127", "/wd4324", "/wd4201",
309+
"/Ob2", "/DNDEBUG", "/EHsc", "/Gd", "/TP", "/Gm-", "/GS",
310+
"/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline"
311+
];
312+
for flag in msvc_flags {
313+
config.builder.flag_if_supported(flag);
314+
}
315+
316+
if config.features.lto {
317+
config.builder
318+
.flag_if_supported("/GL")
319+
.define("CMAKE_INTERPROCEDURAL_OPTIMIZATION", "TRUE")
320+
.define("SNMALLOC_IPO", "ON");
321+
println!("cargo:rustc-link-arg=/LTCG");
322+
}
323+
324+
config.builder
325+
.define("CMAKE_CXX_FLAGS_RELEASE", "/O2 /Ob2 /DNDEBUG /EHsc")
326+
.define("CMAKE_C_FLAGS_RELEASE", "/O2 /Ob2 /DNDEBUG /EHsc");
327+
}
306328
_ if config.is_windows() => {
307329
let common_flags = vec!["-mcx16", "-fno-exceptions", "-fno-rtti", "-pthread"];
308330
for flag in common_flags {
@@ -339,28 +361,6 @@ fn configure_platform(config: &mut BuildConfig) {
339361
}
340362
}
341363
}
342-
_ if config.is_msvc() => {
343-
let msvc_flags = vec![
344-
"/nologo", "/W4", "/WX", "/wd4127", "/wd4324", "/wd4201",
345-
"/Ob2", "/DNDEBUG", "/EHsc", "/Gd", "/TP", "/Gm-", "/GS",
346-
"/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline"
347-
];
348-
for flag in msvc_flags {
349-
config.builder.flag_if_supported(flag);
350-
}
351-
352-
if config.features.lto {
353-
config.builder
354-
.flag_if_supported("/GL")
355-
.define("CMAKE_INTERPROCEDURAL_OPTIMIZATION", "TRUE")
356-
.define("SNMALLOC_IPO", "ON");
357-
println!("cargo:rustc-link-arg=/LTCG");
358-
}
359-
360-
config.builder
361-
.define("CMAKE_CXX_FLAGS_RELEASE", "/O2 /Ob2 /DNDEBUG /EHsc")
362-
.define("CMAKE_C_FLAGS_RELEASE", "/O2 /Ob2 /DNDEBUG /EHsc");
363-
}
364364
_ if config.is_unix() => {
365365
let unix_flags = vec!["-fPIC", "-pthread", "-fno-exceptions", "-fno-rtti", "-mcx16", "-Wno-unused-parameter"];
366366
for flag in unix_flags {

0 commit comments

Comments
 (0)