forked from Xerxes-2/clewdr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
34 lines (32 loc) · 1.44 KB
/
build.rs
File metadata and controls
34 lines (32 loc) · 1.44 KB
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
use std::{
env,
path::{Path, PathBuf},
};
fn main() {
#[cfg(all(feature = "mimalloc", feature = "dhat-heap"))]
compile_error!(
"feature \"mimalloc\" and feature \"dhat-heap\" cannot be enabled at the same time"
);
#[cfg(all(feature = "embed-resource", feature = "external-resource"))]
compile_error!(
"feature \"embed-resource\" and feature \"external-resource\" cannot be enabled at the same time"
);
#[cfg(not(any(feature = "embed-resource", feature = "external-resource")))]
compile_error!("feature \"embed-resource\" or feature \"external-resource\" must be enabled");
#[cfg(not(any(feature = "portable", feature = "xdg")))]
compile_error!("feature \"portable\" or feature \"xdg\" must be enabled");
#[cfg(all(feature = "portable", feature = "xdg"))]
compile_error!("feature \"portable\" and feature \"xdg\" cannot be enabled at the same time");
if env::var("CARGO_CFG_TARGET_OS").unwrap() == "android" {
android();
}
}
fn android() {
println!("cargo:rustc-link-lib=c++_shared");
let out_dir = env::var("OUT_DIR").unwrap();
let output_path = env::var("CARGO_NDK_OUTPUT_PATH").unwrap_or(out_dir);
let sysroot_libs_path = PathBuf::from(env::var_os("CARGO_NDK_SYSROOT_LIBS_PATH").unwrap());
let lib_path = sysroot_libs_path.join("libc++_shared.so");
let to_path = Path::new(&output_path).join("libc++_shared.so");
std::fs::copy(lib_path, to_path).unwrap();
}