Skip to content

Commit

Permalink
Stub at static linking (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattBlack85 committed Jun 7, 2023
1 parent 435982a commit 2ed40ec
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 3 deletions.
3 changes: 0 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,4 @@ fn main() {
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", &s_path);
}
}

println!("cargo:rustc-link-lib=ASICamera2");
println!("cargo:rustc-link-lib=EFWFilter");
}
63 changes: 63 additions & 0 deletions libasi/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
fn main() {
let mut os: &str = "";
let mut arch: Option<&str> = None;

if cfg!(target_os = "macos") {
os = "mac";
};

if cfg!(target_os = "linux") && cfg!(target_arch = "x86_64") {
os = "linux";
arch = Some("x64");
};

if cfg!(target_os = "linux") && cfg!(target_arch = "x86") {
os = "linux";
arch = Some("x86");
};

if cfg!(target_os = "linux") && cfg!(target_arch = "arm") {
os = "linux";
arch = Some("armv7");
};

if cfg!(target_os = "linux") && cfg!(target_arch = "aarch64") {
os = "linux";
arch = Some("armv8");
};

if cfg!(target_os = "windows") {
os = "windows";
arch = Some("x64");
};

let paths = [
{
if let Some(a) = arch {
std::fs::canonicalize(format!("../vendored/camera/{}/{}", os, a))
} else {
std::fs::canonicalize(format!("../vendored/camera/{}", os))
}
},
{
if let Some(a) = arch {
std::fs::canonicalize(format!("../vendored/efw/{}/{}", os, a))
} else {
std::fs::canonicalize(format!("../vendored/efw/{}", os))
}
},
];

for path in paths {
if let Some(s_path) = path.unwrap().as_os_str().to_str() {
println!("cargo:rustc-link-search={}", &s_path);
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", &s_path);
}
}


println!("cargo:rustc-link-lib=static=EFWFilter");
println!("cargo:rustc-link-lib=static=ASICamera2");
println!("cargo:rustc-link-lib=stdc++");
println!("cargo:rustc-link-lib=usb-1.0");
}

0 comments on commit 2ed40ec

Please sign in to comment.