From 608d7d55d5c85c96f2846a20d2d090cd39fd2f88 Mon Sep 17 00:00:00 2001 From: KAYUII <577738@qq.com> Date: Wed, 20 Nov 2024 19:41:30 +0800 Subject: [PATCH] add env VCPKG_INSTALLED_ROOT (#9985) --- build.rs | 6 +++++- libs/scrap/build.rs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 7333fff7b..3d19ee037 100644 --- a/build.rs +++ b/build.rs @@ -61,7 +61,11 @@ fn install_android_deps() { let target = format!("{}-android", target_arch); let vcpkg_root = std::env::var("VCPKG_ROOT").unwrap(); let mut path: std::path::PathBuf = vcpkg_root.into(); - path.push("installed"); + if let Ok(vcpkg_root) = std::env::var("VCPKG_INSTALLED_ROOT") { + path = vcpkg_root.into(); + } else { + path.push("installed"); + } path.push(target); println!( "{}", diff --git a/libs/scrap/build.rs b/libs/scrap/build.rs index 55a688633..0c0cd274e 100644 --- a/libs/scrap/build.rs +++ b/libs/scrap/build.rs @@ -55,7 +55,11 @@ fn link_vcpkg(mut path: PathBuf, name: &str) -> PathBuf { target = target.replace("x64", "x86"); } println!("cargo:info={}", target); - path.push("installed"); + if let Ok(vcpkg_root) = std::env::var("VCPKG_INSTALLED_ROOT") { + path = vcpkg_root.into(); + } else { + path.push("installed"); + } path.push(target); println!( "{}",