Meson: Qresources not recompiled if changes in resources files

Created on 11 Mar 2019  路  9Comments  路  Source: mesonbuild/meson

I have the following in my meson.build file

qt5_mod = import('qt5')
qt5_dep = dependency('qt5', modules : ['Core', 'Network'])
resources_files = files('resources.qrc')
resources_dep_files = files(
    'res/js/export.js',
    'res/js/import.js',
)
resources_dep = declare_dependency(sources : resources_dep_files)
resources = qt5_mod.preprocess(qresources : resources_files, dependencies : [resources_dep])                                                                                               

The files in resources_dep_files are the ones in my resources.qrc file:

<RCC>
<qresource prefix="/js">                                                                                                                                                            
    <file>res/js/export.js</file>
    <file>res/js/import.js</file>
  </qresource>
 </RCC>

If I change something in res/js/export.js I want ninja to recompile the resources, but this is not working as above, (when I put the resources_dep_files as a dependecy to qt5_mod.preprocess.)

Most helpful comment

It seems like QTBUG-45460 is fixed in 5.14 (since the first alpha). Is there anything meson needs to do to support dependencies for resources now?

All 9 comments

This is a known bug (missing feature) in Qt's resource compiler: https://bugreports.qt.io/browse/QTBUG-45460

Meson also prints a warning message about this when you define Qt resources.

Is it possible to define the dependencies manually?

It seems the Windows module's compile_resources allows just that via its depend_files argument, presumably because windres doesn't have any form of dependency handling either? (https://mesonbuild.com/Windows-module.html)

I'm repeating here what I said on IRC since it might have gotten lost there:

Qt's rcc introduced --list in 5.6.0. Isn't this is a sufficient fix for https://bugreports.qt.io/browse/QTBUG-45460 allowing this to be addressed in meson? If so, I'd like to look into it.

Not really. It still fails if you edit the qrc file to add or remove resources. But on the other hand if I read it correctly, this MR should fix it.

Oh that would be perfect. @ePirat any chance you'll finish this MR?

It seems like QTBUG-45460 is fixed in 5.14 (since the first alpha). Is there anything meson needs to do to support dependencies for resources now?

@fiesh This is merged now and will be included in Qt 5.14.

Now the remaining task would be to actually use this in Meson.

We already added the dependencies for you during configure: bfa68aaeaff35ad59110ca34cd4afc6cc8238f29

In #7451 the Qt --depfile option got integrated into meson. The configure warning switched from:

rcc dependencies will not work properly until this upstream issue is fixed: https://bugreports.qt.io/browse/QTBUG-45460

to:

rcc dependencies will not work properly until you move to Qt >= 5.14: https://bugreports.qt.io/browse/QTBUG-45460

unless you're on a recent version of Qt, in which case the depfile will be used to get updated deps even without a reconfigure.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ignatenkobrain picture ignatenkobrain  路  4Comments

jhasse picture jhasse  路  5Comments

matthiasclasen picture matthiasclasen  路  4Comments

amitdo picture amitdo  路  6Comments

robertsanseries picture robertsanseries  路  6Comments