c-koi / gmic-qt

G'MIC-Qt is a versatile front-end to the image processing framework G'MIC.
GNU General Public License v3.0
207 stars 54 forks source link

CMakeLists: don't hardcode pkg-config and don't use gimptool anymore. #92

Closed Jehan closed 4 years ago

Jehan commented 4 years ago

Cf. our discussion on Twitter. This is the only change I had to do on the build system to be able to cross-build G'MIC for Windows.

There is another issue with the CMAKE_AUTOMOC tool but for now I could at least make the build work with Wine and binfmt_misc, which worked fine anyway. Eventually though if I can understand what moc does, it would be better to run a native binary at build time.


Hardcoding pkg-config will work only for native builds. If you want to cross-compile, you need to search for the appropriate tools, which is what FindPkgConfig module does. Then you can use PKG_CONFIG_EXECUTABLE variable which will be set according to your toolchain rules.

Also old-style binary config tools are not a good idea as they are not very cross-compilation friendly (to do it right, we would have to generate variants per (host, target) couple). Instead pkg-config is the right process as it works well without having to run non-native binaries. I am actually considering removing gimptool from GIMP eventually (and document the generic pkg-config process instead).

Running gimptool-2.0 --libs-noui and --cflags-noui is the equivalent to run pkg-config --libs (--cflags respectively) on gimp-2.0. So let's just replace by these commands.