build(grammar): remove -fPIC flag from windows build (#13169)

Even though there is a check for `is_like_msvc`, when setting `CXX` to
`clang++` this will miss that check and try to use `-fPIC`, which is an
invlaid flag for the target.
This commit is contained in:
RoloEdits 2025-03-23 07:32:56 -07:00 committed by GitHub
parent 6bedca8064
commit 8ad6e53b1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -496,9 +496,11 @@ fn build_tree_sitter_library(
.arg("/link")
.arg(format!("/out:{}", library_path.to_str().unwrap()));
} else {
#[cfg(not(windows))]
command.arg("-fPIC");
command
.arg("-shared")
.arg("-fPIC")
.arg("-fno-exceptions")
.arg("-I")
.arg(header_path)
@ -517,8 +519,11 @@ fn build_tree_sitter_library(
cpp_command.args(compiler.args());
let object_file =
library_path.with_file_name(format!("{}_scanner.o", &grammar.grammar_id));
#[cfg(not(windows))]
cpp_command.arg("-fPIC");
cpp_command
.arg("-fPIC")
.arg("-fno-exceptions")
.arg("-I")
.arg(header_path)