Support free compiler args for binaries
This commit is contained in:
+6
@@ -44,16 +44,22 @@ sealed class NativeBinary(
|
||||
var debuggable: Boolean = buildType.debuggable
|
||||
var optimized: Boolean = buildType.optimized
|
||||
|
||||
/** Additional options passed to the linker by the Kotlin/Native compiler. */
|
||||
var linkerOpts: MutableList<String> = mutableListOf()
|
||||
|
||||
/** Additional options passed to the linker by the Kotlin/Native compiler. */
|
||||
fun linkerOpts(vararg options: String) {
|
||||
linkerOpts.addAll(options.toList())
|
||||
}
|
||||
|
||||
/** Additional options passed to the linker by the Kotlin/Native compiler. */
|
||||
fun linkerOpts(options: Iterable<String>) {
|
||||
linkerOpts.addAll(options)
|
||||
}
|
||||
|
||||
/** Additional arguments passed to the Kotlin/Native compiler. */
|
||||
var freeCompilerArgs: MutableList<String> = mutableListOf()
|
||||
|
||||
// Link task access.
|
||||
val linkTaskName: String
|
||||
get() = lowerCamelCaseName("link", name, target.targetName)
|
||||
|
||||
+5
@@ -374,6 +374,10 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile() {
|
||||
val embedBitcode: Framework.BitcodeEmbeddingMode
|
||||
get() = (binary as? Framework)?.embedBitcode ?: Framework.BitcodeEmbeddingMode.DISABLE
|
||||
|
||||
@get:Input
|
||||
val freeCompilerArgs: List<String>
|
||||
get() = binary.freeCompilerArgs
|
||||
|
||||
override fun buildArgs(defaultsOnly: Boolean): List<String> {
|
||||
val superArgs = super.buildArgs(defaultsOnly)
|
||||
return mutableListOf<String>().apply {
|
||||
@@ -388,6 +392,7 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile() {
|
||||
exportLibraries.files.filterExternalKlibs(project).forEach {
|
||||
add("-Xexport-library=${it.absolutePath}")
|
||||
}
|
||||
addAll(freeCompilerArgs)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user