如何使用调试符号制作node-waf构建二进制文件?

发布于 2024-12-29 10:04:59 字数 177 浏览 5 评论 0原文

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

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

Running node-waf with --verbose shows it uses g++ with -g. It seems to be default. I can't find an obvious way to tell node-waf to build node.js extensions without debug symbols. Is there a straight forward way?

Edit: I know how to add compiler options. The question would be how to remove a certain option?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨巷深深 2025-01-05 10:04:59

我自己找到了解决方案。不确定这是否是最好的解决方案。只需覆盖 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']

I found the solution myself. Not sure whether this is the best solution. Just overwriting the CXXFLAGS seems to do what I want.

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']
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文