Skip to content

Commit 557697f

Browse files
authored
Added ECAL_HOME env variable for Linux to specify eCAL install path (#89)
1 parent 8eed4fb commit 557697f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

rustecal-sys/build.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,22 @@ fn main() {
3232
println!("cargo:warning=Building on Windows");
3333
println!("cargo:warning=Using ECAL_HOME = {ecal_home}");
3434
} else if cfg!(target_os = "linux") {
35-
// --- Linux: Assume system-wide install ---
36-
println!("cargo:rustc-link-lib=dylib=ecal_core_c");
37-
println!("cargo:rustc-link-search=native=/usr/local/lib"); // Or /usr/lib if needed
35+
match env::var("ECAL_HOME") {
36+
Ok(ecal_home) => {
37+
println!("cargo:warning=Using ECAL_HOME = {ecal_home}");
38+
let include_path = format!("{ecal_home}/include");
39+
let lib_path = format!("{ecal_home}/lib");
40+
41+
println!("cargo:rustc-link-search=native={lib_path}");
3842

39-
builder = builder
40-
.clang_arg("-I/usr/include")
41-
.clang_arg("-I/usr/local/include");
43+
builder = builder.clang_arg(format!("-I{include_path}"));
44+
}
45+
_ => {
46+
println!("cargo:warning=Using system-wide eCAL install");
47+
}
48+
};
49+
50+
println!("cargo:rustc-link-lib=dylib=ecal_core_c");
4251

4352
// Debug info
4453
println!("cargo:warning=Building on Linux");

0 commit comments

Comments
 (0)