@@ -4,7 +4,7 @@ use crate::artifact_names::{dynamic_lib_name, static_lib_name};
4
4
use crate :: external_deps:: c_cxx_compiler:: { cc, cxx} ;
5
5
use crate :: external_deps:: llvm:: llvm_ar;
6
6
use 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 } ;
8
8
9
9
// FIXME(Oneirical): These native build functions should take a Path-based generic.
10
10
@@ -24,20 +24,20 @@ pub fn build_native_static_lib_optimized(lib_name: &str) -> PathBuf {
24
24
25
25
#[ track_caller]
26
26
fn 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" ) } ;
28
28
let src = format ! ( "{lib_name}.c" ) ;
29
29
let lib_path = static_lib_name ( lib_name) ;
30
30
31
31
let mut cc = cc ( ) ;
32
- if !is_msvc ( ) {
32
+ if !is_windows_msvc ( ) {
33
33
cc. arg ( "-v" ) ;
34
34
}
35
35
if optimzed {
36
36
cc. optimize ( ) ;
37
37
}
38
38
cc. arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . optimize ( ) . run ( ) ;
39
39
40
- let obj_file = if is_msvc ( ) {
40
+ let obj_file = if is_windows_msvc ( ) {
41
41
PathBuf :: from ( format ! ( "{lib_name}.obj" ) )
42
42
} else {
43
43
PathBuf :: from ( format ! ( "{lib_name}.o" ) )
@@ -50,16 +50,17 @@ fn build_native_static_lib_internal(lib_name: &str, optimzed: bool) -> PathBuf {
50
50
/// [`std::env::consts::DLL_PREFIX`] and [`std::env::consts::DLL_EXTENSION`].
51
51
#[ track_caller]
52
52
pub 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" ) } ;
54
54
let src = format ! ( "{lib_name}.c" ) ;
55
55
let lib_path = dynamic_lib_name ( lib_name) ;
56
- if is_msvc ( ) {
56
+ if is_windows_msvc ( ) {
57
57
cc ( ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
58
58
} else {
59
59
cc ( ) . arg ( "-v" ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
60
60
} ;
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 ( ) {
63
64
let out_arg = format ! ( "-out:{lib_path}" ) ;
64
65
cc ( ) . input ( & obj_file) . args ( & [ "-link" , "-dll" , & out_arg] ) . run ( ) ;
65
66
} else if is_darwin ( ) {
@@ -79,15 +80,15 @@ pub fn build_native_dynamic_lib(lib_name: &str) -> PathBuf {
79
80
/// Built from a C++ file.
80
81
#[ track_caller]
81
82
pub 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" ) } ;
83
84
let src = format ! ( "{lib_name}.cpp" ) ;
84
85
let lib_path = static_lib_name ( lib_name) ;
85
- if is_msvc ( ) {
86
+ if is_windows_msvc ( ) {
86
87
cxx ( ) . arg ( "-EHs" ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
87
88
} else {
88
89
cxx ( ) . arg ( "-c" ) . out_exe ( & obj_file) . input ( src) . run ( ) ;
89
90
} ;
90
- let obj_file = if is_msvc ( ) {
91
+ let obj_file = if is_windows_msvc ( ) {
91
92
PathBuf :: from ( format ! ( "{lib_name}.obj" ) )
92
93
} else {
93
94
PathBuf :: from ( format ! ( "{lib_name}.o" ) )
0 commit comments