alef 0.22.20

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This file is auto-generated by alef. DO NOT EDIT.
fn main() {
    let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
    cbindgen::generate(crate_dir)
        .expect("Unable to generate C bindings")
        .write_to_file("include/{{ header_name }}");

    // Set @rpath-relative install_name on macOS so the cdylib can be relocated
    // (bundled into language packages like packages/go/.lib/<rid>/, packages/
    // java/src/main/resources/natives/<rid>/, etc.) and located via the consumer
    // binary's rpath at runtime. Without this, the install_name embeds the CI
    // runner build path (`/Users/runner/work/.../target/.../deps/lib<name>.dylib`)
    // and dyld fails to load the bundled copy from its actual location.
    if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") {
        println!("cargo:rustc-link-arg-cdylib=-Wl,-install_name,@rpath/{{ lib_name }}.dylib");
    }
{{ go_copy_step }}}