从命令行构建 Qt Xcode 项目 [英] Building Qt Xcode Projects From the Command Line

查看:32
本文介绍了从命令行构建 Qt Xcode 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经玩 Qt 几个小时了.我发现 qmake 在 Mac OS X 上生成 Xcode 项目文件,而不是好的 ol'makefile.我不想每次想构建Hello, world"时都启动 Xcode.

I've been playing around with Qt for a few hours now. I found that qmake produces Xcode project files on Mac OS X instead of good ol' makefiles. I don't want to launch Xcode every time I want to build "Hello, world".

我如何让 qmake 生成常规的 makefile,或者,如果这在 Mac 上无法完成,我如何从命令行编译 .xcodeproj 文件?

How do I make qmake generate regular makefiles or, if that's something that cannot be done on the Mac, how do I compile .xcodeproj files from the command line?

我尝试了 xcodebuild -project myProject -alltargets.我得到很多输出,然后是 Abort trap.

I tried xcodebuild -project myProject -alltargets. I get a lot of output followed by Abort trap.

推荐答案

Trolltech 的 OS X 开源 Qt 二进制安装程序默认在您运行 qmake 时创建 .xcodeproj 文件.我不使用XCode进行编辑,所以打开它编译项目很痛苦.

The open-source Qt binary installers for OS X from Trolltech default to creating .xcodeproj files when you run qmake. I don't use XCode for editing so it is a pain to open it to compile the project.

要从 Terminal.app 编译您的项目,只需将 QMAKSPEC 的环境变量设置为 macx-g++

To compile your projects from Terminal.app, just set an environment variable of QMAKESPEC to macx-g++

如果您只想从终端编译某个项目,请进入该目录并运行

If you want to just compile a certain project from the terminal, go into that directory and run

qmake -spec macx-g++

当您运行 qmake 时,这将创建一个 Makefile,您可以通过运行 make 来使用它.

When you run qmake, this will create a Makefile which you can use by running make.

这篇关于从命令行构建 Qt Xcode 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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