GYP variable based on build configuration
Asked Answered
A

3

6

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

Ambrose answered 21/1, 2013 at 23:52 Comment(0)
I
2

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

Isobaric answered 27/4, 2014 at 13:16 Comment(1)
Better use <(CONFIGURATION_NAME)Isobaric
T
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.
Teri answered 24/1, 2014 at 16:53 Comment(0)
S
-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/

Salzburg answered 14/3, 2013 at 5:9 Comment(2)
The article can be found at GitHub: github.com/TooTallNate/n8.io/blob/master/articles/…Fourthclass
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.Amaryl

© 2022 - 2024 — McMap. All rights reserved.