fix windows builds (#6845)
This commit is contained in:
parent
a1044a6c68
commit
b7c62e200e
1 changed files with 5 additions and 4 deletions
|
@ -433,11 +433,12 @@ fn build_tree_sitter_library(
|
||||||
for (key, value) in compiler.env() {
|
for (key, value) in compiler.env() {
|
||||||
command.env(key, value);
|
command.env(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
command.args(compiler.args());
|
command.args(compiler.args());
|
||||||
// used to delay dropping the temporary object file until after the compilation is complete
|
// used to delay dropping the temporary object file until after the compilation is complete
|
||||||
let _path_guard;
|
let _path_guard;
|
||||||
|
|
||||||
if cfg!(all(windows, target_env = "msvc")) {
|
if compiler.is_like_msvc() {
|
||||||
command
|
command
|
||||||
.args(["/nologo", "/LD", "/I"])
|
.args(["/nologo", "/LD", "/I"])
|
||||||
.arg(header_path)
|
.arg(header_path)
|
||||||
|
@ -455,20 +456,20 @@ fn build_tree_sitter_library(
|
||||||
}
|
}
|
||||||
cpp_command.args(compiler.args());
|
cpp_command.args(compiler.args());
|
||||||
let object_file =
|
let object_file =
|
||||||
library_path.with_file_name(format!("{}_scanner.o", &grammar.grammar_id));
|
library_path.with_file_name(format!("{}_scanner.obj", &grammar.grammar_id));
|
||||||
cpp_command
|
cpp_command
|
||||||
.args(["/nologo", "/LD", "/I"])
|
.args(["/nologo", "/LD", "/I"])
|
||||||
.arg(header_path)
|
.arg(header_path)
|
||||||
.arg("/Od")
|
.arg("/Od")
|
||||||
.arg("/utf-8")
|
.arg("/utf-8")
|
||||||
.arg("/std:c++14")
|
.arg("/std:c++14")
|
||||||
.arg("/o")
|
.arg(format!("/Fo{}", object_file.display()))
|
||||||
.arg(&object_file)
|
|
||||||
.arg("/c")
|
.arg("/c")
|
||||||
.arg(scanner_path);
|
.arg(scanner_path);
|
||||||
let output = cpp_command
|
let output = cpp_command
|
||||||
.output()
|
.output()
|
||||||
.context("Failed to execute C++ compiler")?;
|
.context("Failed to execute C++ compiler")?;
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
return Err(anyhow!(
|
return Err(anyhow!(
|
||||||
"Parser compilation failed.\nStdout: {}\nStderr: {}",
|
"Parser compilation failed.\nStdout: {}\nStderr: {}",
|
||||||
|
|
Loading…
Add table
Reference in a new issue