Boost logo

Boost-Build :

From: Phillip Seaver (phil_at_[hidden])
Date: 2006-12-11 12:32:25


I'd like to make a target that would work something like this:

    endian foo : <endian-little>IS_LITTLE_ENDIAN <endian-bin>IS_BIG_ENDIAN ;

It would generate a header file that would be like this:

    #ifndef _BJAM_FOO_CONFIG_H_
    #define _BJAM_FOO_CONFIG_H_
    #ifdef __APPLE__
    # ifdef __BIG_ENDIAN__
    # define IS_BIG_ENDIAN 1
    # elif defined(__LITTLE_ENDIAN__)
    # define IS_LITTLE_ENDIAN 1
    # endif
    #endif
    #endif /* _BJAM_FOO_CONFIG_H_ */

The target would have <dependency>bjam_foo_config.h,
<implicit-dependency>bjam_foo_config.h, and
<forced-include>bjam_foo_config.h in its usage requirements so that a
target that put it in its sources would build it and include it while
compiling source files.

The <forced-include> would translate to the -include option for gcc and
the -FI option for msvc, both of which make the compiler act is if the
header file were included on the first line of each file compiled.

The reason I'd like to do this is that I'm compiling "universal" builds
on Mac OS X. When you pass in "-arch i386 -arch ppc", it calls the
compiler twice, once with __BIG_ENDIAN__ defined and once with
__LITTLE_ENDIAN__ defined. It generates a single "fat"/"universal" .o
file. Since I'm only running the compiler once, I obviously can't pass
in the defines the third-party library wants on the command-line, but I
don't want to modify (and potentially miss a file) the third-party sources.

It also helps with my goal of modifying third-party library
distributions as little as possible. :-)

I've been looking through some of the other .jam files in the tools
directory to see if I can find what I need, but I'm not sure what to
override in a new target, how to get the output filename for use in the
usage requirements, where to determine the usage requirements, etc.

If someone could give me some pointers, I'd really appreciate it.

Thanks,

Phillip


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