当前位置: 动力学知识库 > 问答 > 编程问答 >

node.js - Different Condition checks supported in binding.gyp

问题描述:

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
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: