Skip to content

Commit 807bb6d

Browse files
committed
improve packaging of libprojectM source
1 parent a35b603 commit 807bb6d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

projectm-sys/build.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ fn main() {
2828

2929
// Platform-specific configurations
3030
if cfg!(target_os = "windows") {
31-
// Ensure VCPKG is set up correctly
32-
let vcpkg_root = env::var("VCPKG_INSTALLATION_ROOT").expect("VCPKG_INSTALLATION_ROOT is not set");
31+
let vcpkg_root = match env::var("VCPKG_INSTALLATION_ROOT") {
32+
Ok(val) => val,
33+
Err(_) => {
34+
println!("cargo:warning=VCPKG_INSTALLATION_ROOT is not set. Please set it to your VCPKG installation directory.");
35+
std::process::exit(1);
36+
}
37+
};
3338
cmake_config
3439
.generator("Visual Studio 17 2022")
3540
.define(
@@ -50,7 +55,7 @@ fn main() {
5055
println!("cargo:rustc-link-search=native={}/lib", dst.display());
5156

5257
// Determine the library name based on the build profile
53-
let profile = env::var("PROFILE").unwrap();
58+
let profile = env::var("PROFILE").unwrap_or_else(|_| "release".to_string());
5459
let lib_suffix = if profile == "release" { "" } else { "d" };
5560
let lib_name = format!("projectM-4{}", lib_suffix);
5661

0 commit comments

Comments
 (0)