@@ -12,7 +12,11 @@ const LINUX_CLANG_DIRS: &'static [&'static str] = &[
12
12
"/usr/lib64/llvm" ,
13
13
"/usr/lib/x86_64-linux-gnu" ,
14
14
] ;
15
- const MAC_CLANG_DIR : & ' static str = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib" ;
15
+ const MAC_CLANG_DIR : & ' static [ & ' static str ] = & [
16
+ "/usr/local/opt/llvm/lib" ,
17
+ "/Library/Developer/CommandLineTools/usr/lib" ,
18
+ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib" ,
19
+ ] ;
16
20
const WIN_CLANG_DIRS : & ' static [ & ' static str ] = & [ "C:\\ Program Files\\ LLVM\\ bin" , "C:\\ Program Files\\ LLVM\\ lib" ] ;
17
21
18
22
fn path_exists ( path : & Path ) -> bool {
@@ -30,7 +34,7 @@ fn main() {
30
34
} else if cfg ! ( any( target_os = "linux" , target_os = "freebsd" ) ) {
31
35
LINUX_CLANG_DIRS . iter ( ) . map ( ToString :: to_string) . collect ( )
32
36
} else if cfg ! ( target_os = "macos" ) {
33
- vec ! [ MAC_CLANG_DIR . to_string( ) ]
37
+ MAC_CLANG_DIR . iter ( ) . map ( ToString :: to_string) . collect ( )
34
38
} else if cfg ! ( target_os = "windows" ) {
35
39
WIN_CLANG_DIRS . iter ( ) . map ( ToString :: to_string) . collect ( )
36
40
} else {
@@ -55,7 +59,6 @@ fn main() {
55
59
None
56
60
}
57
61
} ) . next ( ) ;
58
-
59
62
if maybe_clang_dir == None && cfg ! ( target_os = "linux" ) {
60
63
//try to find via lddconfig
61
64
//may return line, like
@@ -137,7 +140,7 @@ fn main() {
137
140
}
138
141
println ! ( "-L {} -l ncursesw -l z -l stdc++" , clang_dir. to_str( ) . unwrap( ) ) ;
139
142
} else {
140
- println ! ( "cargo:rustc-link-search=native= {}" , clang_dir. to_str( ) . unwrap( ) ) ;
143
+ println ! ( "cargo:rustc-link-search={}" , clang_dir. to_str( ) . unwrap( ) ) ;
141
144
if !libclang_path_string. is_empty ( ) {
142
145
let libclang_path = Path :: new ( & libclang_path_string) ;
143
146
println ! ( "cargo:rustc-link-lib=dylib=:{}" , libclang_path. file_name( ) . unwrap( ) . to_str( ) . unwrap( ) ) ;
0 commit comments