build(amm): load amm_client_ffi via absolute store-path id + DYLD fallback on macOS

This commit is contained in:
Andrea Franz
2026-07-23 16:17:25 +02:00
committed by r4bbit
parent c0568e3a88
commit 8f67c4c4b6
3 changed files with 35 additions and 2 deletions
+7
View File
@@ -1,10 +1,17 @@
[package]
name = "amm_client_ffi"
version = "0.1.0"
# 2021 (not the repo's 2024): matches amm_core and keeps plain #[no_mangle]
# (edition 2024 requires #[unsafe(no_mangle)]).
edition = "2021"
[lib]
name = "amm_client_ffi"
# The logos module builder's macOS find_library only locates SHARED libs
# (lib<name>.dylib), never a static .a — so we must ship the cdylib. The flake
# gives the dylib an ABSOLUTE store-path install-name (not @rpath), so the plugin
# links it by its /nix/store path (kept in the closure) and dlopen resolves it at
# runtime without any rpath staging. staticlib/rlib kept for other consumers/tests.
crate-type = ["staticlib", "cdylib", "rlib"]
[lints]
+2
View File
@@ -5,4 +5,6 @@ fn main() {
.expect("cbindgen")
.write_to_file(format!("{crate_dir}/amm_client_ffi.h"));
println!("cargo:rerun-if-changed=src/lib.rs");
println!("cargo:rerun-if-changed=src");
println!("cargo:rerun-if-changed=cbindgen.toml");
}