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

Big Chungus

09/30/2019, 5:56 AM
How do I add DOM and Math klibs available for wasm23 target to MPP project via gradle?
I've found this example with precompiled libs using konan plugin, but I'd like to know how to at least do that with MPP plugin: https://github.com/ftomassetti/kotlin-wasm-examples/blob/master/build.gradle
t

turansky

09/30/2019, 7:48 AM
wasm23 lib must be available only for
JS
part?
b

Big Chungus

09/30/2019, 7:50 AM
How do you mean? Wasm32 is native target that's directed to browser
t

turansky

09/30/2019, 7:53 AM
You can define in related
sourceSet
b

Big Chungus

09/30/2019, 7:53 AM
Copy code
kotlin {
    /* Targets configuration omitted.
    *  To find out how to configure the targets, please follow the link:
    *  <https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets> */
    wasm32("wasm") {
        sourceSets {
            val wasmMain by getting {
                dependencies {
                    implementation(files("$projectDir/lib"))
                }
            }
        }
    }
}
this doesn't work
t

turansky

09/30/2019, 8:00 AM
Do you have target declaration?
b

Big Chungus

09/30/2019, 8:00 AM
wasm32("wasm") is a target declaration
t

turansky

09/30/2019, 8:03 AM
sourceSets
section must be located in
kotlin
section
b

Big Chungus

09/30/2019, 8:03 AM
It really doesn't. Anyways, neither works
t

turansky

09/30/2019, 8:05 AM
Separate submodule for lib?
b

Big Chungus

09/30/2019, 8:10 AM
How do you mean?
t

turansky

09/30/2019, 1:03 PM
I mean separate gradle submodule for lib with target
wasm32
only And include submodule with
implementation(project(":my-wasm-lib"))