Support custom entry points for native binaries
This commit is contained in:
committed by
Ilya Matveev
parent
76074f9543
commit
f5eecdd547
+1
@@ -65,6 +65,7 @@ kotlin {
|
|||||||
|
|
||||||
configure([wasm32, linux64, mingw64, macos64]) {
|
configure([wasm32, linux64, mingw64, macos64]) {
|
||||||
compilations.main.outputKinds += org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind.EXECUTABLE
|
compilations.main.outputKinds += org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind.EXECUTABLE
|
||||||
|
compilations.main.entryPoint = "com.example.app.native.main"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -3,6 +3,8 @@
|
|||||||
* that can be found in the license/LICENSE.txt file.
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package com.example.app.native
|
||||||
|
|
||||||
import com.example.lib.*
|
import com.example.lib.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
+2
@@ -3,6 +3,8 @@
|
|||||||
* that can be found in the license/LICENSE.txt file.
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package com.example.app.native
|
||||||
|
|
||||||
import com.example.lib.*
|
import com.example.lib.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
+2
@@ -3,6 +3,8 @@
|
|||||||
* that can be found in the license/LICENSE.txt file.
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package com.example.app.native
|
||||||
|
|
||||||
import com.example.lib.*
|
import com.example.lib.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
+2
@@ -3,6 +3,8 @@
|
|||||||
* that can be found in the license/LICENSE.txt file.
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package com.example.app.native
|
||||||
|
|
||||||
import com.example.lib.*
|
import com.example.lib.*
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
|||||||
+3
@@ -319,6 +319,9 @@ class KotlinNativeCompilation(
|
|||||||
}.toMutableList()
|
}.toMutableList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var entryPoint: String? = null
|
||||||
|
fun entryPoint(value: String) { entryPoint = value }
|
||||||
|
|
||||||
// Naming
|
// Naming
|
||||||
|
|
||||||
override val compileDependencyConfigurationName: String
|
override val compileDependencyConfigurationName: String
|
||||||
|
|||||||
+4
@@ -77,6 +77,9 @@ open class KotlinNativeCompile : AbstractCompile() {
|
|||||||
val target: String
|
val target: String
|
||||||
@Input get() = compilation.target.konanTarget.name
|
@Input get() = compilation.target.konanTarget.name
|
||||||
|
|
||||||
|
val entryPoint: String?
|
||||||
|
@Optional @Input get() = compilation.entryPoint
|
||||||
|
|
||||||
val additionalCompilerOptions: Collection<String>
|
val additionalCompilerOptions: Collection<String>
|
||||||
@Input get() = compilation.extraOpts
|
@Input get() = compilation.extraOpts
|
||||||
|
|
||||||
@@ -174,6 +177,7 @@ open class KotlinNativeCompile : AbstractCompile() {
|
|||||||
|
|
||||||
addArg("-target", target)
|
addArg("-target", target)
|
||||||
addArg("-p", outputKind.name.toLowerCase())
|
addArg("-p", outputKind.name.toLowerCase())
|
||||||
|
addArgIfNotNull("-entry", entryPoint)
|
||||||
|
|
||||||
add("-Xmulti-platform")
|
add("-Xmulti-platform")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user