Boost logo

Boost-Build :

Subject: Re: [Boost-build] generate a tool to generated a version.c file from definition file
From: Meindert Oldenburger (meindert66_at_[hidden])
Date: 2011-08-23 03:33:28


Thanks Matthew, the following i did:

import common ;

COPY = [ common.copy-command ] ;

exe genversion : genversion.c : <define>VERSIONDIR=. ;

# at the moment the genversion tool is a bit restricted
# The version.def file must be in the same place as where genversion is
executed
# It generates a header file in ../include
actions make_version_c
{
        $(COPY) $(>[2]) $(BUILDPATH)/version.def
        cd $(BUILDPATH)
        $(>[1]:P)/genversion
}
make version.c : genversion version.$(CURBU).def : @make_version_c ;

2011/8/22 Matthew Chambers <matt.chambers42_at_[hidden]>

> On 8/18/2011 3:27 AM, Meindert Oldenburger wrote:
>
>> Hello ,
>>
>> The following challenge i have:
>> - I need to compile a tool called genversion from genversion.c
>> - I have to rename a file version.busp.def to version.def
>> - Now i have to execute "genversion" with version.def. version.def needs
>> to be in the same directory
>> as genversion.
>> - The generated version.c file is used by other projects.
>>
>> The following start i made, but the file rule "file" does not exist in
>> bjam. Does someone have an idea?
>>
>>
>> exe genversion
>> :
>> genversion.c
>> ;
>>
>> install $(BUILDTOOLS)
>> :
>> genversion
>> ;
>>
>> switch $(CURBU)
>> {
>> case busp : file version.busp.def : version.def ;
>> case bupi : file version.bupi.def : version.def ;
>> }
>>
>>
> What are the location requirements of version.c? Can its path simply be
> passed to another jam target? Things stay cleaner if you create generated
> files in the build directories instead of your source tree.
>
> I recently did some similar stuff with HDF5:
>
> alias H5pubconf.h : src/posix/H5pubconf.h : <include>src/posix : :
> <include>src/posix ;
> alias H5pubconf.h : src/darwin/H5pubconf.h : <toolset>darwin
> <include>src/darwin : : <include>src/darwin ;
> alias H5pubconf.h : src/windows/H5pubconf.h : <toolset>msvc
> <include>src/windows : : <include>src/windows ;
>
>
> project
> : requirements
> <include>src
> <include>c++/src
> <library>/ext/zlib//z
> <library>/ext/boost//thread
> <use>H5pubconf.h
> <warnings>off
> : usage-requirements
> <include>src
> <include>c++/src
> <library>/ext/zlib//z
> <library>/ext/boost//thread
> <use>H5pubconf.h
> ;
>
>
> exe H5detect : src/H5detect.c ;
> actions make_init { "$(>[1]:P)/H5detect" > "$(<)" }
> make H5Tinit.c : H5detect : @make_init ;
>
> actions copy_libsettings { cp -f "$(>)" "$(<)" }
> make libhdf5.settings : src/posix/libhdf5.settings : @copy_libsettings ;
> make libhdf5.settings : src/darwin/libhdf5.settings : @copy_libsettings :
> <toolset>darwin ;
>
> exe H5make_libsettings : src/H5make_libsettings.c ;
> actions make_libsettings
> {
> cd $(>[1]:P)
> "$(>[1]:P)/H5make_libsettings" > "$(<)"
> }
> make H5lib_settings.c : H5make_libsettings libhdf5.settings :
> @make_libsettings ;
> make H5lib_settings.c : H5make_libsettings : @make_libsettings :
> <toolset>msvc ;
> ______________________________**_________________
> Unsubscribe & other changes: http://lists.boost.org/**
> mailman/listinfo.cgi/boost-**build<http://lists.boost.org/mailman/listinfo.cgi/boost-build>
>



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