Rework cinterop linkerOpts/compilerOpts (KT-29970) (#2805)
This commit is contained in:
+3
-3
@@ -98,14 +98,14 @@ open class CInteropTask @Inject constructor(val settings: CInteropSettingsImpl):
|
||||
addFileArgs("-header", headers)
|
||||
|
||||
compilerOpts.forEach {
|
||||
addArg("-copt", it)
|
||||
addArg("-compilerOpt", it)
|
||||
}
|
||||
|
||||
linkerOpts.forEach {
|
||||
addArg("-lopt", it)
|
||||
addArg("-linkerOpt", it)
|
||||
}
|
||||
|
||||
addArgs("-copt", allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||
addArgs("-compilerOpt", allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||
addArgs("-headerFilterAdditionalSearchPrefix", headerFilterDirs.map { it.absolutePath })
|
||||
|
||||
libraries.files.filter {
|
||||
|
||||
+3
-1
@@ -196,7 +196,9 @@ open class KotlinNativeCompile @Inject constructor(internal val binary: Abstract
|
||||
else -> { /* Do nothing. */ }
|
||||
}
|
||||
|
||||
addListArg("-linker-options", linkerOpts)
|
||||
linkerOpts.forEach {
|
||||
addArg("-linker-option", it)
|
||||
}
|
||||
|
||||
addAll(sources.files.map { it.absolutePath })
|
||||
commonSources.files.mapTo(this) { "-Xcommon-sources=${it.absolutePath}" }
|
||||
|
||||
-6
@@ -203,12 +203,6 @@ internal fun MutableList<String>.addFileArgs(parameter: String, values: Collecti
|
||||
}
|
||||
}
|
||||
|
||||
internal fun MutableList<String>.addListArg(parameter: String, values: List<String>) {
|
||||
if (values.isNotEmpty()) {
|
||||
addArg(parameter, values.joinToString(separator = " "))
|
||||
}
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
internal fun dumpProperties(task: Task) {
|
||||
|
||||
+3
-2
@@ -122,8 +122,9 @@ abstract class KonanCompileTask: KonanBuildingTask(), KonanCompileSpec {
|
||||
|
||||
addFileArgs("-native-library", nativeLibraries)
|
||||
addArg("-produce", produce.name.toLowerCase())
|
||||
|
||||
addListArg("-linker-options", linkerOpts)
|
||||
linkerOpts.forEach {
|
||||
addArg("-linker-option", it)
|
||||
}
|
||||
|
||||
addArgIfNotNull("-target", konanTarget.visibleName)
|
||||
addArgIfNotNull("-language-version", languageVersion)
|
||||
|
||||
+2
-2
@@ -93,10 +93,10 @@ open class KonanInteropTask @Inject constructor(val workerExecutor: WorkerExecut
|
||||
linkerOpts.addAll(it.files.map { it.canonicalPath })
|
||||
}
|
||||
linkerOpts.forEach {
|
||||
addArg("-lopt", it)
|
||||
addArg("-linkerOpt", it)
|
||||
}
|
||||
|
||||
addArgs("-copt", includeDirs.allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||
addArgs("-compilerOpt", includeDirs.allHeadersDirs.map { "-I${it.absolutePath}" })
|
||||
addArgs("-headerFilterAdditionalSearchPrefix", includeDirs.headerFilterDirs.map { it.absolutePath })
|
||||
|
||||
addArgs("-repo", libraries.repos.map { it.canonicalPath })
|
||||
|
||||
Reference in New Issue
Block a user