How to use multiple compilers with waf (Python)

*爱你&永不变心* 提交于 2020-01-15 10:24:12

问题


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')

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

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

Thanks !


回答1:


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.



来源:https://stackoverflow.com/questions/50877199/how-to-use-multiple-compilers-with-waf-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!