on master help sign in
syntax: Use a different C++ flag for MSVC
f6a900fBlaž Hrastnik
helix-syntax/build.rs+8−1
@@ -57,6 +57,13 @@ fn build_c(files: Vec<String>, language: &str) {
57
57
58fn build_cpp(files: Vec<String>, language: &str) {
58fn build_cpp(files: Vec<String>, language: &str) {
59 let mut build = cc::Build::new();
59 let mut build = cc::Build::new();
60+
61+ let flag = if build.get_compiler().is_like_msvc() {
62+ "/std:c++14"
63+ } else {
64+ "-std=c++14"
65+ };
66+
60 for file in files {
67 for file in files {
61 build
68 build
62 .file(&file)
69 .file(&file)
@@ -64,7 +71,7 @@ fn build_cpp(files: Vec<String>, language: &str) {
64 .pic(true)
71 .pic(true)
65 .warnings(false)
72 .warnings(false)
66 .cpp(true)
73 .cpp(true)
67− .flag("-std=c++14");
74+ .flag_if_supported(flag);
68 }
75 }
69 build.compile(&format!("tree-sitter-{}-cpp", language));
76 build.compile(&format!("tree-sitter-{}-cpp", language));
70}
77}