diff options
| author | Mason Reed <mason@vector35.com> | 2024-10-25 10:30:01 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-10-25 10:30:05 -0400 |
| commit | f97c60b5f77c4b9b668ff0b5fd292b41521c72fd (patch) | |
| tree | 73925f97b61356033e97f5100fb42173f3eb1dbe /plugins/warp/build.rs | |
| parent | 5229159a85c720743c9f792be2a40edb225ca957 (diff) | |
Prevent building test artifacts on cmake builds
For some reason the linker is looking in the target directory of external rust plugins?
Diffstat (limited to 'plugins/warp/build.rs')
| -rw-r--r-- | plugins/warp/build.rs | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/plugins/warp/build.rs b/plugins/warp/build.rs index fe4d31f8..ac4a413e 100644 --- a/plugins/warp/build.rs +++ b/plugins/warp/build.rs @@ -31,37 +31,40 @@ fn main() { ); } - // 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) { - for entry in entries { - let entry = entry.unwrap(); - let path = entry.path(); - if path.is_file() { - let file_name = path.file_name().unwrap(); - let dest_path = out_dir_path.join(file_name); - std::fs::copy(&path, &dest_path).expect("failed to copy binary to OUT_DIR"); + #[cfg(feature = "build_artifacts")] + { + // 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) { + for entry in entries { + let entry = entry.unwrap(); + let path = entry.path(); + if path.is_file() { + let file_name = path.file_name().unwrap(); + let dest_path = out_dir_path.join(file_name); + std::fs::copy(&path, &dest_path).expect("failed to copy binary to OUT_DIR"); + } } } - } - // Compile all .c files in fixtures/src directory for unit tests. - let src_dir: PathBuf = "fixtures/src".into(); - if let Ok(entries) = std::fs::read_dir(src_dir) { - for entry in entries { - let entry = entry.unwrap(); - let path = entry.path(); - match path.extension().map(|s| s.to_str().unwrap()) { - Some("c") => { - cc::Build::new() - .file(&path) - .compile(path.file_stem().unwrap().to_str().unwrap()); + // Compile all .c files in fixtures/src directory for unit tests. + let src_dir: PathBuf = "fixtures/src".into(); + if let Ok(entries) = std::fs::read_dir(src_dir) { + for entry in entries { + let entry = entry.unwrap(); + let path = entry.path(); + match path.extension().map(|s| s.to_str().unwrap()) { + Some("c") => { + cc::Build::new() + .file(&path) + .compile(path.file_stem().unwrap().to_str().unwrap()); + } + Some("rs") => { + compile_rust(path); + } + _ => {} } - Some("rs") => { - compile_rust(path); - } - _ => {} } - } + } } } |
