@@ -4,7 +4,7 @@ use crate::artifact_names::{dynamic_lib_name, static_lib_name};
44use crate :: external_deps:: c_cxx_compiler:: { cc, cxx} ;
55use crate :: external_deps:: llvm:: llvm_ar;
66use crate :: path_helpers:: path;
7- use crate :: targets:: { is_darwin, is_msvc , is_windows } ;
7+ use crate :: targets:: { is_darwin, is_windows , is_windows_msvc } ;
88
99// FIXME(Oneirical): These native build functions should take a Path-based generic.
1010
@@ -24,20 +24,20 @@ pub fn build_native_static_lib_optimized(lib_name: &str) -> PathBuf {
2424
2525#[ track_caller]
2626fn build_native_static_lib_internal ( lib_name : & str , optimzed : bool ) -> PathBuf {
27- let obj_file = if is_msvc ( ) { format ! ( "{lib_name}" ) } else { format ! ( "{lib_name}.o" ) } ;
27+ let obj_file = if is_windows_msvc ( ) { format ! ( "{lib_name}" ) } else { format ! ( "{lib_name}.o" ) } ;
2828 let src = format ! ( "{lib_name}.c" ) ;
2929 let lib_path = static_lib_name ( lib_name) ;
3030
3131 let mut cc = cc ( ) ;
32- if !is_msvc ( ) {
32+ if !is_windows_msvc ( ) {
3333 cc. arg ( "-v" ) ;
3434 }
3535 if optimzed {
3636 cc. optimize ( ) ;
3737 }
3838 cc. arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . optimize ( ) . run ( ) ;
3939
40- let obj_file = if is_msvc ( ) {
40+ let obj_file = if is_windows_msvc ( ) {
4141 PathBuf :: from ( format ! ( "{lib_name}.obj" ) )
4242 } else {
4343 PathBuf :: from ( format ! ( "{lib_name}.o" ) )
@@ -50,16 +50,17 @@ fn build_native_static_lib_internal(lib_name: &str, optimzed: bool) -> PathBuf {
5050/// [`std::env::consts::DLL_PREFIX`] and [`std::env::consts::DLL_EXTENSION`].
5151#[ track_caller]
5252pub fn build_native_dynamic_lib ( lib_name : & str ) -> PathBuf {
53- let obj_file = if is_msvc ( ) { format ! ( "{lib_name}" ) } else { format ! ( "{lib_name}.o" ) } ;
53+ let obj_file = if is_windows_msvc ( ) { format ! ( "{lib_name}" ) } else { format ! ( "{lib_name}.o" ) } ;
5454 let src = format ! ( "{lib_name}.c" ) ;
5555 let lib_path = dynamic_lib_name ( lib_name) ;
56- if is_msvc ( ) {
56+ if is_windows_msvc ( ) {
5757 cc ( ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
5858 } else {
5959 cc ( ) . arg ( "-v" ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
6060 } ;
61- let obj_file = if is_msvc ( ) { format ! ( "{lib_name}.obj" ) } else { format ! ( "{lib_name}.o" ) } ;
62- if is_msvc ( ) {
61+ let obj_file =
62+ if is_windows_msvc ( ) { format ! ( "{lib_name}.obj" ) } else { format ! ( "{lib_name}.o" ) } ;
63+ if is_windows_msvc ( ) {
6364 let out_arg = format ! ( "-out:{lib_path}" ) ;
6465 cc ( ) . input ( & obj_file) . args ( & [ "-link" , "-dll" , & out_arg] ) . run ( ) ;
6566 } else if is_darwin ( ) {
@@ -79,15 +80,15 @@ pub fn build_native_dynamic_lib(lib_name: &str) -> PathBuf {
7980/// Built from a C++ file.
8081#[ track_caller]
8182pub fn build_native_static_lib_cxx ( lib_name : & str ) -> PathBuf {
82- let obj_file = if is_msvc ( ) { format ! ( "{lib_name}" ) } else { format ! ( "{lib_name}.o" ) } ;
83+ let obj_file = if is_windows_msvc ( ) { format ! ( "{lib_name}" ) } else { format ! ( "{lib_name}.o" ) } ;
8384 let src = format ! ( "{lib_name}.cpp" ) ;
8485 let lib_path = static_lib_name ( lib_name) ;
85- if is_msvc ( ) {
86+ if is_windows_msvc ( ) {
8687 cxx ( ) . arg ( "-EHs" ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
8788 } else {
8889 cxx ( ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
8990 } ;
90- let obj_file = if is_msvc ( ) {
91+ let obj_file = if is_windows_msvc ( ) {
9192 PathBuf :: from ( format ! ( "{lib_name}.obj" ) )
9293 } else {
9394 PathBuf :: from ( format ! ( "{lib_name}.o" ) )
0 commit comments