Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-09-19 02:15:40


Hi Bojan,

> I am new to Boost.Build and I am introducing it as the build system
> at my company. Many times, we need to run a tool after a program has
> been generated. How would you suggest to do this?
>
> I was thinking of a custom generator, which would essentially perform
> the same task as built-in exe and lib generators, and run the additional
> program. I thought it might be used along the following lines:
>
> my-exe some_name : [ glob *.cpp ] : <post-run>tool ;
> my-lib a_lib : [ glob *.cpp ] : <post-run>tool ;
>
> However, I have no idea how to go about writing such a beast. Ideally,
> it would simply inherit from the built-in exe and lib rules and change
> properties or run the tool.
>
> Can you please point me in the right direction?

You can use the following:

exe main : main.cpp ;
notfile main_postprocess : @postprocess : main ;
actions postprocess
{
do_something $(>)
}

(Provided you use the CVS version).

For convenience, I attach my email describing this feature.

- Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 --Boundary-00=_cWmLDaINHv2N34l Content-Type: message/rfc822;
name="forwarded message"
Content-Transfer-Encoding: 7bit
Content-Description: Vladimir Prus <ghost_at_[hidden]>: [jamboost] Proposal: 'notfile' main target
Content-Disposition: inline
Return-path: <sentto-4392937-9510-1113226312-ghost=cs.msu.su_at_[hidden]>
Envelope-to: ghost_at_[hidden]
Delivery-date: Mon, 11 Apr 2005 17:32:11 +0400
Received: from imap.cs.msu.su ([158.250.10.39])
by zigzag.lvk.cs.msu.su with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32)
(Exim 4.50)
id 1DKz1P-0006ZB-Lp
for ghost_at_[hidden]; Mon, 11 Apr 2005 17:32:11 +0400
Received: from n21a.bulk.scd.yahoo.com (n21a.bulk.scd.yahoo.com [66.94.237.50])
by imap.cs.msu.su (8.12.11/8.12.11) with SMTP id j3BDW0hX044509
for <ghost_at_[hidden]>; Mon, 11 Apr 2005 17:32:09 +0400 (MSD)
(envelope-from sentto-4392937-9510-1113226312-ghost=cs.msu.su_at_[hidden])
DomainKey-Signature: 
Received: from [66.218.69.6] by n21.bulk.scd.yahoo.com with NNFMP; 11 Apr 2005 13:31:53 -0000
Received: from [66.218.67.200] by mailer6.bulk.scd.yahoo.com with NNFMP; 11 Apr 2005 13:31:53 -0000
X-Yahoo-Newman-Property: groups-email
X-Sender: ghost_at_[hidden]
X-Apparently-To: jamboost_at_[hidden]
Received: (qmail 482 invoked from network); 11 Apr 2005 13:31:50 -0000
Received: from unknown (66.218.66.218)
by m8.grp.scd.yahoo.com with QMQP; 11 Apr 2005 13:31:50 -0000
Received: from unknown (HELO zigzag.lvk.cs.msu.su) (158.250.17.23)
by mta3.grp.scd.yahoo.com with SMTP; 11 Apr 2005 13:31:49 -0000
Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50)
id 1DKz0v-0006Xe-6F
for jamboost_at_[hidden]; Mon, 11 Apr 2005 17:31:47 +0400
Received: from zigzag.lvk.cs.msu.su ([158.250.17.23])
by zigzag.lvk.cs.msu.su with esmtp (Exim 4.50)
id 1DKz0v-0006XM-3s
for jamboost_at_[hidden]; Mon, 11 Apr 2005 17:31:41 +0400
To: jamboost_at_[hidden]
User-Agent: KMail/1.7.2
Message-Id: <200504111731.35957.ghost_at_[hidden]>
X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on imap.cs.msu.su
X-Spam-Level: 
X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham 
version=3.0.1
X-Originating-IP: 158.250.17.23
X-eGroups-Msg-Info: 2:12:4
From: Vladimir Prus <ghost_at_[hidden]>
X-Yahoo-Profile: vladimir_prus
MIME-Version: 1.0
Mailing-List: list jamboost_at_[hidden]; contact jamboost-owner_at_[hidden]
Delivered-To: mailing list jamboost_at_[hidden]
List-Id: <jamboost.yahoogroups.com>
Precedence: bulk
List-Unsubscribe: <mailto:jamboost-unsubscribe_at_[hidden]>
Date: Mon, 11 Apr 2005 17:31:35 +0400
Subject: [jamboost] Proposal: 'notfile' main target
Reply-To: jamboost_at_[hidden]
Content-Type: text/plain;
charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: ClamAV 0.80/665/Fri Jan 14 23:49:38 2005
clamav-milter version 0.80j
on imap.cs.msu.su
X-Virus-Status: Clean
X-Keywords: 
X-UID: 2342
X-Length: 4656
I think it would be good to add a target that just runs some command, witho=
ut=20
creating any files. When such target is built, the command is just run, and=
=20
no up-to-date checks are made for any files.
There are two use cases.
1. In my projects the system tests are run with some rather long command. I=
'd=20
like to just type "bjam system-tests" and run that command.=20
2. Recently, C=E9dric wanted to run some tool on source .dsp files. And th=
ere's=20
no way to tell what the tool does and what files it produces. The tool just=
=20
must be run.
I propose this interface:
notfile <name> : <action> : <sources>=20
: <requirements> ... all the regular paramenters ;
The <action> parameter can have two forms:
1. "some command" in which case the command is run verbatim
For example
notfile say : "echo hi" ; =
=
=20
2. @name_of_the_rule, in which can the named rule/action will be invoked. F=
or=20
example:
notfile hello_valgrind : @valgrind : hello ;
actions valgrind
{
valgrind $(>)
}
The first will just execute the command. The second will invoke the 'valgri=
nd'=20
tool on the source -- the 'hello' target.
The implementation is ready -- it actually took me less time to code than=20
writing this message ;-) Any comments?
--=20
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
=20
Yahoo! Groups Links
=20
 --Boundary-00=_cWmLDaINHv2N34l-- 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk