From 54934a961fc39d43bd22e7246f18a75b5935f37e Mon Sep 17 00:00:00 2001 From: Kyle Scheuing Date: Thu, 4 Dec 2025 13:21:34 -0500 Subject: [PATCH] fix: cross compiling for windows from linux #[cfg(not(unix))] applies to the host machine (since that's where the build script is running) rather than the compilation target. Instead, environment variables are available to provide the information relevant to the build target at the build script's runtime. --- build.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 7ba035d4..a8f1a4cc 100644 --- a/build.rs +++ b/build.rs @@ -1,11 +1,13 @@ +use std::env; + fn main() { println!("cargo::rerun-if-changed=build.rs"); - #[cfg(not(unix))] - generate_bundled_icons(); + if env::var_os("CARGO_CFG_UNIX").is_none() { + generate_bundled_icons(); + } } -#[cfg(not(unix))] fn generate_bundled_icons() { println!("cargo::rerun-if-changed=cosmic-icons");