3

使用--verbose运行 node-waf表明它使用带有-g的 g++ 。这似乎是默认的。我找不到一种明显的方法来告诉 node-waf 在没有调试符号的情况下构建 node.js 扩展。有没有直接的方法?

编辑:我知道如何添加编译器选项。问题是如何删除某个选项?

4

1 回答 1

2

我自己找到了解决方案。不确定这是否是最好的解决方案。只是覆盖CXXFLAGS似乎做我想要的。

import Options

def set_options(ctx):
  ctx.tool_options('compiler_cxx')
  ctx.add_option('--mode', action='store', default='release', help='Compile mode: release or debug')

def configure(ctx):
  ctx.check_tool('compiler_cxx')
  ctx.check_tool('node_addon')
  if Options.options.mode == 'release':
    ctx.env['CXXFLAGS'] = ['-O3']
于 2012-01-27T07:24:45.610 回答