问题描述:

I am very new to nodejs addons. I would like to know what are the different conditions that can be checked in binding.gyp. I am aware of checking the os platform using

'conditions': [

['OS=="linux"', {}

]

What are the other variables available similar to OS? Is it possible to know the version of nodejs in the similar way?

Thanks in advance

网友答案:


I think you can refer following link. It has different sample files for binding.gyp of various projects.

网友答案:

There are some variables, predefined in GYP.

Node-gyp sets another variables in generated build/config.gypi file. Unfortunately there is no variable for the Node.js version in that file. But you can evaluate it in your GYP file with command expansion:

{
    'variables': {
        'node_version': '<!(node -e "console.log(process.versions.node)")',
    },
   # .. rest of GYP file
}
相关阅读:
Top