summaryrefslogtreecommitdiff
path: root/rust/plugin_examples/data_renderer/build.rs
diff options
context:
space:
mode:
authorLukBukkit <luk.bukkit@gmail.com>2025-04-24 16:20:32 +0000
committerMason Reed <mason@vector35.com>2025-10-07 16:47:33 -0400
commit64633f61f7b9e03be9437b5f4896bbe122f7a7a2 (patch)
tree8fafed1395a8d2e29e5a6b8b7f7d7b8a2af2731a /rust/plugin_examples/data_renderer/build.rs
parente6e4ebea5d0ea7842766c7e686e0dfd45cb54bb8 (diff)
[Rust] Implement custom data renderer API
Also adds an example plugin and misc rust fixes / documentation. This is a continuation of https://github.com/Vector35/binaryninja-api/pull/6721 Co-authored-by: rbran <lgit@rubens.io>
Diffstat (limited to 'rust/plugin_examples/data_renderer/build.rs')
-rw-r--r--rust/plugin_examples/data_renderer/build.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/rust/plugin_examples/data_renderer/build.rs b/rust/plugin_examples/data_renderer/build.rs
new file mode 100644
index 00000000..9006f16a
--- /dev/null
+++ b/rust/plugin_examples/data_renderer/build.rs
@@ -0,0 +1,25 @@
+fn main() {
+ let link_path = std::env::var_os("DEP_BINARYNINJACORE_PATH")
+ .expect("DEP_BINARYNINJACORE_PATH not specified");
+
+ println!("cargo::rustc-link-lib=dylib=binaryninjacore");
+ println!("cargo::rustc-link-search={}", link_path.to_str().unwrap());
+
+ #[cfg(target_os = "linux")]
+ {
+ println!(
+ "cargo::rustc-link-arg=-Wl,-rpath,{0},-L{0}",
+ link_path.to_string_lossy()
+ );
+ }
+
+ #[cfg(target_os = "macos")]
+ {
+ let crate_name = std::env::var("CARGO_PKG_NAME").expect("CARGO_PKG_NAME not set");
+ let lib_name = crate_name.replace('-', "_");
+ println!(
+ "cargo::rustc-link-arg=-Wl,-install_name,@rpath/lib{}.dylib",
+ lib_name
+ );
+ }
+}