Hi, I’m trying to find a way to specify different headers for a prebuilt library depending on target platform.
According to the sample from samples/native-binaries/prebuilt
I can set sharedLibraryFile
for a binary, but headers
property seems to be read-only and can only be set globally for a library.
Simple example is java JNI API which has different headers for different operating systems.
Ideally I would expect something like this to work:
model {
repositories {
libs(PrebuiltLibraries) {
jni {
headers.srcDir "${javaHome}/include"
binaries.all {
if (targetPlatform.operatingSystem.linux) {
headers.srcDir "${javaHome}/include/linux"
} else if (targetPlatform.operatingSystem.macOsX) {
headers.srcDir "${javaHome}/include/darwin"
} else if (targetPlatform.operatingSystem.windows) {
headers.srcDir "${javaHome}/include/win32"
}
}
}
}
}
}
But currently it always adds headers for all platforms beacuse headers
property is not definned in binary, and gradle uses global headers
property from library.