Proxy-wrap C++ library built using other build system

(Mark K Cowan) #1

I have a project consisting of several C, C++, and Kotlin subprojects.

Everything works except for use of two libraries: they are build using non-gradle build systems (custom makefile for one, cmake for the other).

How can I wrap these as a subproject with a (hopefully lightweight) build.gradle, which declares header directories and library outputs, such that other “cpp-library” / “cpp-application” subprojects can add this one as a dependency, and get the include path and -l linker arguments set automatically, and transitively propagating?

So far, I have a build.gradle which extracts sources for these libraries if needed, builds if needed, and copies the outputs to ${project.buildDir}/... as appropriate.

I just can’t figure out how to declare the header root and the shared objects such that other projects will pick them up via dependencies.

I’ve tried looking through the native-samples and the CppLibrary / CppApplication class sources, but can’t see how to tell Gradle what the outputs are for this subproject.

0 Likes