Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["crates/luminal-driver-proto", "crates/luminal-vgd-core", "crates/luminal-vgd-host", "crates/luminal-vgd-driver", "crates/vgd-probe"]
members = ["crates/luminal-driver-proto", "crates/luminal-vgd-core", "crates/luminal-vgd-host", "crates/luminal-vgd-driver", "crates/vgd-probe", "crates/luminal-vgd-ffi"]

[workspace.package]
edition = "2021"
Expand Down
18 changes: 18 additions & 0 deletions crates/luminal-vgd-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-License-Identifier: AGPL-3.0-only
[package]
name = "luminal-vgd-ffi"
version = "0.1.0"
description = "C ABI over luminal-vgd-host for the LuminalShine (C++) integration: control-device ops and ring consumption. Built as a staticlib for the MSYS2 UCRT64 toolchain (target x86_64-pc-windows-gnullvm)."
edition.workspace = true
license.workspace = true
repository.workspace = true

[lib]
crate-type = ["staticlib", "lib"]

[dependencies]
luminal-driver-proto = { path = "../luminal-driver-proto" }
luminal-vgd-host = { path = "../luminal-vgd-host" }

[build-dependencies]
cbindgen = { version = "0.29", default-features = false }
32 changes: 32 additions & 0 deletions crates/luminal-vgd-ffi/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! Generates include/luminal_vgd.h from the FFI surface. The header is
//! committed (LuminalShine's CMake includes it without running cargo);
//! this regenerates it on every build so drift is impossible to miss in
//! review.

fn main() {
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let config = cbindgen::Config {
language: cbindgen::Language::C,
include_guard: Some("LUMINAL_VGD_H".into()),
header: Some(
"/* SPDX-License-Identifier: AGPL-3.0-only\n * Generated by luminal-vgd-ffi's build.rs (cbindgen) — do not edit.\n *\n * Link (MSYS2 UCRT64):\n * cargo build -p luminal-vgd-ffi --release --target x86_64-pc-windows-gnullvm\n * ... -lluminal_vgd_ffi -lcfgmgr32 -lws2_32 -luserenv -lntdll -lbcrypt\n */"
.into(),
),
cpp_compat: true,
..Default::default()
};
match cbindgen::Builder::new()
.with_crate(&crate_dir)
.with_config(config)
.generate()
{
Ok(bindings) => {
bindings.write_to_file(format!("{crate_dir}/include/luminal_vgd.h"));
}
// Never fail the build over header generation (e.g. during a
// syntax-error iteration); the committed header stays.
Err(e) => println!("cargo:warning=cbindgen skipped: {e}"),
}
println!("cargo:rerun-if-changed=src/lib.rs");
}
Loading