export library framework experiment

This commit is contained in:
Ugljesa Jovanovic 2020-10-20 00:22:22 +02:00
parent 62397b5425
commit e7093ab15f
No known key found for this signature in database
GPG Key ID: 178E6DFCECCB0E0F
2 changed files with 112 additions and 107 deletions

View File

@ -145,107 +145,103 @@ kotlin {
println("Configuring Linux Arm 32 targets") println("Configuring Linux Arm 32 targets")
} }
println("Configuring macos targets")
runningOnMacos { iosX64() {
println("Configuring macos targets") binaries {
iosX64() { framework {
binaries { optimized = true
framework {
optimized = true
}
}
}
iosArm64() {
binaries {
framework {
optimized = true
}
}
}
iosArm32() {
binaries {
framework {
optimized = true
}
}
}
macosX64() {
binaries {
framework {
optimized = true
}
}
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-macos-x86-64/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a"
)
}
}
tvosX64() {
binaries {
framework {
optimized = true
}
}
}
tvosArm64() {
binaries {
framework {
optimized = true
}
}
}
watchosArm64() {
binaries {
framework {
optimized = true
}
}
}
watchosArm32() {
binaries {
framework {
optimized = true
}
}
}
watchosX86() {
binaries {
framework {
optimized = true
}
} }
} }
} }
runningOnWindows { iosArm64() {
println("Configuring Mingw targets") binaries {
mingwX64() { framework {
binaries { optimized = true
staticLib {
optimized = true
}
}
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-mingw-x86-64/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a"
)
} }
} }
} }
iosArm32() {
binaries {
framework {
optimized = true
}
}
}
macosX64() {
binaries {
framework {
optimized = true
}
}
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-macos-x86-64/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-macos-x86-64/lib/libsodium.a"
)
}
}
tvosX64() {
binaries {
framework {
optimized = true
}
}
}
tvosArm64() {
binaries {
framework {
optimized = true
}
}
}
watchosArm64() {
binaries {
framework {
optimized = true
}
}
}
watchosArm32() {
binaries {
framework {
optimized = true
}
}
}
watchosX86() {
binaries {
framework {
optimized = true
}
}
}
println("Configuring Mingw targets")
mingwX64() {
binaries {
staticLib {
optimized = true
}
}
compilations.getByName("main") {
val libsodiumCinterop by cinterops.creating {
defFile(project.file("src/nativeInterop/cinterop/libsodium.def"))
compilerOpts.add("-I${project.rootDir}/sodiumWrapper/static-mingw-x86-64/include")
}
kotlinOptions.freeCompilerArgs = listOf(
"-include-binary", "${project.rootDir}/sodiumWrapper/static-mingw-x86-64/lib/libsodium.a"
)
}
}
println(targets.names) println(targets.names)
sourceSets { sourceSets {

View File

@ -99,9 +99,18 @@ kotlin {
} }
runningOnMacos { runningOnMacos {
val iosX64Target = iosX64() val iosX64Target = iosX64() {
val iosArm64Target = iosArm64() baseName = "LibsodiumBindings"
val iosArm32Target = iosArm32() export(Deps.Common.libsodiumBindings)
}
val iosArm64Target = iosArm64() {
baseName = "LibsodiumBindings"
export(Deps.Common.libsodiumBindings)
}
val iosArm32Target = iosArm32() {
baseName = "LibsodiumBindings"
export(Deps.Common.libsodiumBindings)
}
val macosX64Target = macosX64() val macosX64Target = macosX64()
val tvosX64Target = tvosX64() val tvosX64Target = tvosX64()
val tvosArm64Target = tvosArm64() val tvosArm64Target = tvosArm64()
@ -113,16 +122,16 @@ kotlin {
binaries.executable {} binaries.executable {}
} }
configure(listOf( // configure(listOf(
iosX64Target, iosArm64Target, iosArm32Target, // iosX64Target, iosArm64Target, iosArm32Target,
tvosX64Target, tvosArm64Target, watchosArm64Target, // tvosX64Target, tvosArm64Target, watchosArm64Target,
watchosArm32Target, watchosX86Target) // watchosArm32Target, watchosX86Target)
) { // ) {
binaries.framework { // binaries.framework {
baseName = "LibsodiumBindings" // baseName = "LibsodiumBindings"
export(Deps.Common.libsodiumBindings) // export(Deps.Common.libsodiumBindings)
} // }
} // }
val mode = System.getenv("CONFIGURATION") ?: "DEBUG" val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
println("Mode $mode") println("Mode $mode")
// Create a task to build a fat framework. // Create a task to build a fat framework.