Yan Pujante
08/04/2019, 7:00 PMsrc/nativeMain // contains "generic" code that can be used in other dir
src/macosMain // contains "specific" code for macOS
src/mingwMain // contains "specific" code for Windows
From my understanding, the build.gradle
needs to look like this:
kotlin {
macosX64("macos") {
binaries {
staticLib {
}
}
}
mingwX64("mingw") {
binaries {
staticLib {
}
}
}
}
But I am unclear how I include nativeMain
which should be part of the static library as well as how I declare a dependency ( macosMain
depends on nativeMain
)
Any help appreciated.Dominaezzz
08/04/2019, 7:53 PMDominaezzz
08/04/2019, 7:54 PMnativeMain
.Dominaezzz
08/04/2019, 7:54 PMdependsOn
thing.Dominaezzz
08/04/2019, 7:54 PMlouiscad
08/04/2019, 10:31 PMnativeMain
from every platform main source set.
I'm setting this is into the `buildSrc`: https://github.com/LouisCAD/Splitties/blob/557fc72733b49bc9c013c3a34a35cb0b7bc87d07/buildSrc/src/main/kotlin/config/KotlinSourceSetsConfig.kt#L35
If you're interested, I also made a script to create the directories structure and the corresponding symlinks as needed.Yan Pujante
08/05/2019, 1:17 PMmsink
08/05/2019, 1:24 PMtargets.withType(KotlinNativeTarget::class) {
sourceSets["${targetName}Main"].apply {
kotlin.srcDir("src/nativeMain/kotlin")
}
}
louiscad
08/05/2019, 1:29 PMmsink
08/05/2019, 3:17 PMlouiscad
08/05/2019, 3:19 PMYan Pujante
08/06/2019, 1:55 PMsrcDir
trick should work for me. I will give this a try. Thanks!louiscad
08/06/2019, 4:02 PMYan Pujante
08/07/2019, 1:30 PMsrcDir
to accomplish what I want. To wish you responded that there was a problem and to wish Mike responded it worked because in his case "it is always single target on every platform". It is the same use case for me. On each platform (macOs or Windows in my case), I only create 1 library. So for each platform I only need the common code + the "platform" specific code. I thought that was what Mike described. I have not had the chance to try his proposal but doesn't look like I need to create symlink like you do.