gradle / gradle-native

The home of Gradle's support for natively compiled languages
https://blog.gradle.org/introducing-the-new-cpp-plugins
Apache License 2.0
92 stars 8 forks source link

Supporting cross compilers via extending AbstractGccCompatibleToolChain #992

Closed ThadHouse closed 1 year ago

ThadHouse commented 5 years ago

Most cross compilers for things like embedded platforms are based on GCC. We have a system where we needed to support multiple cross platforms, and we actually figured out that the best and cleanest way to do this was to actually create classes that extended AbstractGccCompatibleToolChain. Even though this required using internal functionality, it was the most reliable, and has some cool side effects as well. This might want to be looked at as a way to support cross compilers.

I was asked to post this on slack.

You can find our plugin here to enable those toolchains. They also support things like downloading the compiler, and multiple host platforms, based on what th ecross compiler supports.

https://github.com/wpilibsuite/GradleRIO/tree/master/ToolchainPlugin

ThadHouse commented 1 year ago

I've been doing a lot of refactoring of our toolchains, and noticing I can actually do everything I was doing with the stock GCC instance. So I don't actually think this change would be that helpful, and would be very difficult with the way gradle is architected.