从命令行构建Qt Xcode项目 [英] Building Qt Xcode Projects From the Command Line
问题描述
我已经和Qt玩了几个小时了.我发现qmake在Mac OS X上生成了Xcode项目文件,而不是好的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编译项目,只需将QMAKESPEC的环境变量设置为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屋!