:wave: Good evening (and happy end of the year fes...
# kotlin-native
f
👋 Good evening (and happy end of the year festivities), I'm struggling with "variants" configuration. I'm trying to port Magick.NET (a binding around ImageMagick in C#) to the the JVM (or other targets). It uses under the hood Magick.Native. Both are available in "variants" : Q8/Q16/Q16-HDRI I've focused so far on Q8, and it requires : • compiler options, defined in a cinterop block (for compilation) • linker options, on binaries I've found this after a lot of attempts (the .klib was not generated until i found the correct options). I also made some digging with pkgconfig, found the pkgconfig files, and found the options... I've tried the "variants" definitions found here & here but come finally to the following issue https://youtrack.jetbrains.com/issue/KT-59316. According to the issue, I should configure something like this:
Copy code
val q8 by compilations.creating {
            cinterops {
                val libMagickNative by creating {
                    compilerOpts += "-DMAGICKCORE_HDRI_ENABLE=0"
//                    compilerOpts += "-DMAGICKCORE_QUANTUM_DEPTH=8"
//                    compilerOpts += "-DMAGICKCORE_CHANNEL_MASK_DEPTH=64"

                    compilerOpts += "-I${localInclude.absolutePath}"
                    compilerOpts += "-I${localInclude.absolutePath}/ImageMagick-7"
                }
            }
        }

        val q16 by compilations.creating {
            cinterops {
                val libMagickNative by creating {
                    compilerOpts += "-DMAGICKCORE_HDRI_ENABLE=0"
//                    compilerOpts += "-DMAGICKCORE_QUANTUM_DEPTH=8"
//                    compilerOpts += "-DMAGICKCORE_CHANNEL_MASK_DEPTH=64"

                    compilerOpts += "-I${localInclude.absolutePath}"
                    compilerOpts += "-I${localInclude.absolutePath}/ImageMagick-7"
                }
            }
        }

        val q16hdri by compilations.creating {
            cinterops {
                val libMagickNative by creating {
                    compilerOpts += "-DMAGICKCORE_HDRI_ENABLE=1"
//                    compilerOpts += "-DMAGICKCORE_QUANTUM_DEPTH=8"
//                    compilerOpts += "-DMAGICKCORE_CHANNEL_MASK_DEPTH=64"

                    compilerOpts += "-I${localInclude.absolutePath}"
                    compilerOpts += "-I${localInclude.absolutePath}/ImageMagick-7"
                }
            }
        }

        q8.associateWith(compilations.getByName("main"))
        q16.associateWith(compilations.getByName("main"))
        q16hdri.associateWith(compilations.getByName("main"))
But, problems : • the .klib is not generated anymore • and I didn't find the way to configure the binaries in the same way (because I need to configure to
linkerOpts
to link the binary against the correct .dll version) I'm... lost ; it's a bit too low level for me. • Should I use the "multi gradle modules" approach instead? (I've read this somewhere, but I can't find the link at this moment) • Should I wait Kotlin 2.x ? • Should I wait a mature version of #amper? Thanks for reading me. Regards.