Struggling with meson

I’ve been trying to learn how to create a GTK4 application using Vala, so far so good… But I’m facing problems when it comes to include the resource files…

This is the at the data directory:

resource_files = files('hola-mundo-gresource.xml')
resources = gnome.compile_resources(application_id, resource_files,
    	c_name: 'resources'

And this is the located at the src directory:

hola_mundo_sources =[

hola_mundo_args = [
	 '--gresources', resource_files,

dependencies = [
    dependency ('glib-2.0'),
    dependency ('gobject-2.0'),
    dependency ('gtk4'),

executable ('hola-mundo', hola_mundo_sources,
        dependencies: dependencies,
        c_args: [ '-DGETTEXT_PACKAGE=""'],
        vala_args: hola_mundo_args,
        install: true

But when I try to build…

src/ ERROR: Unknown variable "resources".

It doesn’t seem to be able to find any resources variable yet I declared it in the data directory… I don’t know what am I doing wrong…

Any clue…?

1 Like

It seems there must be an order when using those files… I had subdir('src') before subdir('data') I swapped their order and I can build my project now :smiley:

project (
    'c', 'vala',
    version: '0.0.1'

application_id = ''


Yes that’s it: lines in files are processed in the order they appear in, so to have access to your resources generator variable you need to have it come first when using the subdir('foo')s.

1 Like

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