如何配置 node-gyp 编译模块以使用多个编译线程,如 -j8?
How can you configure node-gyp complied modules to use mutiple compile threads, like -j8?
我注意到所有编译 C 代码的节点模块 运行 只是单线程编译。
因为我经常会多次重试节点模块安装,所以至少 C 编译会利用所有内核会很好。
有没有办法为此将 j 标志传递给 C 编译器?
node-gyp 使用 JOBS
环境变量,提高它会导致更多进程编译。示例:JOBS=max node-gyp build
或者,您可以直接传递 Make 标志,如果您 运行 export MAKEFLAGS=-j8
在 运行ning node-gyp 之前。
我注意到所有编译 C 代码的节点模块 运行 只是单线程编译。
因为我经常会多次重试节点模块安装,所以至少 C 编译会利用所有内核会很好。
有没有办法为此将 j 标志传递给 C 编译器?
node-gyp 使用 JOBS
环境变量,提高它会导致更多进程编译。示例:JOBS=max node-gyp build
或者,您可以直接传递 Make 标志,如果您 运行 export MAKEFLAGS=-j8
在 运行ning node-gyp 之前。