https://kotlinlang.org logo
#getting-started
Title
# getting-started
é

Éamonn Ó Bróithe

11/17/2023, 11:08 AM
👋 Hi folks, I’m quite tired today from staying up too late playing and experimenting with Kotlin/Native, I haven’t found something that cool in quite some time! I have one thought which has lead to a question: imagine a simple multiplayform proejct, where it’s configurd to only compile to a mac arm binary:
Copy code
plugins {
    kotlin("multiplatform") version "1.9.20-RC2"
}

g
roup = "dev.bogpony"
version = "0.0.1-SNAPSHOT"

repositories {
    mavenCentral()
}

kotlin {

    val nativeTarget = if(System.getProperty("os.name") == "Mac OS X" && System.getProperty("os.arch") == "aarch64") {
        macosArm64("native")
    } else {
        throw GradleException("Host OS is not supported in Kotlin/Native.")
    }

    nativeTarget.apply {
        compilations.getByName("main") {
            val cglm by cinterops.creating {
                packageName("dev.bogpony.clibs.cglm")
            }
        }
    }

    nativeTarget.apply {
        binaries {
            executable {
                entryPoint = "main"
            }
        }
    }
    sourceSets {
        val nativeMain by getting
        val nativeTest by getting
    }
}
when this is built, it includes all the platform libs for mac arm 64. But many of these, I don't care about and will never use. for example, having access to both OpenGL and OpenGL3 (annoying as every function ref in unambigious) Is there a way to filter this list down to ONLY libs that are called and used?
🧵 1