@@ -46,6 +46,19 @@ fn main() {
46
46
let android = target. contains ( "android" ) ;
47
47
let mut cfg = cmake:: Config :: new ( "libcubeb" ) ;
48
48
49
+ // Also clone better-supported rust backends.
50
+ if darwin {
51
+ let _ = Command :: new ( "git" )
52
+ . args ( [ "clone" , "https://github.com/mozilla/cubeb-coreaudio-rs.git" ] )
53
+ . current_dir ( "libcubeb/src" )
54
+ . status ( ) ;
55
+ } else if !windows {
56
+ let _ = Command :: new ( "git" )
57
+ . args ( [ "clone" , "https://github.com/mozilla/cubeb-pulse-rs" ] )
58
+ . current_dir ( "libcubeb/src" )
59
+ . status ( ) ;
60
+ }
61
+
49
62
if darwin {
50
63
let cmake_osx_arch = if target. contains ( "aarch64" ) {
51
64
// Apple Silicon
@@ -65,6 +78,9 @@ fn main() {
65
78
. define ( "BUILD_SHARED_LIBS" , "OFF" )
66
79
. define ( "BUILD_TESTS" , "OFF" )
67
80
. define ( "BUILD_TOOLS" , "OFF" )
81
+ // This is safe to set always; it's a no-op if the directories don't
82
+ // exist
83
+ . define ( "BUILD_RUST_LIBS" , "ON" )
68
84
. build ( ) ;
69
85
70
86
println ! ( "cargo:rustc-link-lib=static=cubeb" ) ;
@@ -80,6 +96,11 @@ fn main() {
80
96
println ! ( "cargo:rustc-link-lib=framework=CoreAudio" ) ;
81
97
println ! ( "cargo:rustc-link-lib=framework=CoreServices" ) ;
82
98
println ! ( "cargo:rustc-link-lib=dylib=c++" ) ;
99
+ println ! ( "cargo:rustc-link-lib=static=cubeb_coreaudio" ) ;
100
+ let mut search_path = std:: env:: current_dir ( ) . unwrap ( ) ;
101
+ // TODO: Also allow for debug?
102
+ search_path. push ( "libcubeb/src/cubeb-coreaudio-rs/target/release" ) ;
103
+ println ! ( "cargo:rustc-link-search=native={}" , search_path. display( ) ) ;
83
104
println ! ( "cargo:rustc-link-search=native={}/lib" , dst. display( ) ) ;
84
105
} else {
85
106
if freebsd || android {
@@ -93,7 +114,13 @@ fn main() {
93
114
// Ignore the result of find_library. We don't care if the
94
115
// libraries are missing.
95
116
let _ = pkg_config:: find_library ( "alsa" ) ;
96
- let _ = pkg_config:: find_library ( "libpulse" ) ;
117
+ if pkg_config:: find_library ( "libpulse" ) . is_ok ( ) || true {
118
+ println ! ( "cargo:rustc-link-lib=static=cubeb_pulse" ) ;
119
+ let mut search_path = std:: env:: current_dir ( ) . unwrap ( ) ;
120
+ // TODO: Also allow for debug?
121
+ search_path. push ( "libcubeb/src/cubeb-pulse/target/release" ) ;
122
+ println ! ( "cargo:rustc-link-search=native={}" , search_path. display( ) ) ;
123
+ }
97
124
let _ = pkg_config:: find_library ( "jack" ) ;
98
125
let _ = pkg_config:: find_library ( "speexdsp" ) ;
99
126
if android {
0 commit comments