Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to use QMAKE_EXTRA_COMPILERS to run rcc -binary

How to use QMAKE_EXTRA_COMPILERS to run rcc -binary

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
7 Posts 5 Posters 1.2k 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.
  • rincewindR Offline
    rincewindR Offline
    rincewind
    wrote on last edited by rincewind
    #1

    Hi

    I want to create a project that consists of resources and the build step should simply run the rcc command to build a binary resource file.

    rcc -binary -no-compress resources.qrc -o resources.rcc
    

    I've been trying to accomplish this with QMAKE_EXTRA_COMPILERS, but I would appreciate some pointers.

    TEMPLATE = lib
    CONFIG += console
    CONFIG -= app_bundle
    
    resource_build.input = RESOURCES
    resource_build.commands = rcc -binary -no-compress ${QMAKE_FILE_NAME} -o $$OUT_PWD/test.rcc
    resource_build.config += no_link
    QMAKE_EXTRA_COMPILERS += resource_build
    
    RESOURCES += \
            res.qrc
    

    Thanks.

    sierdzioS rincewindR 2 Replies Last reply
    0
    • rincewindR rincewind

      Hi

      I want to create a project that consists of resources and the build step should simply run the rcc command to build a binary resource file.

      rcc -binary -no-compress resources.qrc -o resources.rcc
      

      I've been trying to accomplish this with QMAKE_EXTRA_COMPILERS, but I would appreciate some pointers.

      TEMPLATE = lib
      CONFIG += console
      CONFIG -= app_bundle
      
      resource_build.input = RESOURCES
      resource_build.commands = rcc -binary -no-compress ${QMAKE_FILE_NAME} -o $$OUT_PWD/test.rcc
      resource_build.config += no_link
      QMAKE_EXTRA_COMPILERS += resource_build
      
      RESOURCES += \
              res.qrc
      

      Thanks.

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @rincewind said in How to use QMAKE_EXTRA_COMPILERS to run rcc -binary:

      RESOURCES += \

      This will run rcc automatically already.

      Are you getting any errors? It's complaining that no C++ files are being compiled or something?

      (Z(:^

      1 Reply Last reply
      1
      • rincewindR rincewind

        Hi

        I want to create a project that consists of resources and the build step should simply run the rcc command to build a binary resource file.

        rcc -binary -no-compress resources.qrc -o resources.rcc
        

        I've been trying to accomplish this with QMAKE_EXTRA_COMPILERS, but I would appreciate some pointers.

        TEMPLATE = lib
        CONFIG += console
        CONFIG -= app_bundle
        
        resource_build.input = RESOURCES
        resource_build.commands = rcc -binary -no-compress ${QMAKE_FILE_NAME} -o $$OUT_PWD/test.rcc
        resource_build.config += no_link
        QMAKE_EXTRA_COMPILERS += resource_build
        
        RESOURCES += \
                res.qrc
        

        Thanks.

        rincewindR Offline
        rincewindR Offline
        rincewind
        wrote on last edited by rincewind
        #3

        For anybody else trying to do this, this at least generates the binary resource file.

        TEMPLATE = lib
        CONFIG += console
        CONFIG -= app_bundle
        
        resource_build.input = OTHER_FILES
        resource_build.output = out.rcc
        resource_build.depends = $$PWD/res.qrc
        resource_build.commands = rcc -binary -no-compress ${QMAKE_FILE_NAME} -o $$OUT_PWD/out.rcc
        resource_build.config += no_link
        QMAKE_EXTRA_COMPILERS += resource_build
        
        OTHER_FILES += \
                res.qrc
        

        I still get errors due to the linker not being happy with the rcc file. I obviously don't want to link against it.

        According the documentation:
        no_link — the files that are created should not be added to OBJECTS — i.e., they are not compiled code which should be linked,

        jsulmJ 1 Reply Last reply
        0
        • rincewindR rincewind

          For anybody else trying to do this, this at least generates the binary resource file.

          TEMPLATE = lib
          CONFIG += console
          CONFIG -= app_bundle
          
          resource_build.input = OTHER_FILES
          resource_build.output = out.rcc
          resource_build.depends = $$PWD/res.qrc
          resource_build.commands = rcc -binary -no-compress ${QMAKE_FILE_NAME} -o $$OUT_PWD/out.rcc
          resource_build.config += no_link
          QMAKE_EXTRA_COMPILERS += resource_build
          
          OTHER_FILES += \
                  res.qrc
          

          I still get errors due to the linker not being happy with the rcc file. I obviously don't want to link against it.

          According the documentation:
          no_link — the files that are created should not be added to OBJECTS — i.e., they are not compiled code which should be linked,

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @rincewind As @sierdzio said: why don't you use

          RESOURCES += \
          

          ?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          rincewindR 1 Reply Last reply
          0
          • jsulmJ jsulm

            @rincewind As @sierdzio said: why don't you use

            RESOURCES += \
            

            ?

            rincewindR Offline
            rincewindR Offline
            rincewind
            wrote on last edited by rincewind
            #5

            @jsulm
            Because it would run the normal rcc command to generate cpp files, which is not what I want as I explained in my message and specified in the title...

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

              Hi,

              Do you have the same issue if you follow the example provided here and just add the no_link option ?

              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
              0
              • S Offline
                S Offline
                stewythe2nd
                wrote on last edited by
                #7

                Chiming in 5 years later. CONFIG needs to be capitalized, and I found that I also had to add target_predeps to get mine to work.

                resource_build.CONFIG += no_link target_predeps
                
                1 Reply Last reply
                1

                • Login

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