Skip to content

Commit

Permalink
feat(avc): support using env to specify static libs location
Browse files Browse the repository at this point in the history
  • Loading branch information
Mivik committed Aug 20, 2023
1 parent 40e9e39 commit 0133ef4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions prpr-avc/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use std::path::Path;

fn main() {
let lib_path = format!("{}/static-lib/{}", std::env::var("CARGO_MANIFEST_DIR").unwrap(), std::env::var("TARGET").unwrap());
println!("cargo:rustc-link-search={lib_path}");
let libs_dir = std::env::var("PRPR_AVC_LIBS").unwrap_or_else(|_| format!("{}/static-lib", std::env::var("CARGO_MANIFEST_DIR").unwrap()));
let libs_path = Path::new(&libs_dir).join(std::env::var("TARGET").unwrap());
let libs_path = libs_path.display();
println!("cargo:rustc-link-search={libs_path}");
println!("cargo:rustc-link-lib=z");
println!("cargo:rerun-if-changed={lib_path}");
println!("cargo:rerun-if-changed={libs_path}");
}

1 comment on commit 0133ef4

@void-cat-0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

啊卧槽终于支持这个了,之前被这玩意儿坑惨了,看了build.rs才看明白

Please sign in to comment.