Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-133285

Fix Qt Resource System (qrc) for big resources

    XMLWordPrintable

Details

    • User Story
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • None
    • Build System: CMake
    • None

    Description

      Problem

      The Qt Resource System struggles with embedding big resources into binary files.

      • If files become to big, the compiler might choke, resulting in build failures. There's a hack in qmake (CONFIG += big_resources), which however is not supported yet in CMake, or qbs. Nor is it supported for iOS.
      • Compiling in large resources will result in unneccessarily long build times.
      • Link time optimizations (-lto for gcc) break the big_resource approach.

      Business Value

      Since Qt 4 times we have been putting the Qt Resource System more and more into the center of deployment - because we lack a good cross-platform deployment story, Qt examples and wizards extensively use the Qt Resource System nowadays for Qt Quick assets. With the last focus on asset conditioning this is becoming even more relevant.

      Background

      The Qt Resource System consists of the rcc binary that processes .qrc files. Most commonly, the binary resources are then placed in the program's executable. Finally, there are enablers in qmake, cmake, qbs to conveniently set this up.

      There are issues with this approach though. The biggest one is that, when embedding into binaries, rcc actually generates structures in .cpp files that are then processed by the C++ compiler. If the data becomes too big, the compiler will not swallow this anymore.

      Rcc currently features a 'hack' in that the .cpp files only contain placeholders; rcc will directly write the data into the generated .o file afterwards. Anyhow, this hack is only featured in qmake so far. Every build system we support has to be extended to support this.

      Proposals

      Let CMake, qbs, ... also adapt the big_resources solution for qmake. This won't solve the lto issue though.

      Use assembler to embed binary resources, avoiding the need for a 'second pass' of rcc. This is supported for gcc and clang, and actually any other compiling gcc assembly, with the .incbin directive. Unfortunately there doesn't seem to exist a similar construct for MSVC.

      Change the build system defaults to not embed resources directly into the executable, but in separate .rcc files. These files have to be located automatically and deployed though.

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kkohne Kai Köhne
              kkohne Kai Köhne
              Petref Saraci Petref Saraci (Inactive)
              Kai Köhne Kai Köhne
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes