Skip to content

Instantly share code, notes, and snippets.

@fischman
Created July 11, 2013 21:08
Show Gist options
  • Save fischman/5979272 to your computer and use it in GitHub Desktop.
Save fischman/5979272 to your computer and use it in GitHub Desktop.
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