Skip to content

Commit

Permalink
Define FXX_GCC in fsr-sys build script at runtime based on CARGO_CFG_…
Browse files Browse the repository at this point in the history
…UNIX (#10)

A compile-time check for the target_os in a build script will describe
the build host when cross-compiling, not the final target.

This fixes being able to cross-compile the fsr-sys crate for Android on
Windows by checking for the `CARGO_CFG_UNIX` environment variable at
runtime instead.
  • Loading branch information
rib committed Dec 11, 2023
1 parent 3bc9425 commit 3f331b6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fsr-sys/build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ fn build_fsr(api_dir: &str, _vk_include_dir: &str) {
.cpp(true)
.define("DYNAMIC_LINK_VULKAN", "1");

#[cfg(not(target_os = "windows"))]
build.define("FFX_GCC", "1").std("c++2a");
if std::env::var("CARGO_CFG_UNIX").is_ok() {
build.define("FFX_GCC", "1").std("c++2a");
}

#[cfg(feature = "vulkan")]
build
Expand Down

0 comments on commit 3f331b6

Please sign in to comment.