summaryrefslogtreecommitdiff
path: root/helix-syntax
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-05 14:57:30 +0000
committerBlaž Hrastnik2021-06-05 15:00:18 +0000
commitf6a900fee1397e26c37489a3d434a9a77fbcc30a (patch)
treed9a0d0cecf99a268d4e3b2f6fe7ab397a6c7c3ba /helix-syntax
parent6254720f53a4c1bb3ae416363b2a8bd472455e8b (diff)
syntax: Use a different C++ flag for MSVC
Diffstat (limited to 'helix-syntax')
-rw-r--r--helix-syntax/build.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/helix-syntax/build.rs b/helix-syntax/build.rs
index 2e771ea4..a392a033 100644
--- a/helix-syntax/build.rs
+++ b/helix-syntax/build.rs
@@ -57,6 +57,13 @@ fn build_c(files: Vec<String>, language: &str) {
fn build_cpp(files: Vec<String>, language: &str) {
let mut build = cc::Build::new();
+
+ let flag = if build.get_compiler().is_like_msvc() {
+ "/std:c++14"
+ } else {
+ "-std=c++14"
+ };
+
for file in files {
build
.file(&file)
@@ -64,7 +71,7 @@ fn build_cpp(files: Vec<String>, language: &str) {
.pic(true)
.warnings(false)
.cpp(true)
- .flag("-std=c++14");
+ .flag_if_supported(flag);
}
build.compile(&format!("tree-sitter-{}-cpp", language));
}