Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Building external resource files automatically
QtWS25 Last Chance

Building external resource files automatically

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 701 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Larvae
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • L Offline
        L Offline
        Larvae
        wrote on last edited by
        #3

        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.

        K 1 Reply Last reply
        0
        • L Larvae

          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.

          K Offline
          K Offline
          kenchan
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          0
          • dheerendraD Offline
            dheerendraD Offline
            dheerendra
            Qt Champions 2022
            wrote on last edited by
            #5

            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
            @Community Service
            Certified Qt Specialist
            http://www.pthinks.com

            1 Reply Last reply
            1
            • L Offline
              L Offline
              Larvae
              wrote on last edited by
              #6

              @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.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved