diff options
author | hjk <hjk121@nokiamail.com> | 2014-05-26 14:21:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-06 15:41:00 +0200 |
commit | 5395180fcb9a68b1590ce4bf29ef26745161403f (patch) | |
tree | 194d35c381fe810883542914d2d9c3538a94a7fd /tests/auto | |
parent | 7cbd9cffd3b6f367fc71adb26428a59502d09885 (diff) |
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 <oswald.buddenhagen@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/tools/rcc/data/images/images.expected | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/tests/auto/tools/rcc/data/images/images.expected b/tests/auto/tools/rcc/data/images/images.expected index 9334443ccc..2577b6319b 100644 --- a/tests/auto/tools/rcc/data/images/images.expected +++ b/tests/auto/tools/rcc/data/images/images.expected @@ -1,13 +1,11 @@ /**************************************************************************** ** Resource object code ** -IGNORE: ** Created by: The Resource Compiler for Qt version 5.0.0 +IGNORE: ** Created by: The Resource Compiler for Qt version 5.3.1 ** ** WARNING! All changes made in this file will be lost! *****************************************************************************/ -#include <QtCore/qglobal.h> - static const unsigned char qt_resource_data[] = { IGNORE: // /dev/qt5/qtbase/tests/auto/tools/rcc/data/images/images/circle.png 0x0,0x0,0x0,0xa5, @@ -94,16 +92,29 @@ static const unsigned char qt_resource_struct[] = { }; -QT_BEGIN_NAMESPACE +#ifdef QT_NAMESPACE +# define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_MANGLE_NAMESPACE0(x) x +# define QT_MANGLE_NAMESPACE1(a, b) a##_##b +# define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b) +# define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \ + QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE)) +#else +# define QT_PREPEND_NAMESPACE(name) name +# define QT_MANGLE_NAMESPACE(name) name +#endif -extern Q_CORE_EXPORT bool qRegisterResourceData - (int, const unsigned char *, const unsigned char *, const unsigned char *); +#ifdef QT_NAMESPACE +namespace QT_NAMESPACE { +#endif -extern Q_CORE_EXPORT bool qUnregisterResourceData - (int, const unsigned char *, const unsigned char *, const unsigned char *); +bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); -QT_END_NAMESPACE +bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *); +#ifdef QT_NAMESPACE +} +#endif int QT_MANGLE_NAMESPACE(qInitResources)() { @@ -112,8 +123,6 @@ int QT_MANGLE_NAMESPACE(qInitResources)() return 1; } -Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources)) - int QT_MANGLE_NAMESPACE(qCleanupResources)() { QT_PREPEND_NAMESPACE(qUnregisterResourceData) @@ -121,5 +130,9 @@ int QT_MANGLE_NAMESPACE(qCleanupResources)() return 1; } -Q_DESTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qCleanupResources)) - +namespace { + struct initializer { + initializer() { QT_MANGLE_NAMESPACE(qInitResources)(); } + ~initializer() { QT_MANGLE_NAMESPACE(qCleanupResources)(); } + } dummy; +} |