6

Is it possible to define a GYP variable whose value depends on the choice of build configuration?

dpemmons
  • 71
  • 1
  • 5

3 Answers3

2

Just use variable $(BUILDTYPE) or $(ConfigurationName).

dr15
  • 31
  • 3
0

Looks like it's impossible according to this wiki page:

  • Perform “early” or “pre” variable expansion and conditional evaluation.
  • ...
  • Merge target settings into configurations as appropriate.
abyss.7
  • 12,136
  • 9
  • 44
  • 94
-1

I think it's possible if you mean distinctions between 'Debug' and 'Release' by the 'build configuration'. Try to add the following in your *.gyp file:

...
'configurations': {
    'Debug': {
        'variables': {
            'some_variable%' : 'debug_value',
    },
    'Release': {
        'variables': {
            'some_variable%' : 'release_value',
        },
    },
}
...

Links with some more examples: gyp - how to specify link library flavor; http://n8.io/converting-a-c-library-to-gyp/

Community
  • 1
  • 1
Ivan
  • 578
  • 5
  • 20
  • The article can be found at GitHub: https://github.com/TooTallNate/n8.io/blob/master/articles/converting-a-c-library-to-gyp.markdown – dmitris May 06 '13 at 20:48
  • Tried that and it doesn't work. Attempting to use the variable in 'libraries', and just get `Undefined variable some_variable in binding.gyp while trying to load binding.gyp`. – OrangeDog Jul 12 '13 at 10:23