如何在 waf 构建系统中安装不同名称的库?

发布于 2024-12-17 01:52:06 字数 669 浏览 4 评论 0原文

我想使用 waf 构建一个库,但将其安装在与目标名称不同的名称下。看来你可以做,

bld.shlib(..., install_path='${PREFIX}/lib')

但我需要能够做类似的事情:

bld.shlib(..., install_as='${PREFIX}/lib/xyz')

另外, bld.install_as() 不起作用,因为它似乎不接受任务作为目标,而且我不知道如何转动 库

tgt = bld.shlib(...)
bld.install_as('foo', tgt)

或者,我需要能够禁用自动添加到库名称的“lib”前缀,但仅适用于这个库 - 不适用于所有 在构建过程中,例如:

bld.shlib(..., libprefix='', install_path="${PREFIX}/lib/")

我认识你也可以设置 shlib_PATTERN ,但这似乎会影响当前环境下的所有库。我们有一个非常复杂的构建,它使用许多不同的环境来同时构建调试/发布,因此仅克隆当前环境并更改标志也不起作用,因为它克隆了默认环境,而不是最终构建目标的环境下(因为我们在构建期间克隆了每个环境的目标)。

有什么想法吗?谢谢!

I want to build a library with waf, but install it under a different name than the target name. It seems you can do

bld.shlib(..., install_path='${PREFIX}/lib')

but I need to be able to do something like:

bld.shlib(..., install_as='${PREFIX}/lib/xyz')

Also, bld.install_as() wont work, as it doesn't seem to accept a task as a target, and I can't figure out how to turn a task into a node representing the target, so the following doesnt work either:

tgt = bld.shlib(...)
bld.install_as('foo', tgt)

Or alternatively, I need to be able to disable the "lib" prefix that is automatically added to library names, but only for this one library - not for all them during the build, e.g. something like:

bld.shlib(..., libprefix='', install_path="${PREFIX}/lib/")

I know you can set shlib_PATTERN as well, but that seems to affect all libraries under the current environment. We have a pretty complicated build that uses a lot of different environments for building debug/release concurrently, so just cloning the current environment and changing the flag doesnt work either, because it clones the default environment, not the one the target will eventually be built under (because we clone the targets for each environment during build time).

Any thoughts? Thanks!

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

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

发布评论

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

评论(2

情丝乱 2024-12-24 01:52:06

您可以执行以下操作:

hello_lib = bld.shlib(
       includes='/usr/include/python',
       source='a.cpp',
       target='hello',
       uselib='BOOST_PYTHON',
       vnum='0.0.1')
hello_lib.env.cxxshlib_PATTERN = '%s.so'

此代码仅更改一项任务的命名模式。

You can do this:

hello_lib = bld.shlib(
       includes='/usr/include/python',
       source='a.cpp',
       target='hello',
       uselib='BOOST_PYTHON',
       vnum='0.0.1')
hello_lib.env.cxxshlib_PATTERN = '%s.so'

This code changes naming pattern for only one task.

蒲公英的约定 2024-12-24 01:52:06

您可以使用两个关键字参数:“name”和“target”。 “target”是创建的文件的名称,而“Name”是使用“--target”参数时目标的名称。令人困惑,但这是一个例子:

bld(features=['cxx','cxxshlib'],
    source=src,
    includes=inc,
    target='OutputName',
    name='NameOfTarget',
    use=libs,
    install_path='${PREFIX}/lib/MyLibs
    )

waf configure build install --target=NameOfTarget --prefix=/home/Brian 

这将创建一个共享库“libOutputName.so”并将其安装到 /home/Brian/lib/MyLib

There are two keyword arguments you can use: "name" and "target". "target" is the name of the file create while Name is the name of the target when using the "--target" argument. Confusing, but here is an example:

bld(features=['cxx','cxxshlib'],
    source=src,
    includes=inc,
    target='OutputName',
    name='NameOfTarget',
    use=libs,
    install_path='${PREFIX}/lib/MyLibs
    )

waf configure build install --target=NameOfTarget --prefix=/home/Brian 

This creates a shared library "libOutputName.so" and installs it to /home/Brian/lib/MyLib

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