2

我想安装使用命令构建的库bld.shlib(...)into <prefix>/lib<arch_suffix>,其中 arch_suffix 可以是 64 或根据架构为空。

我怎样才能做到这一点?

如果不可能,那么我该如何明确指定这个后缀?

4

1 回答 1

3

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

于 2012-02-08T15:24:36.887 回答