https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

Big Chungus

01/08/2020, 12:26 PM
How can I create a commonNative sourceSet (or better yet, target) with access to native stdlib and depend on it from linux and mingw targets?
b

Big Chungus

01/08/2020, 12:46 PM
How do i setup cinterop for the shared desktop sourceSet?
d

Dominaezzz

01/08/2020, 1:19 PM
You have to do it for each target. The shared source set will magically inherit it.
k

Kris Wong

01/08/2020, 1:50 PM
correct, cinterop is specified at the compilation level
Copy code
targets.withType<KotlinNativeTarget> {
        compilations.getByName("main") {
            defaultSourceSet {
                if (name != "iosMain") {
                    dependsOn(sourceSets["iosMain"])
                }
            }

            cinterops.create("phonenumbers") {
                includeDirs("c_interop/libPhoneNumber_iOS.framework/Headers")
            }
        }
        binaries.framework {
            baseName = "${project.extra["iosFrameworkName"]}"
            linkerOpts.add("-Fc_interop")
        }
    }