libchat/bin/chat-cli/build.rs
osmaczko 9e5f5573cb
chore(chat-cli): switch transport at runtime via --transport flag
Both file and logos-delivery transports are now compiled into a single
binary and selected at runtime (default: logos-delivery), replacing the
env-var-driven build-time cfg.
2026-04-27 15:27:55 +02:00

18 lines
714 B
Rust

fn main() {
println!("cargo:rerun-if-env-changed=LOGOS_DELIVERY_LIB_DIR");
let lib_dir = std::env::var("LOGOS_DELIVERY_LIB_DIR").expect(
"LOGOS_DELIVERY_LIB_DIR must be set; build liblogosdelivery via \
`nix build .#logos-delivery` and point this var at the result/lib directory",
);
println!("cargo:rustc-link-search=native={lib_dir}");
println!("cargo:rustc-link-lib=dylib=logosdelivery");
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
match target_os.as_str() {
"macos" | "linux" => println!("cargo:rustc-link-arg=-Wl,-rpath,{lib_dir}"),
other => panic!("unsupported OS for logos-delivery transport: {other}"),
}
}