为什么 Qt 使用自己的 make 工具 qmake?
我刚开始使用 Qt 并注意到它使用自己的 make 工具, qmake.
I just started using Qt and noticed that it uses its own make tool, qmake.
- 为什么 Qt 使用自己的 make 工具?
- 是否有什么特殊原因阻止它使用标准的 make 工具?
- qmake 是否调用 GCC C++ 编译器?
- Why does Qt use its own make tool?
- Is there something special that prevents it from using a standard make tool?
- Does qmake call the GCC C++ compiler?
推荐答案
Qt 使用 qmake 透明地支持 Qt 的各种插件,包括moc,元对象编译器"(提供信号和槽),uic,theui 编译器"(从 .ui 设计器文件创建头文件)、rcc,资源编译器"(编译资源).
Qt uses qmake to transparently support Qt's various addons, including "moc, the meta-object compiler" (which provides signals & slots), "uic, the ui compiler" (which creates header files from .ui designer files), "rcc, the resource compiler" (which compiles resources).
没有什么可以阻止您使用您想要的任何构建系统.然而,还有很多工作要做.例如,您需要对包含具有信号或槽的类的每个头文件运行moc".一般不推荐使用,尤其是刚开始使用 Qt 的人.
There's nothing to stop you using any build system you want. however, it's a lot more work. For example, you need to run "moc" over every header file that contains a class that has signals or slots. In general it's not recommended, especially for someone who's just starting to use Qt.
QMake 不直接调用 g++/gcc.相反,qmake 在您当前的平台上创建本机 make 文件.在linux下它创建标准的GNU make文件,在windows下它可以生成visual studio make文件,在Mac OS X下它可以生成XCode工程文件.然后调用您的本机构建系统(GNU make、MS NMake、xcodebuild 或其他),它将调用您的本机编译器(g++/gcc 或其他).
QMake does not call g++/gcc directly. Instead, qmake creates native make files on your current platform. Under linux it creates standard GNU make files, under windows it can generate visual studio make files, under Mac OS X it can generate XCode project files. You then invoke your native build system (either GNU make, or MS NMake, or xcodebuild or whatever), which will call your native compiler (g++/gcc or whatever).
相关文章