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

Define public header files instead of directory #1029

Open Burtan opened 4 years ago

Burtan commented 4 years ago

Some existing libraries don't have all their public headers in one directory. Currently it seems to be only possible to declare one directory and filtering header is not possible

Expected Behavior

More flexible in defining the public headers

Current Behavior

Defining mutliple directories for the public headers throws an error. Defining single files is not possible

Context

It is not possible to build a lot of old libraries

lacasseio commented 4 years ago

It's definitely something that should be supported. Thanks for opening the issue.

Burtan commented 4 years ago

I tried to add the headers manually via compilerArgs now. However I didn't succeed (at least on windows) as the path seperators are getting escaped each time. "\" is converted to "\\"

lacasseio commented 4 years ago

You should still be able to declare headers manually via compilerArgs. Do you have a sample you could provide for that?

Burtan commented 4 years ago

What works is adding header directories to includes of CppCompile. I tried to add them via compilerArgs with -I$dir before. However, on linux these lines get "" and on windows the path seperators \ are doubled because of escaping in the gradle file.

However, I realized that my problem seems to be more complicated. I'm trying to convert a project from cmake to gradle. I'm coming from java/kotlin and I'm more used to gradle and don't fully understand what happens with cmake there :D. This might go to far here.