Using Meson to build Applications in GNOME

Now my Builder is working fine, I’m excited to develop applications with it. The sample app created using Create a New Project works excellent, but I’m confused with the build system, the files created and their use.

What are those files po, data, aux_build etc.? I put my source code inside src and the main.py cannot find other modules in the same src directory. Can someone please guide or point me to a guide which tells me about these files, packing my source code and other tweaks?

Please note that this is the first time I’m using a build system; so please don’t be offended with my silly questions.

As far as I know, there are no universal rules for meson build structure since projects vary in their needs so much. There are certainly conventions though (things almost everyone does), so the best way is to look at how another project in the same language organizes their build system.

For a Python project, maybe GNOME Tweaks would be a good example. For your specific question, briefly:

  • po/ is the directory where you will store the translation template (eg. org.foo.MyApp.pot) and each translation of it (eg. fr.po).

  • data/ holds things like icons, GResource, GSettings, Glade files and so on in the repository. The meson.build in this directory will usually handle compiling and installing these resources during build time.

  • build-aux/ I think is a newer convention; usually this is where you will find the flatpak manifest and maybe a post-install script for updating the desktop icon cache during install.

2 Likes

I cloned GNOME Music and it was very different from what was generated by Builder for my project, let me try still

I think learning by example is not applicable here, cause such huge projects like Music etc. can’t be understood by simply going through. It will be better if someone could write a tutorial telling step-by-step how to use Meson for GNOME, where to put source files, how to solve path issues in Python, etc. May be the key person behind the Meson extension in Builder can help? :smiley:

I strongly encourage you read the Meson documentation.

There’s nothing particular about using Meson for GNOME projects that needs documentation hosted by GNOME.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.