-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
38 lines (32 loc) · 1.14 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use cfg_aliases::cfg_aliases;
pub fn main() {
#[cfg(all(feature = "use_apple", feature = "use_miniaudio"))]
{
//panic!("Backend apple and miniaudio are exclusive for the moment. Just choose one.");
}
#[cfg(not(any(feature = "use_apple", feature = "use_miniaudio")))]
{
// panic!("Warning no backend selected. Stub would be used.");
// :TODO: emit warning
}
#[cfg(all(feature = "use_apple", not(target_os = "macos")))]
{
//panic!("Backend apple only works on macOS. (iOS, ipadOS, tvOS coming soon)");
// :TODO: emit warning
}
cfg_aliases! {
macos: { target_os = "macos" },
linux: { target_os = "linux" },
windows: { target_os = "windows" },
// backends
use_apple: { all(macos, feature = "use_apple", not(wasm)) },
use_miniaudio: { all(feature = "use_miniaudio", not(wasm)) },
use_stub: { feature = "use_stub" }, //{ not(any(feature = "use_miniaudio", feature = "use_apple" ) ) }, // blocked by panic above
}
if std::env::var("TARGET").unwrap().contains("-apple") {
if cfg!(feature = "use_apple") {
println!("cargo:rustc-link-lib=framework=Foundation");
println!("cargo:rustc-link-lib=framework=AVFAudio");
}
}
}