meson build system, dependencies

meson is Yet Another Build System (YABS). One of it’s aims is to be easier to use than the other YABS. Maybe it is maybe it isn’t.

Here is my context: Fedora 34 and I like to pretend I am a programmer. I can make thing happen in Python, but then Python is easy. But I have a project which I want to work quickly and Python is a scripting langauge and I want to pretend I am a programmer so no C# or Python or anything easy.

I have been using Clion (I had a JetBrains subscription for a couple of years but I’m not a developer so I could not justify spending money on a subscription. So I have a fallback version from 2017. I like the debugging support in Clion, like being able to open objects in memory using a mouse when the program is paused.

Now I want to add a GTK UI for my program as I want to be able to interact with a graph to inform a big block of data to work in the program. For some reason (to do with CMAKE, a YABS, probably) it won’t compile a GTK program. My least favourite programming task is chasing around dependencies and interacting with YABS and I never learnt CMAKE enough to make it muscle memory, or something that’s integrated into my mind. It’s currently something I’ll always have to look up (because I’m not a programmer).

GTK (a widget tool-kit kind of thing) is also something I don’t know how to use so I thought I’d mock something up in Gnome-Builder. and then integrate it into the program I’m writing later by which time CMAKE will have magically come into focus. Default Gnome-Builder can indeed use complex templates to build Hello World programs (which it then insists on making into a Flatpak) and have loads of “hey look this is how you should write this code” templates, but I want something very simple.

So making a new Command Line program. Then install GTK4 (probably a mistake because it’s new [October 2021]).

Then in meson.build in the folder add

gtk_dependency = dependency(‘gtk4’)

add this to the Deps square brackets

deps = [
gtk_dependency
]

Wait how did you know to use dependency(‘gtk4’)? use pkgconf –list-all | grep gtk to show you all the packages you can use as dependecies (that have gtk in them).