Hi ,
I have a build script which works in 1.12::
apply plugin: 'cpp'
sources {
platformLinuxSrc {
cpp {
source {
srcDir "../_linux"
include "*.cpp"
}
}
}
platformWinSrc {
cpp {
source {
srcDir "../_win32"
include "*.cpp"
}
}
}
}
["Server","Desktop"].each {
String s = it
libraries.create("platform" + s, {
baseName "platform"
cpp {
lib library: 'platformAPI', linkage: 'api'
}
binaries.withType(StaticLibraryBinary){
if (targetPlatform.operatingSystem.windows) {
source sources.platformWinSrc**
} else {
source sources.platformLinuxSrc
}
}
}
}
Unfortunately, with Gradle 2.5, this is not working anymore, giving me an error:
> Could not find method platformLinuxSrc() for arguments [build_5cad0k67czvd96t6bkkttfqrk$_run_closure2_closure15@fde0d5] on root project 'myproject'.
How can I declare a sourceset and use it by a reference (as seen above in “source sources.platformLinuxSrc”)?
According to new “model” syntax, I am able to do something like
components {
["Terminal","Desktop"].each {
"platform${it}"(NativeLibrarySpec) {
baseName = "platform"
binaries.withType(StaticLibraryBinary) {
if (targetPlatform.operatingSystem.windows) {
sources {
platformWinSrc(CppSourceSet) {
source {}
exportedHeaders {}
// lib: ...
}
}
} else {
// sources myPreconfiguredLinuxSrc
}
}
}
}
}
but I am not able to externalize the sourceset
Please, help me …