如何在WAF中使用多个编译器(Python) [英] How to use multiple compilers with waf (Python)

查看:106
本文介绍了如何在WAF中使用多个编译器(Python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何在同一个wscript中使用两个不同的编译器. Waf书中没有任何东西可以清楚地说明这一点.

I can't figure out how to use two different compilers in the same wscript. Nothing in the Waf book shows this clearly.

我尝试了以下几种方法:

I tried something among those lines :

def configure(ctx):
    ctx.setenv('compiler1')
    ctx.env.CC = '/some/compiler'
    ctx.load('compiler_c')
    ctx.setenv('compiler2')
    ctx.env.CC = '/some/other/compiler'
    ctx.load('compiler_c')

这似乎不起作用.当我这样做时,Waf找不到任何编译器.我只能通过在命令行中指定使用两种不同的编译器进行编译

This does not appear to work. Waf does not find any compiler when I do it that way. I have only managed to compile using two different compilers by specifying in the command line

 $ CC='/some/compiler' waf configure

这很烦人,因为我每次必须手动手动更改CC变量,然后重新运行配置...

This is annoying because I have to manually change the CC variable every time by hand and rerun configure...

谢谢!

推荐答案

好了,您很亲近:)您只需要在设置CC env变量conf.load("compiler_c")后加载编译器工具,然后使用变体构建.我在此答案中写了一个完整的示例.

Well, you were close :) You just need to load the compiler tool after setting the CC env variable, conf.load("compiler_c") and use variants build. I wrote a complete example in this answer.

这篇关于如何在WAF中使用多个编译器(Python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆