Multi project native build

I am having some trouble getting this multi project build setup correctly.

I created a a few single project builds and they work fine but now I am trying to link them together in what will eventually be a shared library that any other c project can use. Here’s how my project is currently structured.




the modules continue like that for module 2, etc…

Those don’t don’t have any interlinking dependencies so they can be built just fine, one at a time.

The issue that I am having is that my main module depends on all the sub modules but I cannot build it, I get a build it because I get a gradle build failure, could not locate library ____

Basically after all the submodules are build, they should create one shared library which is MainModule, then that’s something that I could distribute but currently for testing purposes I have the additional folder project which creates a native executable that relies on that MainModule but I can’t even get the MainModule to build correctly at the moment.

in the root of this project i have a settings.gradle file with each sub module listed there but that doesn’t seem to work. I can only build each project by going and manually invoking gradle build in each module directory.

I forgot to add that in my main module build.gradle file looks like this

apply plugin: 'c'

model {
        components {
            MainModule(NativeLibrarySpec) {
                source.c {
                    lib library: "module1", linkage "shared"
                    lib library: "module2", linkage "shared"
                    lib library: "module3", linkage "shared"

another edit
I found this example of a multi project native build but this doesn’t quite do what I am trying to accomplish.

  1. I want to build a shared library but but the executable should be able to be compiled separately; for example the main subproject could be my MainModule but it will depend on quite a few other submodules that need to be built separately.

Also I would like to put all of those in their own folder structure with their own build.gradle files or would that cause some type of issue with the build?