nokeedev / gradle-native

The home of anything about Gradle support for natively compiled languages
https://nokee.dev
Apache License 2.0
47 stars 8 forks source link

Support source compatibility across all languages #112

Open lacasseio opened 4 years ago

lacasseio commented 4 years ago

Configuring language standard flag across compiler can be quite error-prone. Clang/GCC uses -std=<standard>. Visual C++ uses /std:<standard> but only since C++14 and VS 2017 (if I'm remembering well). Swiftc uses -swift3, etc. Historically, developers would simply assume compatibilities between sources. With Nokee, we want to model the source compatibility more tightly so the toolchain selection can take advantage of this information as well as consumers can receive good error messages when consuming incompatible sources.

This feature adds a considerable level of complexity and open questions around edge cases. For example, would it be better to error out when consuming C++17 with MS extension in a plain C++03 project or select a toolchain that satisfies both source compatibilities?

As a step forward, let's start with the basic, that is selecting the correct compiler flag, then move to toolchain selection then address the more complex cases. The source compatibility should be made extensible to support newer/custom source compatibility values.

lacasseio commented 4 years ago

Here is an interesting question around source compatibility:

Microsoft and GNU have their own extensions to the C/C++ languages. It generally means that vanilla C/C++ code will compile with the custom extensions but the opposite isn't exactly true. With that in mind, are Objective-C/C++ simply extensions over C/C++. Generally, vanilla C and C++ code will compile in Objective-C/C++ but the opposite isn't true. My knowledge of the Objective-* languages is a bit lacking. I would appreciate any feedback from experienced Objective-C/C++ developers.