Gradle Native override source path


(Greg Meiste) #1

I’m trying to use the new C++ plugins as described at:

The native-samples repo on Github (https://github.com/gradle/native-samples) has been very useful in getting started. I was able to build and run the projects. Now I would like to start modifying the samples to fit into my project. One issue I hit right away is the directory structure for my library is different than the simple-library example (https://github.com/gradle/native-samples/tree/master/cpp/simple-library), which uses src/main/cpp. How do I change the directory path to match my project? I tried the method described here:
https://docs.gradle.org/current/dsl/org.gradle.language.cpp.CppSourceSet.html

However, that did not work. I wasn’t surprised because that sample uses the “cpp” plugin and not the cpp-library or cpp-application plugins.

Thanks in advance!


(Sterling Greene) #2

We don’t call it out as such, but this sample uses the SwiftPM conventional layout and configures Gradle to expect the same:


(Greg Meiste) #3

This is exactly what I needed! Thanks again for your help.