Skip to content

Commit

Permalink
windows link ok
Browse files Browse the repository at this point in the history
  • Loading branch information
youyuanwu committed Dec 8, 2024
1 parent 849e02b commit 89b7032
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(_msquic_version "v2.4.5")
set(_win_pkg_url "https://github.com/microsoft/msquic/releases/download/${_msquic_version}/msquic_windows_x64_Release_schannel.zip")
set(_linux_pkg_url "https://github.com/microsoft/msquic/releases/download/${_msquic_version}/msquic_linux_x64_Release_openssl.zip")
if(WIN32)
# windows downloads release for winmd generation.
# windows downloads release for winmd generation. And for sys2 import lib link.
set(release_url ${_win_pkg_url})
message(STATUS "fetching msquic_release " ${release_url})
include(FetchContent)
Expand Down
37 changes: 16 additions & 21 deletions crates/libs/msquic-sys2/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@
// license information.
// ------------------------------------------------------------

// use std::{env, path::Path};

fn main() {
// let pkg_dir = String::from("build/_deps/msquic_release-src");
// let package_root = env::var("CARGO_MANIFEST_DIR").unwrap();
// let project_root = package_root + "/../../../";
// let abs_search_dir;
// if cfg!(windows) {
// // add link dir for fabric support libs. This is propagated to downstream targets
// abs_search_dir = project_root + &pkg_dir + "/lib";
// } else if cfg!(unix) {
// abs_search_dir = project_root + "build"; // hack: we create a symlink in the build dir to let ld not deal with .so versions
// //println!("cargo:rustc-link-arg=-Wl,-rpath,{}",abs_search_dir)
// } else {
// panic!("unsupport platform")
// }
// println!(
// "cargo:rustc-link-search=native={}",
// Path::new(&abs_search_dir).display()
// );
// This does not work for cargo test
// println!("cargo:rustc-env=LD_LIBRARY_PATH={}", abs_search_dir);
if cfg!(windows) {
let pkg_dir = String::from("build/_deps/msquic_release-src");
let package_root = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let project_root = package_root + "/../../../";
let abs_search_dir;
// add link dir for fabric support libs. This is propagated to downstream targets
abs_search_dir = project_root + &pkg_dir + "/lib";
println!(
"cargo:rustc-link-search=native={}",
std::path::Path::new(&abs_search_dir).display()
);
} else if cfg!(unix) {
// unix can link with apt install.
} else {
panic!("unsupport platform")
}
}

0 comments on commit 89b7032

Please sign in to comment.