Include pre-built libraries in native binary projects


(Tyler Rigward) #1

How can I reference the pre-builts project libraries in a task (as described in the 1.11 release notes in section “Include pre-built libraries in native binary projects”)?


(Steven Walters) #2

I’m trying to implement this as well and found the gradle example at https://github.com/gradle/gradle/blob/master/subprojects/docs/src/samples/native-binaries/prebuilt/build.gradle which worked for me fairly well.


(Tyler Rigward) #3

Thank you very much - worked like a charm.

Summary:

You can do one of the two variants:

executables {

main {} } sources.main.cpp.lib library: ‘boost’, linkage: ‘api’ sources.main.cpp.lib library: ‘util’, linkage: ‘static’ task buildExecutables {

dependsOn binaries.withType(ExecutableBinary) }

OR

executables {

main {

cpp {

sources{

}

lib library: ‘boost’, linkage: ‘api’

}

} }