Android NDK support and build system refactoring (#585)

This commit is contained in:
Nikolay Igotti
2017-05-24 00:20:19 +03:00
committed by GitHub
parent 48742b7f3f
commit 42197a2bec
26 changed files with 404 additions and 232 deletions
@@ -49,8 +49,10 @@ private fun maybeExecuteHelper(configuration: CompilerConfiguration) {
}
}
class K2Native : CLICompiler<K2NativeCompilerArguments>() {
private fun suffixIfNot(name: String, suffix: String) =
if (name.endsWith(suffix)) name else "$name$suffix"
class K2Native : CLICompiler<K2NativeCompilerArguments>() {
override fun doExecute(arguments : K2NativeCompilerArguments,
configuration : CompilerConfiguration,
@@ -109,11 +111,11 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
val library = arguments.outputFile ?: "library"
if (arguments.nolink)
put(LIBRARY_NAME, library)
put(LIBRARY_FILE, "${library}.klib")
put(LIBRARY_FILE, suffixIfNot(library, ".klib"))
val program = arguments.outputFile ?: "program"
if (!arguments.nolink) {
put(PROGRAM_NAME,program)
put(EXECUTABLE_FILE,"${program}.kexe")
put(PROGRAM_NAME, program)
put(EXECUTABLE_FILE, suffixIfNot(program, ".kexe"))
}
// This is a decision we could change
val module = if (arguments.nolink) library else program