版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32768743/article/details/87065791
之前的一篇:IDEA运行kotlin native
使用IDEA创建了一个kn工程
gradle配置文件长这样
plugins {
id 'kotlin-multiplatform' version '1.3.21'
}
repositories {
mavenCentral()
}
kotlin {
targets {
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
// For Linux, preset should be changed to e.g. presets.linuxX64
// For MacOS, preset should be changed to e.g. presets.macosX64
fromPreset(presets.linuxX64, 'linux')
configure([linux]) {
// Comment to generate Kotlin/Native library (KLIB) instead of executable file:
compilations.main.outputKinds('EXECUTABLE')
// Change to specify fully qualified name of your application's entry point:
compilations.main.entryPoint = 'sample.main'
}
}
sourceSets {
// Note: To enable common source sets please comment out 'kotlin.import.noCommonSourceSets' property
// in gradle.properties file and re-import your project in IDE.
linuxMain {
}
linuxTest {
}
}
}
task runProgram {
def buildType = 'release' // Change to 'debug' to run application with debug symbols.
dependsOn "link${buildType.capitalize()}ExecutableLinux"
doLast {
def programFile = kotlin.targets.linux.compilations.main.getBinary('EXECUTABLE', buildType)
exec {
executable programFile
args ''
}
}
}
可使用gradle运行
这一次比我之前试多了一点代码提示,然后编译依旧超级慢,而且无法调试
然后用CLion试了下
这个main文件夹很奇特
gradle配置还是像纯文本一样
运行依赖gradle,跟IDEA没啥区别
编译慢,无法调试
当前gradle版本5.0
当前kotlin版本1.3.21
总的来说,kn没啥大的变化
群里说clion可以调试,我还纳闷
重新试了下,还真可以调试