<https://kotlinlang.slack.com/archives/C3SGXARS6/p...
# kotlin-native
a
https://kotlinlang.slack.com/archives/C3SGXARS6/p1553226323370100 In reference to the quoted post shown at the bottom of this one, I think I've gotten closer, but I may have incorrect syntax. Right now my
build.gradle
looks like this:
Copy code
plugins {
    id "kotlin-multiplatform" version "1.3.21"
}

repositories {
    mavenCentral()
}

kotlin {
    mingwX64("mingw") {
        compilations.main {
            outputKinds("executable")
            entryPoint "classes.main"
        }
    }
    sourceSets {
        mingwMain {
            dependencies {
                implementation fileTree(include: ['*.klib'], dir: 'libs')
            }

        }
        mingwTest {}
    }
}

task runProgram {
    println("getLibsDirName = "+getLibsDirName())
    def buildType = "RELEASE" // Change to 'DEBUG' to run application with debug symbols.
    dependsOn kotlin.targets.mingw.compilations.main.linkTaskName("EXECUTABLE", buildType)
    doLast {
        def programFile = kotlin.targets.mingw.compilations.main.getBinary("EXECUTABLE", buildType)
        exec {
            executable programFile
            args ""
        }
    }
}
and my
settings.gradle
looks like this:
Copy code
pluginManagement {
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "kotlin-multiplatform") {
                useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
            }
        }
    }
}
rootProject.name = 'gearNet'
includeBuild './src/libs'
Any advice on how to get my project to recognize and implement
./src/libs/kwinhelp.klib
within my project? Any advice or even a direction on where to look for an answer is very much appreciated.
d
Is
./src/libs/kwinhelp.klib
created from another local multiplatform project?
a
If it was, I don't have access to it locally.
libs/kwinhelp.klib
was committed to the project by a collaborator.
d
Oh, was going to suggest publishing to local maven repo. Oh well.
What you have looks correct. How is it not working specifically? Not building, gradle sync failed, IDE doesn't give intellisense, .... ?
a
It builds/syncs, no intellisense though on the classes that would import parts of the klib
d
Try
implementation files('src/libs/kwinhelp.klib')
?
Does the klib show up in the
External Libraries
drop down?
a
implementation files('src/libs/kwinhelp.klib')
did the trick for a majority of the imports! I think I need to add a JVM as a dependency too though for the last few. Any advice on how I might add that too?
d
What do you mean add a JVM? You want to add a jvm target in addition to your mingw target?
a
Yes (apologies, I'm quite new to this and am slowly getting the terminology down)
I guess if that's what's needed to import something like
java.nio.ByteBuffer
d
In the
kotlin
block,
Copy code
jvm()

sourceSets {
    jvmMain {
         dependencies {
                .....
         }
    }
}
Yes
a
awesome, thank you for the help!