I had the same problem and the way I figured out how to use this option was to observe how Qt Creator calls rcc.exe
when using CONFIG += resources_big
in the .pro
file. In the Compile Output view you can see the exact parameters used during the build.
Based on this, --temp <file>
is part of a 3-step process so you can't really use it on its own. Let's assume that Visual Studio 2017 is used with Qt 5.12.7 on Windows 10, and the bin folders are in the Path. For simplicity's sake let's say you have a cmd
open in you project folder, you have a build folder named debug
there and a resource definition file resources.qrc
which includes about 50MB of arbitrary data. In this case the 3-step resource compilation would look something like this:
rcc.exe resources.qrc -pass 1 -o debug/qrc_resources.cpp
cl.exe -c debug/qrc_resources.cpp -Fodebug/qrc_resources.tmp.obj
rcc.exe resources.qrc -pass 2 -temp debug/qrc_resources.tmp.obj -o debug/qrc_resources.obj
- Step 1 creates
debug/qrc_resources.cpp
which contains an empty
array definition for 50MB data. This is a much smaller cpp file than
what a more traditional rcc.exe call would generate (it would be ~300MB) since it does not
include any actual data. This way cl.exe won't choke on a big cpp
file.
- Step 2 compiles this cpp file into
debug/qrc_resources.tmp.obj
.
- Step 3 fills up the empty array in
debug/qrc_resources.tmp.obj
with the
actual data that is defined in resources.qrc
and outputs it into
debug/qrc_resources.obj
. This object file can then be used by the linker to
create an executable or library.
If you use Visual Studio then Qt VS Tools version >= 2.5.0 can do this for you. You can set the Qt Resource Compiler as Item Type for the qrc file and set the Two-Pass Mode property to true.
Or you can try to create your own build steps based on the above code.