turn a command line string into a #define
Added by Tim Gradwell about 1 year ago
Hi
I'd like to take a string passed in on the command line and turn it into a #define.
The string passed in will always start with SKU and then be followed by platform/sku combination. Examples:
-sSKU_360_WW=1
-sSKU_PS3_US=1
I could manually code individual skus in my jam rules file:
if $(SKU_360_WW) = 1
{
C.Defines $(TARGETS) : SKU_360_WW ;
}
if $(SKU_PS3_US) = 1
{
C.Defines $(TARGETS) : SKU_PS3_US ;
}
but I was hoping to find a more generic solution (which didn't require knowledge of every single sku in advance)
Any help appreciated.
Tim
Replies (1)
RE: turn a command line string into a #define
-
Added by Joshua Jensen about 1 year ago
There is no support for this right now, but you could attempt to add support to collect these variables in src/jam.c and src/variable.c.
In src/jam.c, find:
/* Load up variables set on command line. */
That is where the variables are set that come in on the command-line. Within the function var_defines, the symbol is split into its key/value pair. At that point, you could add the key name to a LIST and then run var_set() after everything is done.
This is a good idea, and I would like to see it implemented. I don't have much time right now to do so and fully test it.
Thanks!
Josh
(1-1/1)