Node.js 原生 C/C++插件构建工具
介绍
- gyp(python写的,已经改用GN):google 开源的跨平台构建系统,与 cmake 类似
- node-gyp:专门提供给 Node.js 编译 C++模块使用的
- node-gyp 流程 ```bash
- make
- make install
- cmake
- gyp
-
安装
python 3.6+
- v8.h
-
yarn global add node-gyp
使用
binding.gyp 指定需要编译的文件
{"targets": [{"target_name": "binding","sources": [ "src/binding.cc" ]}]}
命令
# configure 利用 gyp 生成不同的预编译配置文件node-gyp configure# build 根据不同平台、不同构建配置进行编译node-gyp build
参考链接
- https://blog.csdn.net/putao2062/article/details/107884370
- https://github.com/nodejs/node-gyp/blob/master/README.md
