on master help sign in
syntax: Use a different C++ flag for MSVC
commitf6a900fee1397e26c37489a3d434a9a77fbcc30a authorBlaž Hrastnik <blaz@mxxn.io> dateSat 5 Jun 2021, 23:57 (5 years ago) parent6254720
1 file changed+8−1
helix-syntax/build.rs+8−1
helix-syntax/build.rs+8−1
@@ -57,6 +57,13 @@ fn build_c(files: Vec<String>, language: &str) {
5757
5858fn build_cpp(files: Vec<String>, language: &str) {
5959 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+
6067 for file in files {
6168 build
6269 .file(&file)
@@ -64,7 +71,7 @@ fn build_cpp(files: Vec<String>, language: &str) {
6471 .pic(true)
6572 .warnings(false)
6673 .cpp(true)
67− .flag("-std=c++14");
74+ .flag_if_supported(flag);
6875 }
6976 build.compile(&format!("tree-sitter-{}-cpp", language));
7077}