I’m just getting my feet wet with the native build support, and have this simple build script:
apply plugin: 'cpp'
model {
platforms {
x86 { architecture 'x86' }
x64 { architecture 'x86_64' }
}
buildTypes {
debug
release
}
binaries {
all {
if ( toolChain in VisualCpp ) {
cppCompiler.args "/EHsc"
if ( buildType == buildTypes.debug ) {
cppCompiler.define "DEBUG"
}
}
}
}
repositories {
libs(PrebuiltLibraries) {
hello {
headers.srcDir = project.projectDir + "../hello/Include"
}
}
}
components {
goodbye(NativeLibrarySpec) {
sources {
cpp.lib library: 'hello', linkage: 'api'
}
}
}
}
It’s a simple library with one source file that has a dependency on another library. My understanding of the technique to use for expressing this dependency is to use the repositories
closure containing an entry for libs(PrebuiltLibraries)
.
Gradle is not happy with this, though, issuing this error:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\hoobajoob\Documents\Eclipse\workspace-sts-luna\cdt.gradle.goodbye\build.gradle' line: 27
* What went wrong:
Exception thrown while executing model rule: model.repositories @ build.gradle line 26, column 5
> Could not find method libs() for arguments [interface org.gradle.nativeplatform.PrebuiltLibraries, build_7bgjdveru7rs4jelxyvxt3289$_run_closure1$_closure8$_closure13@22c75458] on root project 'cdt.gradle.goodbye'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
What have I missed?