如何在waf中指定库安装路径后缀?

发布于 2025-01-03 22:02:58 字数 189 浏览 3 评论 0原文

我想将使用命令 bld.shlib(...) 构建的库安装到 /lib 中,其中 arch_suffix 可以是 64 或空根据建筑学。

我该怎么做?

如果不可能,那么我如何显式指定这个后缀?

I want to install libraries that are built with command bld.shlib(...) into <prefix>/lib<arch_suffix>, where arch_suffix can be 64 or empty according to architecture.

How can I do this?

If it's impossible, then how can I explicitly specify this suffix?

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

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

发布评论

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

评论(1

长伴 2025-01-10 22:02:58

这是一个简单的例子,应该对您有帮助。更改安装路径确实很容易。在此示例中,我将“后缀”选项添加到选项上下文中的“配置选项”组中。然后在配置上下文中,我设置了一个名为 SUFFIX 的环境变量。在构建上下文中,我在“install_path”关键字参数中使用环境变量。这里重要的是您可以引用已设置的任何环境变量。

def options(opt):
    opt.load('compiler_cxx')
    grp = opt.get_option_group('configure options')
    grp.add_option('--suffix',default='',dest='suffix')

def configure(cfg):
    cfg.load('compiler_cxx')
    cfg.env.SUFFIX = cfg.options.suffix

def build(bld):
    src=['example.cpp']
    inc=['.']
    libs=['']
    bld(features=['cxx','cxxprogram'],
        source=src,
        includes=inc,
        target='example',
        name='example',
        use=libs,
        install_path='${PREFIX}/lib${SUFFIX}'
        )

waf distclean configure build install --prefix=/tmp --suffix=64

This is a simple example that should help you. It is really easy to change the install path. In this example, I add the "suffix" option to the "configure options" group in the option context. Then in the configure context, I set an environment variable called SUFFIX. In the build context, I use the environment variable in the "install_path" keyword argument. The import thing here is that you can reference any environment variable that's been set.

def options(opt):
    opt.load('compiler_cxx')
    grp = opt.get_option_group('configure options')
    grp.add_option('--suffix',default='',dest='suffix')

def configure(cfg):
    cfg.load('compiler_cxx')
    cfg.env.SUFFIX = cfg.options.suffix

def build(bld):
    src=['example.cpp']
    inc=['.']
    libs=['']
    bld(features=['cxx','cxxprogram'],
        source=src,
        includes=inc,
        target='example',
        name='example',
        use=libs,
        install_path='${PREFIX}/lib${SUFFIX}'
        )

waf distclean configure build install --prefix=/tmp --suffix=64

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