From 4fa430eae54dfd3086de9fe41ed079b2a0b98876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Hunold?= Date: Mon, 3 Dec 2012 08:28:09 +0000 Subject: [PATCH] Add to qt4.jam. Fixes #7576 Thanks to Frank Richter for the initial patch and documentation. [SVN r81689] --- src/tools/qt4.jam | 23 ++++++++++++++++++++++- test/qt4/jamroot.jam | 3 +++ test/qt4/rcc.cpp | 20 ++++++++++++++++++++ test/qt4/rcc.qrc | 5 +++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 test/qt4/rcc.cpp create mode 100644 test/qt4/rcc.qrc diff --git a/src/tools/qt4.jam b/src/tools/qt4.jam index e5133d5ca..a3aac61b4 100644 --- a/src/tools/qt4.jam +++ b/src/tools/qt4.jam @@ -36,6 +36,21 @@ # This is consistent with Qt guidelines: # http://qt-project.org/doc/qt-4.8/moc.html # +# The .qrc processing utility supports various command line option (see +# http://qt-project.org/doc/qt-4.8/rcc.html for a complete list). The +# module provides default arguments for the "output file" and +# "initialization function name" options. Other options can be set through +# the build property. E.g. if you wish the compression settings +# to be more aggressive than the defaults, you can apply them too all .qrc +# files like this: +# +# project my-qt-project : +# requirements +# "-compress 9 -threshold 10" +# ; +# +# Of course, this property can also be specified on individual targets. + import modules ; import feature ; @@ -72,6 +87,9 @@ feature.feature qt3support : off on : propagated link-incompatible ; # Auto-detection via qmake sets 'major.minor.patch' feature.feature qt : : propagated ; +# Extra flags for rcc +feature.feature rccflags : : free ; + project.initialize $(__name__) ; project qt ; @@ -701,11 +719,14 @@ actions moc.inc } +# Get extra options for RCC +flags qt4.rcc RCC_OPTIONS ; + # Generates source files from resource files. # actions rcc { - $(.BINPREFIX[-1])/rcc $(>) -name $(>:B) -o $(<) + $(.BINPREFIX[-1])/rcc $(>) -name $(>:B) $(RCC_OPTIONS) -o $(<) } diff --git a/test/qt4/jamroot.jam b/test/qt4/jamroot.jam index eeddc586f..9bcefefe0 100644 --- a/test/qt4/jamroot.jam +++ b/test/qt4/jamroot.jam @@ -57,6 +57,9 @@ if [ qt4.initialized ] # Test moc rule [ run mock.cpp mock.h /qt//QtCore : : : TEST_MOCK ] + # Test resource compiler + [ run rcc.cpp rcc.qrc /qt//QtCore : : : "-compress 9 -threshold 10" ] + : # requirements : # default-build : # usage-requirements diff --git a/test/qt4/rcc.cpp b/test/qt4/rcc.cpp new file mode 100644 index 000000000..cae553bb1 --- /dev/null +++ b/test/qt4/rcc.cpp @@ -0,0 +1,20 @@ +// (c) Copyright Juergen Hunold 2012 +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#define BOOST_TEST_MODULE QtCore +#include + +#include + +std::ostream& operator<<(std::ostream& out, QString const& text) +{ + out << text.toUtf8().constData(); + return out; +} + +BOOST_AUTO_TEST_CASE (check_exists) +{ + BOOST_CHECK(QFile::exists(":/test/rcc.cpp")); +} diff --git a/test/qt4/rcc.qrc b/test/qt4/rcc.qrc new file mode 100644 index 000000000..13ca38a5d --- /dev/null +++ b/test/qt4/rcc.qrc @@ -0,0 +1,5 @@ + + + rcc.cpp + +