Skip to content

Instantly share code, notes, and snippets.

@fischman
Created Jul 11, 2013
Embed
What would you like to do?
Example of negation in gyp
fischman@fischman-linux ~/t $ GYP_DEFINES="base=0" GYP_GENERATORS=ninja ~/src/chromium/src/tools/gyp/gyp --depth=. t.gyp && grep NEGATION out/Default/obj/MyTarget.ninja
cflags = -DNEGATION_1
fischman@fischman-linux ~/t $ GYP_DEFINES="base=1" GYP_GENERATORS=ninja ~/src/chromium/src/tools/gyp/gyp --depth=. t.gyp && grep NEGATION out/Default/obj/MyTarget.ninja
cflags = -DNEGATION_0
{
'variables': {
'variables': {
'base%': 1,
},
'base%': '<(base)',
'negation%': '1 - <(base)',
},
'targets': [
{
'target_name': 'MyTarget',
'type': 'executable',
'sources': [ 'MyTarget.c' ],
'conditions': [
['<(negation)==1', {
'cflags': [ '-DNEGATION_1' ],
}, {
'cflags': [ '-DNEGATION_0' ],
}],
],
},
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment