From 5395180fcb9a68b1590ce4bf29ef26745161403f Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 26 May 2014 14:21:10 +0200 Subject: Make RCC handle bigger binaries Traditionally, RCC in "C mode" was meant to bundle small resources into a binary, like help texts or an occasional icon. RCC produces a .cpp file containing the actual data in a char array which is then passed to the compiler and linker as a normal source file. Larger resources should be compiled in RCC's binary mode and loaded at run time. Current Qt Quick use tries to deploy large hunks of data in "C mode", causing heavy compiler/system load. This patch works around the issue by splitting the process into three parts: 1. Create a C++ skeleton, as usual, but use a placeholder array with "easily compilable" (mostly NULs) data instead. 2. Compile the skeleton file. 3. Replace the placeholder data with the real binary data. time (qmake5 ; make clean ; make) takes 1.3 s real time for a 100 MB resource here, and there is still room for improving patching performance if really needed. Change-Id: I10a1645fd86a95a7d5663c89e19b05cb3b43ed1b Reviewed-by: Oswald Buddenhagen Reviewed-by: Kai Koehne --- src/tools/rcc/rcc.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/tools/rcc/rcc.h') diff --git a/src/tools/rcc/rcc.h b/src/tools/rcc/rcc.h index 7e16fe038d..1b15c8bb87 100644 --- a/src/tools/rcc/rcc.h +++ b/src/tools/rcc/rcc.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. @@ -64,11 +64,11 @@ public: RCCResourceLibrary(); ~RCCResourceLibrary(); - bool output(QIODevice &out, QIODevice &errorDevice); + bool output(QIODevice &outDevice, QIODevice &tempDevice, QIODevice &errorDevice); bool readFiles(bool ignoreErrors, QIODevice &errorDevice); - enum Format { Binary, C_Code }; + enum Format { Binary, C_Code, Pass1, Pass2 }; void setFormat(Format f) { m_format = f; } Format format() const { return m_format; } @@ -87,6 +87,9 @@ public: void setInitName(const QString &name) { m_initName = name; } QString initName() const { return m_initName; } + void setOutputName(const QString &name) { m_outputName = name; } + QString outputName() const { return m_outputName; } + void setCompressLevel(int c) { m_compressLevel = c; } int compressLevel() const { return m_compressLevel; } @@ -137,6 +140,7 @@ private: QStringList m_fileNames; QString m_resourceRoot; QString m_initName; + QString m_outputName; Format m_format; bool m_verbose; int m_compressLevel; @@ -147,6 +151,7 @@ private: bool m_useNameSpace; QStringList m_failedResources; QIODevice *m_errorDevice; + QIODevice *m_outDevice; QByteArray m_out; }; -- cgit v1.2.3