summaryrefslogtreecommitdiff
path: root/plugins/warp/build.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-10-30 14:36:54 -0400
committerMason Reed <mason@vector35.com>2024-10-30 15:40:40 -0400
commit8885afb751fbb7eb00b9cc15b265a106114eddc7 (patch)
tree10adcc5284c366202faeb616d7ddee9ae8c5f088 /plugins/warp/build.rs
parent682848289b03f9ba8b14c5dc684306f670947216 (diff)
WARP: Make build script less scuffed
Diffstat (limited to 'plugins/warp/build.rs')
-rw-r--r--plugins/warp/build.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/plugins/warp/build.rs b/plugins/warp/build.rs
index ac4a413e..907abff5 100644
--- a/plugins/warp/build.rs
+++ b/plugins/warp/build.rs
@@ -1,6 +1,8 @@
+#![allow(unused_imports)]
use std::path::PathBuf;
use std::process::Command;
+#[cfg(test)]
fn compile_rust(file: PathBuf) -> bool {
let out_dir = std::env::var_os("OUT_DIR").unwrap();
let rustc = std::env::var_os("RUSTC").unwrap();
@@ -16,23 +18,21 @@ fn compile_rust(file: PathBuf) -> bool {
}
fn main() {
- let link_path = std::env::var_os("BINARYNINJADIR").expect("BINARYNINJADIR specified");
- let out_dir = std::env::var_os("OUT_DIR").expect("OUT_DIR specified");
- let out_dir_path = PathBuf::from(out_dir);
+ if let Some(link_path) = option_env!("BINARYNINJADIR") {
+ println!("cargo::rustc-link-lib=dylib=binaryninjacore");
+ println!("cargo::rustc-link-search={}", link_path);
- println!("cargo::rustc-link-lib=dylib=binaryninjacore");
- println!("cargo::rustc-link-search={}", link_path.to_str().unwrap());
-
- #[cfg(not(target_os = "windows"))]
- {
- println!(
- "cargo::rustc-link-arg=-Wl,-rpath,{0},-L{0}",
- link_path.to_string_lossy()
- );
+ #[cfg(not(target_os = "windows"))]
+ {
+ println!("cargo::rustc-link-arg=-Wl,-rpath,{0},-L{0}", link_path);
+ }
}
- #[cfg(feature = "build_artifacts")]
+ #[cfg(test)]
{
+ let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR specified");
+ let out_dir_path = PathBuf::from(out_dir);
+
// Copy all binaries to OUT_DIR for unit tests.
let bin_dir: PathBuf = "fixtures/bin".into();
if let Ok(entries) = std::fs::read_dir(bin_dir) {
@@ -65,6 +65,6 @@ fn main() {
_ => {}
}
}
- }
+ }
}
}