Interop: support passing linker as arg to stub generator

This commit is contained in:
Svyatoslav Scherbina
2016-10-13 16:47:32 +03:00
parent d800e193e8
commit d00d3daf86
2 changed files with 10 additions and 1 deletions
@@ -110,7 +110,7 @@ private fun processLib(ktGenRoot: String,
val compilerOpts = config.getSpaceSeparated("compilerOpts") + additionalCompilerOpts
val compiler = config.getProperty("compiler") ?: "clang"
val linkerOpts = config.getSpaceSeparated("linkerOpts").toTypedArray() + additionalLinkerOpts
val linker = config.getProperty("linker") ?: "clang"
val linker = args["-linker"]?.singleOrNull() ?: config.getProperty("linker") ?: "clang"
val excludedFunctions = config.getSpaceSeparated("excludedFunctions").toSet()
val fqParts = args["-pkg"]?.singleOrNull()?.let {
@@ -26,6 +26,7 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named {
private List<String> compilerOpts = []
private FileCollection headers;
private String linker
private List<String> linkerOpts = []
private FileCollection linkFiles;
private List<String> linkTasks = []
@@ -48,6 +49,10 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named {
headers = headers + files
}
void linker(String value) {
linker = value
}
void linkerOpts(String... values) {
linkerOpts.addAll(values)
}
@@ -161,6 +166,10 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named {
args "-pkg:" + pkg
}
if (linker != null) {
args "-linker:" + linker
}
args compilerOpts.collect { "-copt:$it" }
args linkerOpts.collect { "-lopt:$it" }