Lakelezz / audiopus_sys

Rust FFI-binding of Opus.
ISC License
15 stars 22 forks source link

iOS simulator: make sure to link with the correct sysroot sdk #16

Open MarcTreySonos opened 11 months ago

MarcTreySonos commented 11 months ago

when building for the simulator

jasl8r commented 6 months ago

Thanks for posting this PR, not sure if this project is maintained enough to pull it in, but this tipped me off on a more robust less invasive solution: cmake-rs detects the CMAKE_TOOLCHAIN_FILE env var and will pass that file to cmake. This way I create a simple cmake toolchain file with set( CMAKE_OSX_SYSROOT "iphonesimulator" ). Then if you run CMAKE_TOOLCHAIN_FILE=$PWD/toolchain.cmake cargo build --target x86_64-apple-ios it will fixup the sysroot. In addition, to simplify things further, I create a config.toml and use configurable-env to set the var:

[env]
CMAKE_TOOLCHAIN_FILE = { value = "toolchain.cmake", relative = true }

Hope this helps any future discoverers.