hello, should task `generateCmake` generate CMakeL...
# kotlin-native
d
hello, should task
generateCmake
generate CMakeList with all interop setup and used libraries? Because for me it does not
i
What do you mean by "all interop setup and used libraries"? Could you please share your
build.gradle
and the CMake file generated from it?
d
my
build.gradle
Copy code
apply plugin: 'konan'

buildscript {
	repositories {
		maven {
        	url "<https://dl.bintray.com/jetbrains/kotlin-native-dependencies>"
        }
	}
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-native-gradle-plugin:+"
    }
}

konan.targets = ['iphone_sim']

konanArtifacts {

    def productsDir = new File("../ios/Frameworks")
    println(productsDir)

    interop("libs") {
        defFile "src/main/c_interop/libs.def"

        compilerOpts "-F${productsDir}"
        linkerOpts "-F${productsDir}"

        includeDirs new File(".").getAbsolutePath()
    }


    framework('ComapLike', targets: ['iphone_sim']) {
        srcDir 'src/main/kotlin'

        enableMultiplatform true
        enableDebug false

        linkerOpts "-F${productsDir}"


        libraries {
            artifact "libs"
        }

    }


}

dependencies {
    expectedBy project(':common')
}
and generated CMakeList
Copy code
cmake_minimum_required(VERSION 3.8)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/KotlinCMakeModule)

project(common-ios Kotlin)
If I import this to CLion, I cant see the classes from my libs.def definition (which contains some ios frameworks)
o
Generally, we suggest to use Gradle as the build system, and
generateCmake
is a workaround for lacking Gradle support in CLion. It is being fixed, and so for now we'd suggest to not use this workaround and just call Gradle from XCode.
d
I dont want to use cmake for build but just use clion as IDE, proper autocomplete etc. Its not possible?
o
Guess you could do that without fully functional CMake export, don't you?
d
I dont know how to use the built binary of my iOS framework inside clion. My guess is that I should use that
.klib
file and import it there
v
Hi David, apologies for the delay with reply. Unfortunately, at the moment it's not possible to use CLion with Kotlin/Native, unless you fully describe all dependencies in CMake. We're working on improving that, but right now that's the only way. All available CMake functions are declared in the CMakeKotlinInformation.cmake. It's not documented, but there are project templates that you can use as a reference. For instance, CurlHTTP is a good example of how you can use an external dependency. To add an existing native binary as a dependency you need to declare it with a
konanc_library
command, and then link it to the executable. If you have a .klib, then you can add it to your CMake project using a
klib
command. I hope that helps. Please let me know, if you have any other questions.