使用QMAKE生成32位和64位版本的项目 [英] Using QMAKE to build a both 32 and 64 bits versions of project

查看:1080
本文介绍了使用QMAKE生成32位和64位版本的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要生成32位版本的应用程序,但是我正在64位OS上进行编译。我正在寻找一种使QMake生成应用程序的32位和64位版本的方法。如果这不可能,我想知道如何切换到32位。
我还想避免麻烦到生成的Makefile。

I need to generate a 32 bits version of my application however I am compiling on a 64 bits OS. I'm looking for a way to make QMake to generate both 32 and 64 bits versions of my application. If this is not possible I would like to know how to switch to 32 bits. I would also like to avoid having to mess with the generated makefile.

推荐答案

使用类似以下的构造:

CONFIG += 32bit

CONFIG(32bit) {
    TARGET = 32bit_binary
    QMAKE_CXXFLAGS += -m32
    LIBS += -L<path to 32bit libraries>
}
CONFIG(64bit) {
    TARGET = 64bit_binary
}


$ b .pro文件中的$ b

。然后,您只需要更改一行即可针对另一种体系结构进行重新编译。

in your .pro file. Then you only need to change one line to recompile for the other architecture.

这篇关于使用QMAKE生成32位和64位版本的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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