František Jeřábek
12/04/2022, 4:18 PMhfhbd
12/04/2022, 4:33 PMFrantišek Jeřábek
12/04/2022, 4:36 PMFrantišek Jeřábek
12/04/2022, 4:44 PMktor-client-core-linuxx64
and ktor-client-core-iossimulatorarm64
and the build system automatically detects which one to use when you add the dependency using io.ktor:ktor-client-core:$ktor_version
. I need the same, but for klib libraries added as file dependency.Anmol Verma
12/04/2022, 5:19 PMcommonMainApi
in the implementation block you can just mention like io.example.depend:some:1.0
. And it will resolve the platform automatically, you won’t need to manually add platform dependency to each sourceSets blockFrantišek Jeřábek
12/04/2022, 5:31 PM.klib
file generated by me using the cinterop
tool. So i need something simillar but for filesAnmol Verma
12/04/2022, 5:58 PMAnmol Verma
12/04/2022, 5:59 PMFrantišek Jeřábek
12/04/2022, 6:11 PMFrantišek Jeřábek
12/04/2022, 7:43 PM.so
libraries from all architectures to the project and then create .def
file with configurations pointing to those shared libraries ... it is not ideal. I would much prefer to have few klib files than a lot of shared libraries from other architectures, but it worksAnmol Verma
12/05/2022, 3:06 AMFrantišek Jeřábek
12/05/2022, 11:57 AMbuild.gradle.kts
which adds library to each target.
listOf(linuxArm64(),linuxX64()).forEach {
it.compilations["main"].cinterops {
val glib by creating
}
}
Than in the .def
file i have different linker options pointing to the shared libraries i copied from other architecture systems. The def file looks like this
headers = gio/gio.h glib.h gio/gunixfdlist.h
compilerOpts= -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-2.0
linkerOpts = -lglib-2.0 -lgio-2.0
linkerOpts.linux_arm32_hfp = -L src/nativeInterop/armhf_libs/glib
linkerOpts.linux_x64 = -L /usr/lib/x86_64-linux-gnu
linkerOpts.arm64 = -L src/nativeInterop/arm64_libs
Now it automatically builds the klib
files for each architecture. Its not exactly what i wanted, because i had already build the klib files myself and now i have multiple shared libraries for each architecture instead of one klib file, but it works