使用 QMAKE 构建 32 位和 64 位版本的项目

发布于 2024-10-06 17:08:18 字数 127 浏览 0 评论 0原文

我需要生成应用程序的 32 位版本,但我正在 64 位操作系统上进行编译。我正在寻找一种方法让 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

任性一次 2024-10-13 17:08:18

使用类似以下的结构

CONFIG += 32bit

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

在您的 .pro 文件中 。然后你只需要改变一行就可以为另一种架构重新编译。

Use a construction something like:

CONFIG += 32bit

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

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

绝不放开 2024-10-13 17:08:18

在您希望仅针对 win32 架构运行的每个命令前面使用 win32:。或者可以使用范围作为

win32 {
     SOURCES += paintwidget_win.cpp
 }

另外,您可以使用 Visual Studio 的 ($Platform) MSDN 宏来引用体系结构 win32 或 x64。

Make use of win32: in front of each command you would like be run for win32 architecture only. Or can use a scope as

win32 {
     SOURCES += paintwidget_win.cpp
 }

Also, you may refer to the architecture win32 or x64 with the ($Platform) MSDN macro for Visual Studio.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文