move rustc-link-search to build script

This commit is contained in:
Brendan Allan 2023-10-14 01:15:37 +08:00
parent b21d928479
commit 9e2e1f457a
2 changed files with 11 additions and 28 deletions

View file

@ -6,46 +6,18 @@ PROTOC = "{{{protoc}}}"
FFMPEG_DIR = "{{{nativeDeps}}}"
{{/isLinux}}
{{#isMacOS}}
[target.x86_64-apple-darwin]
rustflags = ["-L", "{{{nativeDeps}}}/lib"]
[target.x86_64-apple-darwin.heif]
rustc-link-search = ["{{{nativeDeps}}}/lib"]
rustc-link-lib = ["heif"]
[target.aarch64-apple-darwin]
rustflags = ["-L", "{{{nativeDeps}}}/lib"]
[target.aarch64-apple-darwin.heif]
rustc-link-search = ["{{{nativeDeps}}}/lib"]
rustc-link-lib = ["heif"]
{{/isMacOS}}
{{#isWin}}
[target.x86_64-pc-windows-msvc]
rustflags = ["-L", "{{{nativeDeps}}}\\lib"]
[target.x86_64-pc-windows-msvc.heif]
rustc-link-search = ["{{{nativeDeps}}}\\lib"]
rustc-link-lib = ["heif"]
{{/isWin}}
{{#isLinux}}
[target.x86_64-unknown-linux-gnu]
rustflags = ["-L", "{{{nativeDeps}}}/lib", "-C", "link-arg=-Wl,-rpath=${ORIGIN}/../lib/spacedrive"]
[target.x86_64-unknown-linux-gnu.heif]
rustc-link-search = ["{{{nativeDeps}}}/lib"]
rustc-link-lib = ["heif"]
[target.aarch64-unknown-linux-gnu]
rustflags = ["-L", "{{{nativeDeps}}}/lib", "-C", "link-arg=-Wl,-rpath=${ORIGIN}/../lib/spacedrive"]
[target.aarch64-unknown-linux-gnu.heif]
rustc-link-search = ["{{{nativeDeps}}}/lib"]
rustc-link-lib = ["heif"]
{{/isLinux}}
[alias]
prisma = "run -p prisma-cli --bin prisma --"

View file

@ -8,4 +8,15 @@ fn main() {
let git_hash = String::from_utf8(output.stdout)
.expect("Error passing output of `git rev-parse --short HEAD`");
println!("cargo:rustc-env=GIT_HASH={git_hash}");
#[cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))]
println!(
"cargo:rustc-link-search={}",
std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../apps/.deps/lib")
.display()
);
#[cfg(target_os = "linux")]
println!("cargo:rustc-link-arg=-Wl,-rpath=${ORIGIN}/../lib/spacedrive");
}