[New Feature Request] Select target and toolchain in a native build

Hi guys,

This feature is common in other build systems (selecting the target platform and the toolchain via command line).

Right now, Gradle selects the current platform and toolchains, and the user cannot force either of them. This causes the following limitations related to cross compiling and project generation:

  1. Cross compiling is limited to the fixed OS/Toolchains imposed by Gradle. For example, I’m trying to build a project using emscripten (basically, is a custom gcc toolchain). With the current Gradle model, I can only build with a GCC like toolchain in Linux. I’m forced to use Linux.

  2. Generating Visual Studio projects only works on Windows. If support for other IDEs is added, those projects would be limited to their “native” platforms. There are lots of scenarios in which you could want to generate a project for a IDE in foreign OS/platform.

Also, after playing a bit with the native build (I managed to build a large C/C++ project) I found the concepts of platform a bit ambiguous conceptually and in use. Sometimes it an OS and other times an architecture or both. Am I missing something?

Awesome work BTW, and I really would love to use Gradle as a CMake alternative.




For example, iOS uses clang. I can create a clang toolchain that has the proper path, flags such as sysroot, and includes for the target platform set. But you can’t compile for iOS on iOS… it seems there’s a gap in support for cross compiling for a foreign target platform.

1 Like

This is quite essential feature for native builds: I have both g++ and clang available on my system and I need to be able to force Gradle to use the one I need it to use for that particular build by use of command line argument.

really important if Gradle want to play with the “native” ones.