如何从 qmake 生成 64 位 Visual Studio 项目 [英] How to generate 64-bit Visual Studio projects from qmake
问题描述
我正在使用 Qt Creator 创建一些共享库和应用程序项目,以便我可以在 Windows 和 Linux 上轻松构建它们.在 Windows 上,我们中的一些人更喜欢使用 Visual Studio,所以我想使用 qmake -tp vc -r file.pro 从 Qt .pro 文件生成 Visual Studio 解决方案和项目文件.除了生成的 Visual Studio 解决方案和项目仅包含 32 位构建配置而我需要 64 位配置之外,一切都完全按预期工作.在 Visual Studio 中创建 64 位配置没什么大不了的,但对于某些人来说,这是一个容易忽略的步骤.我想知道是否有办法通过在我的 .pro 文件中添加一些内容或作为 qmake 的参数来自动执行此操作?
I am using Qt Creator to create some shared library and application projects so that I can easily build them on Windows and Linux. On Windows, some of us prefer using Visual Studio so I want to generate Visual Studio solution and project files from the Qt .pro files using qmake -tp vc -r file.pro. Everything works exactly as expected except that the generated Visual Studio solution and projects only contain 32-bit build configurations and I need 64-bit configurations. It's not a big deal to create the 64-bit configuration in Visual Studio but it would be an easy step to overlook for somebody. I'm wondering if there's a way to do it automatically by either adding something to my .pro files or as an argument to qmake?
推荐答案
从 Visual Studio Command Shell Native x64 运行此命令.
Run this command from the Visual Studio Command Shell Native x64.
如果您在任何类型的批处理文件等中需要此功能,只需从 VS 命令工具调用适当的 bat 文件,例如 vcvarsx86_amd64.bat 或 vcvarsx86.bat 来设置适当的环境
If you need this functionality in any sort of batch files etc, just invoke appropriate bat file from VS Command Tools, like vcvarsx86_amd64.bat or vcvarsx86.bat to set a proper environment
这篇关于如何从 qmake 生成 64 位 Visual Studio 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!