mozilla / rust-android-gradle

Apache License 2.0
1.03k stars 67 forks source link

Automatically configure CLANG_PATH so that build.rs code using clang-sys work correctly #21

Closed thomcc closed 4 years ago

thomcc commented 4 years ago

This lets e.g. bindgen locate the correct instance of clang. Without it, header paths have to be specified manually, and it's a real hassle.

It also adds a property that can be configured either in the environment (RUST_ANDROID_GRADLE_AUTO_CONFIGURE_CLANG_SYS) or in local.properties (rust.autoConfigureClangSys) to enable/disable setting CLANG_PATH. If you leave it blank, we'll set on non-desktop builds.

Still needs a little more testing. I think the clang binaries we're using on windows aren't actually clang, so I'm not sure if this will actually work there.

Fixes the same thing as https://github.com/mozilla/application-services/pull/1980

thomcc commented 4 years ago

Need to test this on windows still, if it turns out to be too much of a hassle I'll just cut a release without but I think it should be doable.