From fc65b94993f96a482d4cdbee64605d134d4f58fb Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Thu, 16 Jan 2003 12:50:08 +0000 Subject: [PATCH] Preliminary QT support. * new/qt.jam: New file * new/target.jam: (basic-target.generate): Call 'feature.run-action'. [SVN r16915] --- qt.jam | 55 +++++++++++++++++++++++++++++++++++++++++++ src/build/feature.jam | 2 +- src/build/targets.jam | 6 +++++ src/tools/builtin.jam | 2 ++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 qt.jam diff --git a/qt.jam b/qt.jam new file mode 100644 index 000000000..ec19ebb19 --- /dev/null +++ b/qt.jam @@ -0,0 +1,55 @@ +# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and +# distribute this software is granted provided this copyright notice appears in +# all copies. This software is provided "as is" without express or implied +# warranty, and with no claim as to its suitability for any purpose. + +import modules ; +import feature ; +import errors ; +import type ; + +# Initialized the QT support module. The 'prefix' parameter +# tells where QT is installed. When not given, environmental +# variable QTDIR should be set. +rule init ( prefix ? ) +{ + if ! $(prefix) + { + prefix = [ modules.peek : QTDIR ] ; + if ! $(prefix) + { + errors.error + "QT installation prefix not given and QTDIR variable is empty" ; + } + } + + .prefix = $(prefix) ; + + # Work around Boost.Jam bug, + # http://zigzag.cs.msu.su:7814/scarab/issues/id/BB1 + modules.poke : QTDIR : $(prefix) ; + + feature.extend uses : qt ; + feature.action qt : qt.add-properties ; + + # The target type for sources that should be processed with the + # moc tool. + type.register QPP : qpp ; + + generators.register-standard qt.moc : QPP : CPP(moc_%) ; +} + +rule qt.add-properties ( property ) +{ + return $(.prefix)/include -lqt ; +} + +# -f forces moc to include the processed source file. +# Without it, it would think that .qpp is not a header and would not +# include it from the generated file. +actions moc +{ + $(QTDIR)/bin/moc -f $(>) -o $(<) +} + + diff --git a/src/build/feature.jam b/src/build/feature.jam index d30d211a7..ea1e3eaa5 100644 --- a/src/build/feature.jam +++ b/src/build/feature.jam @@ -714,7 +714,7 @@ rule split ( property-set ) } # Appends a rule to the list of rules assigned to the given feature or property. -# That rules will be in extending property sets by the 'run-actions' rule. +# That rules will be used in extending property sets by the 'run-actions' rule. # The rule should accept single argument -- a property, and return a set of additional # properties to be added. Property should be specified in the usual way: # value, and feature should be specified as . diff --git a/src/build/targets.jam b/src/build/targets.jam index 8b3d27e56..004fa19e2 100644 --- a/src/build/targets.jam +++ b/src/build/targets.jam @@ -528,6 +528,12 @@ rule basic-target ( name : project source-targets += [ virtual-target.from-file $(s) : $(self.project) ] ; } } + + # TODO: this line might cause target's properties to be + # unqual to project's reference properties. As the + # result, we create per-target bin directory while + # it's not really needed. + xproperties = [ feature.run-actions $(xproperties) ] ; self.generated.$(property-path) = [ construct $(source-targets) : $(xproperties) ] ; diff --git a/src/tools/builtin.jam b/src/tools/builtin.jam index 9a2a4fc7d..e779c1eaa 100644 --- a/src/tools/builtin.jam +++ b/src/tools/builtin.jam @@ -50,6 +50,8 @@ feature find-static-library : : free ; feature library-path : : free path ; feature library-file : : free path ; +feature uses : : free ; + feature name : : free ; feature search : : free path ;