Skip to content

Commit

Permalink
These libraries have a different name on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Jun 3, 2022
1 parent 944bd17 commit a107f6e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion vision-gpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ serde_json = "1"

[build-dependencies]
which = "4"
cc = "1"
cc = "1"
build_cfg = "1"
36 changes: 26 additions & 10 deletions vision-gpu/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#[macro_use] extern crate build_cfg;

use std::{path::Path, process::Command};

fn cuda() {
Expand All @@ -8,16 +10,29 @@ fn cuda() {
println!("cargo:rerun-if-changed=../vision-common/src/consts/consts.cu");
println!("cargo:rerun-if-env-changed=CUDA_LIBRARY_PATH");

cc::Build::new()
.cuda(true)
.cargo_metadata(true)
.flag("-lnppc")
.flag("-lnppim")
.include("cuda")
.file("cuda/dilate.cpp")
.compile("gpu_dilate");

println!("cargo:rustc-link-lib=static=nppim");
if build_cfg!(target_os = "windows") {
cc::Build::new()
.cuda(true)
.cargo_metadata(true)
.flag("-lnppc")
.flag("-lnppim")
.include("cuda")
.file("cuda/dilate.cpp")
.compile("gpu_dilate");

println!("cargo:rustc-link-lib=static=nppim");
} else {
cc::Build::new()
.cuda(true)
.cargo_metadata(true)
.flag("-lnppc_static")
.flag("-lnppim_static")
.include("cuda")
.file("cuda/dilate.cpp")
.compile("gpu_dilate");

println!("cargo:rustc-link-lib=static=nppim_static");
}

if cfg!(feature = "gpu-ptx-vendored") {
return;
Expand Down Expand Up @@ -91,6 +106,7 @@ fn cuda() {
}
}

#[build_cfg_main]
fn main() {
println!("cargo:rerun-if-env-changed=PATH");
println!("cargo:rerun-if-env-changed=PATHEXT");
Expand Down

0 comments on commit a107f6e

Please sign in to comment.