Ralith / openxrs

OpenXR bindings for Rust
Apache License 2.0
282 stars 59 forks source link

fix cross-compiling static loader #162

Closed Timbals closed 4 months ago

Timbals commented 4 months ago

The build script used the cfg! macro to check the target os, but the "target" in a build script is actually the host. Use the CARGO_CFG_TARGET_OS environment variable instead.

Issue #42 has been worked around, and then fixed upstream, so the additional flag on windows is no longer necessary.

Linking the filesystem library is also done correctly upstream now: https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/main/src/cmake/StdFilesystemFlags.cmake


I'm not sure the remaining flags are necessary anymore, but I don't have a macOS/FreeBDS/Linux setup to test it.

If anyone else wants to cross-compile the loader from Windows to Android, you probably have to use ninja with the CMAKE_GENERATOR=Ninja environment variable because MSBuild adds incompatible compiler flags (-fno-exceptions, -std=gnu++17).