Getting the build type/variant inside a bjam Jamfile / echo a feature?

34 Views Asked by At

So, let's say, I call bjam debug, or bjam release, or bjam clean, possibly with other target names, and I'd like to have the build action or type (debug, release, clean) available in a script.

Here https://android.googlesource.com/platform/external/boost/+/ac861f8c0f33538060790a8e50701464ca9982d3/Jamroot I found an example, that I modified like this:

import modules ;
tbuildcmd = "" ;
if clean in [ modules.peek : ARGV ]
{
  tbuildcmd = clean ;
}
else if release in [ modules.peek : ARGV ]
{
  tbuildcmd = release ;
}
else if debug in [ modules.peek : ARGV ]
{
  tbuildcmd = debug ;
}
echo "tbuildcmd $(tbuildcmd)" ;

And this works fine, it seems - but I was wondering, is there a better method to get the build command/type as a variable? For instance, they say in https://www.boost.org/doc/libs/1_35_0/doc/html/bbv2/tutorial.html :

The release and debug that we've seen in bjam invocations are just a shorthand way to specify values of the variant feature. For example, the command above could also have been written this way:

bjam variant=release inlining=off debug-symbols=on

So, there is apparently a "variant" "feature" - but how can I use / echo it? I tried echo $(<variant>) and that failed.

0

There are 0 best solutions below