@@ -433,11 +433,12 @@ fn build_tree_sitter_library(
433 for (key, value) in compiler.env() {
433 for (key, value) in compiler.env() {
434 command.env(key, value);
434 command.env(key, value);
436 command.args(compiler.args());
437 command.args(compiler.args());
437 // used to delay dropping the temporary object file until after the compilation is complete
438 // used to delay dropping the temporary object file until after the compilation is complete
438 let _path_guard;
439 let _path_guard;
440− if cfg!(all(windows, target_env = "msvc")) {
441+ if compiler.is_like_msvc() {
442 .args(["/nologo", "/LD", "/I"])
443 .args(["/nologo", "/LD", "/I"])
443 .arg(header_path)
444 .arg(header_path)
@@ -455,20 +456,20 @@ fn build_tree_sitter_library(
456 cpp_command.args(compiler.args());
457 cpp_command.args(compiler.args());
457 let object_file =
458 let object_file =
458− library_path.with_file_name(format!("{}_scanner.o", &grammar.grammar_id));
459+ library_path.with_file_name(format!("{}_scanner.obj", &grammar.grammar_id));
459 cpp_command
460 cpp_command
460 .args(["/nologo", "/LD", "/I"])
461 .args(["/nologo", "/LD", "/I"])
461 .arg(header_path)
462 .arg(header_path)
462 .arg("/Od")
463 .arg("/Od")
463 .arg("/utf-8")
464 .arg("/utf-8")
464 .arg("/std:c++14")
465 .arg("/std:c++14")
466− .arg(&object_file)
466+ .arg(format!("/Fo{}", object_file.display()))
467 .arg("/c")
467 .arg("/c")
468 .arg(scanner_path);
468 .arg(scanner_path);
469 let output = cpp_command
469 let output = cpp_command
470 .output()
470 .output()
471 .context("Failed to execute C++ compiler")?;
471 .context("Failed to execute C++ compiler")?;
472 if !output.status.success() {
473 if !output.status.success() {
473 return Err(anyhow!(
474 return Err(anyhow!(
474 "Parser compilation failed.\nStdout: {}\nStderr: {}",
475 "Parser compilation failed.\nStdout: {}\nStderr: {}",