Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

Building external resource files automatically



  • Hi,

    I want to compile resources into external binary resource files automatically. The recommended way I found is to add a custom build step.

    I added a step with the following command:

    rcc -binary "%{sourceDir}\myresource.qrc" -o "%{buildDir}\debug\myresource.rcc"

    If I call this in a terminal it works just fine, but as a build step it fails with

    The kit Desktop Qt 5.11.2 MSVC2017 64bit has configuration issues which might be the root cause for this problem.
    When executing step "Custom Process Step"

    Can someone tell me what I'm doing wrong?

    Also, if I get it to work, what would I need to change to

    • make multiple resource files from a list of arguments
    • have this build step in all kits/projects without copying it manually every time
    • change the path between debug/release automatically

    Can this be done or should I look into simething else? Maybe using the project file?


  • Lifetime Qt Champion

    Hi,

    I would try switching to forward slashes just in case it's considered an escaping char when interpreted.



  • Hi, thanks for your reply.

    When I tried it in a terminal I actually copyied/pasted the command from the error message, so this doesn't seem likely.

    But just in case I tried it and it didn't change anything.



  • @Larvae
    Did you try putting that command into a .bat file and passing the sourceDir and buildDir as parameters %1 %2 etc. The run the .bat file from the build step.
    That is what i usually do on windows.


  • Qt Champions 2017

    Try adding the following in your pro file. It should solve the problem.

    QMAKE_POST_LINK = "rcc -binary ../ProjectDir/MyConf.qrc -o MyConf.rcc"



  • @dheerendra said in Building external resource files automatically:

    QMAKE_POST_LINK = "rcc -binary ../ProjectDir/MyConf.qrc -o MyConf.rcc"

    I tried this approach and it works. Thanks for your help.

    I did encounter some strange behaviour thou. In my project I have a resource file for images, but I haven't added any images jet, so atm it's still empty. I got jom.exe has stopped with exit code 2 after adding your line (without the ProjectDir). But there were also this annoying empty resource file warnings in between. So I added an empty file just so it won't complain about it any more and the error was gone.


Log in to reply