开发者

Multiple configurations in Qt

开发者 https://www.devze.com 2023-01-04 11:25 出处:网络
I\'m new to Qt Creator and I have several questions regarding multiple build configurations. A side note: I have the QtCreator 1.3.1 installed on my Linux mach开发者_StackOverflow社区ine.

I'm new to Qt Creator and I have several questions regarding multiple build configurations. A side note: I have the QtCreator 1.3.1 installed on my Linux mach开发者_StackOverflow社区ine.

I need to have two configurations in my Qt Creator project. The thing is that these aren't simply debug and release but are based on the target architecture - x86 or x64. I came across Building multiple targets in Qt / Qmake and from that I went trying something like:

Conf_x86 {
 TARGET = MyApp_x86
}

Conf_x64 {
 TARGET = MyApp_x64
}

This way however I don't seems to be able to use the Qt Creator IDE to build each of these separately (Build All, Rebuild All, etc. options from the IDE menu). Is there a way to achieve this - may be even show Conf_x86 and Conf_x64 as new build configurations in Qt Creator?

One other thing the Qt I have is 64 bit so by default the target built using Qt Creator IDE will also be 64 bit. I noticed that the effective qmake call in the build step includes the following option -spec linux-g++-64. I also noticed that should I add -spec linux-g++-32 in 'Additional arguments' it would override -spec linux-g++-64 and the resulting target will be 32 bit.

How can I achieve this by simply editing the contents of the .pro file? I saw that all these changes are initially saved in the .pro.user file but this doesn't suit me at all. I need to be able to make these configurations from the .pro file if possible.


You can use Project Settings panel to add your own build configurations. You can set what make spec for each config there. Once you create a new build config, you can use it in pro file by using the CONFIG control:

CONFIG(Conf_x86) {
# do something
}
CONFIG(Conf_x64) {
# do some other thing
}
0

精彩评论

暂无评论...
验证码 换一张
取 消