使用Qt Creator交叉编译Qt应用程序的简便方法?

时间:2011-04-15 11:17:59

标签: c++ qt cross-platform qt-creator

我对这个C ++和Qt Creator事物很陌生,我在Mac OS X中使用Qt Creator。 有没有一种简单的方法来编译Windows和Linux平台呢? 我目前正在做的方法是将源文件复制到Windows机器(使用Qt)并编译它,这需要花费很多时间。

是否有命令或某些东西可以同时获得所有3个可执行文件?

2 个答案:

答案 0 :(得分:3)

它不支持开箱即用,你最终可能会在不同的风格之间弄乱

我强烈建议,为了这样一个目标:

- to use either centralised (svn) or distributed (git, hg) SCM
- to use continuus integration with 3 agents, each one in a different platform (can be VM or physical computer).  You can use hudson or cruise control

这样:

- you develop locally, on whatever platform you prefer
- you push / commit / submit your changes
- the buildbox compiles on all platforms (while you can still work on the next feature)
- ideally, you run your unit tests as well
- once all builds on all platforms are finished, you got a status and a build on all targets

当想要处理多个版本的Qt或编译器时,这非常有用:返回值绝对值得在设置中投入的时间(并且它可以很好地扩展)

答案 1 :(得分:1)

这远不是微不足道的,Trolltech不喜欢这个想法(通过使它变得比它应该更难)。

互联网上有 Cross compiling Qt/Win Apps on Linux 会有所帮助(只有目录可能与Mac不同,命令应该相同)。

交叉编译后,您需要使用自定义PATH创建Qt Creator的快捷方式,该路径的交叉编译器目录前置于PATH的其余部分。这样你可以确保它被使用。不建议这样做。

为什么不使用正确设置的VM?