diff options
| author | james7132 <[email protected]> | 2021-05-20 18:30:12 -0700 |
|---|---|---|
| committer | james7132 <[email protected]> | 2021-05-20 18:30:12 -0700 |
| commit | dd4fef7b6e88451f8716057b9789877ce26363fb (patch) | |
| tree | 1042d636aa4b4f0b99f2ec29a7665cb0b4c2d4ae | |
| parent | Merge pull request #53 from james7132/patch-1 (diff) | |
| download | steamworks-rs-cargo-run-fix.tar.xz steamworks-rs-cargo-run-fix.zip | |
Fix #55: Move rustc-link-search to target dircargo-run-fix
| -rwxr-xr-x | steamworks-sys/build.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/steamworks-sys/build.rs b/steamworks-sys/build.rs index f351aae..5217400 100755 --- a/steamworks-sys/build.rs +++ b/steamworks-sys/build.rs @@ -34,7 +34,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { } else { panic!("Unsupported OS"); }; - println!("cargo:rustc-link-search={}", link_path.display()); + + if triple.contains("windows") { + let dll_file = format!("{}.dll", lib); + let lib_file = format!("{}.lib", lib); + fs::copy(link_path.join(&dll_file), out_path.join(dll_file))?; + fs::copy(link_path.join(&lib_file), out_path.join(lib_file))?; + } else if triple.contains("darwin") { + fs::copy(link_path.join("libsteam_api.dylib"), out_path.join("libsteam_api.dylib"))?; + } else if triple.contains("linux") { + fs::copy(link_path.join("libsteam_api.so"), out_path.join("libsteam_api.so"))?; + } + + println!("cargo:rustc-link-search={}", out_path.display()); println!("cargo:rustc-link-lib=dylib={}", lib); let bindings = bindgen::Builder::default() @@ -60,14 +72,5 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { ) .expect("Couldn't write bindings!"); - if triple.contains("windows") { - let file_name = format!("{}.dll", lib); - fs::copy(link_path.join(&file_name), out_path.join(file_name))?; - } else if triple.contains("darwin") { - fs::copy(link_path.join("libsteam_api.dylib"), out_path.join("libsteam_api.dylib"))?; - } else if triple.contains("linux") { - fs::copy(link_path.join("libsteam_api.so"), out_path.join("libsteam_api.so"))?; - } - Ok(()) } |