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
91 stars 8 forks source link

Add header namespace to Build Init C++ template #1022

Open lacasseio opened 5 years ago

lacasseio commented 5 years ago

Expected Behavior

The native templates should have the same flag for defining the JVM package but for the headers.

Current Behavior

All headers are generated in, what JVM developer would call, default namespace. Projects usually namespace their headers in some ways and Gradle should allow that as well. Not to confused with C++ namespace.

Context

Steps to Reproduce (for bugs)

Your Environment

lacasseio commented 5 years ago

Not to be confused with C++ namespace which is a C++ specific feature. See https://github.com/gradle/gradle-native/issues/1021

adammurdoch commented 5 years ago

It's not entirely clear what you mean by this. Do you mean that each header file should have a name that encodes the library name in some way? e.g if the library is called 'somelib', then the public header should be called something like somelib.h?

lacasseio commented 5 years ago

My bad for not explaining enough. Header namespace is for the folder nesting of the headers. At the moment, we generate headers in src/main/headers/foo.h and include it like #include "foo.h". With the namespace, the header would be generated in src/main/headers/some/namespace/foo.h and include it like #include "some/namespace/foo.h". C++ namespace and header namespace can be the same but not always. For example, the standard library has no header namespace but a C++ namespace of std. The Google Test project has the header namespace of gtest and a C++ namespace of testing.