mirror of
https://github.com/logos-blockchain/logos-blockchain-rust-rapidsnark.git
synced 2026-06-07 03:39:29 +00:00
Merge pull request #10 from zkmopro/update-ndk
refactor: remove Android-specific linking logic from build script
This commit is contained in:
commit
625b31132f
@ -1,7 +1,6 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
const RAPIDSNARK_DOWNLOAD_SCRIPT: &str = include_str!("./download_rapidsnark.sh");
|
||||
@ -71,28 +70,4 @@ fn main() {
|
||||
println!("cargo:rustc-link-lib=dylib=fq");
|
||||
println!("cargo:rustc-link-lib=dylib=gmp");
|
||||
}
|
||||
|
||||
// refer to https://github.com/bbqsrc/cargo-ndk to see how to link the libc++_shared.so file in Android
|
||||
if env::var("CARGO_CFG_TARGET_OS").unwrap() == "android" {
|
||||
android();
|
||||
}
|
||||
}
|
||||
|
||||
fn android() {
|
||||
println!("cargo:rustc-link-lib=c++_shared");
|
||||
|
||||
if let Ok(output_path) = env::var("CARGO_NDK_OUTPUT_PATH") {
|
||||
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");
|
||||
assert!(
|
||||
lib_path.exists(),
|
||||
"Error: Source file {lib_path:?} does not exist"
|
||||
);
|
||||
let dest_dir = Path::new(&output_path).join(env::var("CARGO_NDK_ANDROID_TARGET").unwrap());
|
||||
println!("cargo:rerun-if-changed={dest_dir:?}");
|
||||
if !dest_dir.exists() {
|
||||
fs::create_dir_all(&dest_dir).unwrap();
|
||||
}
|
||||
fs::copy(lib_path, Path::new(&dest_dir).join("libc++_shared.so")).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user