$include_dir="/home/hyper-archives/boost-build/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-build] bjam script to define a variable based on compiler platform
From: John Bito (jwbito_at_[hidden])
Date: 2009-04-27 17:30:42
Here's how I'm doing something similar.
----
import feature ;
rule default-architecture
{
# this was an empty string on the solaris build - patch submitted in
Trac ticket
local osplat = [ modules.peek : OSPLAT ] ;
# the result is X86 on Windows, so use the option to make lowercase
if $(osplat)
{ return $(osplat:L) ; }
}
feature.set-default architecture : [ default-architecture ] ; # This
isn't necessary - I'd hoped it would suppress the architecture
component of the build location
DEFAULT_ARCH = [ default-architecture ] ;
project name_of_deliverable :
requirements
<include>include
<os>SOLARIS:<define>SOLARIS2
<architecture>$(DEFAULT_ARCH)
<architecture>sparc:<define>ENDIANNESS
;
----
In your case, it's the address-model feature that your code wants to
know about, so the requirements could include
<address-model>64:<define>Sizeof_int=8
<address-model>32:<define>Sizeof_int=4
If I were writing the code, I wouldn't let this affect the build
system in that way. Instead, my C code would say
#define Sizeof_int (sizeof int)
On Mon, Apr 27, 2009 at 8:47 AM, Sherwood Hu <sherwood_at_[hidden]> wrote:
> Hi all,
>
>
>
> Is it possible to write a bjam script to define a macro based on the
> combination of compiler and platform. Basically I want to have a variable
> be assigned like this:
>
>
>
> If ( 64_bit compiler config) {
>
> Sizeof_int = 8 ;
>
> } else {
>
> Sizeof_int = 4 ;
>
> }
>
>
>
>
>
> Is it possible ?
>
> _______________________________________________
> Unsubscribe & other changes:
> http://listarchives.boost.org/mailman/listinfo.cgi/boost-build
>
>