@@ -47,16 +47,32 @@ fn build(sdk_path: Option<&str>, target: &str) {
47
47
48
48
let mut headers: Vec < & ' static str > = vec ! [ ] ;
49
49
50
- #[ cfg( feature = "audio_toolbox " ) ]
50
+ #[ cfg( feature = "audio_unit " ) ]
51
51
{
52
- println ! ( "cargo:rustc-link-lib=framework=AudioToolbox" ) ;
53
- headers. push ( "AudioToolbox/AudioToolbox.h" ) ;
52
+ // Since iOS 10.0 and macOS 10.12, all the functionality in AudioUnit
53
+ // moved to AudioToolbox, and the AudioUnit headers have been simple
54
+ // wrappers ever since.
55
+ if target. contains ( "apple-ios" ) {
56
+ // On iOS, the AudioUnit framework does not have (and never had) an
57
+ // actual dylib to link to, it is just a few header files.
58
+ // The AudioToolbox framework contains the symbols instead.
59
+ println ! ( "cargo:rustc-link-lib=framework=AudioToolbox" ) ;
60
+ } else {
61
+ // On macOS, the symbols are present in the AudioToolbox framework,
62
+ // but only on macOS 10.12 and above.
63
+ //
64
+ // However, unlike on iOS, the AudioUnit framework on macOS
65
+ // contains a dylib with the desired symbols, that we can link to
66
+ // (in later versions just re-exports from AudioToolbox).
67
+ println ! ( "cargo:rustc-link-lib=framework=AudioUnit" ) ;
68
+ }
69
+ headers. push ( "AudioUnit/AudioUnit.h" ) ;
54
70
}
55
71
56
- #[ cfg( feature = "audio_unit " ) ]
72
+ #[ cfg( feature = "audio_toolbox " ) ]
57
73
{
58
74
println ! ( "cargo:rustc-link-lib=framework=AudioToolbox" ) ;
59
- headers. push ( "AudioUnit/AudioUnit .h" ) ;
75
+ headers. push ( "AudioToolbox/AudioToolbox .h" ) ;
60
76
}
61
77
62
78
#[ cfg( feature = "core_audio" ) ]
0 commit comments