简体   繁体   English

是否可以在没有 qmake 的情况下使用 Qt Creator?

[英]Is it possible to use Qt Creator without qmake?

I've heard that it is possible to build non-Qt applications (like simple C++ HelloWorld) with Qt Creator.我听说可以使用 Qt Creator 构建非 Qt 应用程序(例如简单的 C++ HelloWorld)。 I downloaded and installed Qt Creator, and tried to compile simple code with it.我下载并安装了 Qt Creator,并尝试用它编译简单的代码。 But I didn't succeed: Creator needs qmake to create makefile.但是我没有成功:Creator需要qmake来创建makefile。

Although the package I downloaded includes MinGW, there is no qmake inside of it.虽然我下载的package包含了MinGW,但是里面没有qmake。

I still want to use it just like an IDE to create simple C++ sources and compile them with MinGW.我仍然想像 IDE 一样使用它来创建简单的 C++ 源并用 MinGW 编译它们。 Is it possible to use Qt Creator without installing whole platform?是否可以在不安装整个平台的情况下使用 Qt Creator?

Qt Creator support CMake projects, you just need to choose Open a file or project and select the root CMakeList.txt of your project. Qt Creator 支持CMake项目,您只需选择打开文件或项目和 select 项目的根 CMakeList.txt。

If you want to define your own build workflow, you can remove the default build step and create your own custom build steps ( Qt Creator Build Steps ).如果要定义自己的构建工作流程,可以删除默认构建步骤并创建自己的自定义构建步骤( Qt Creator Build Steps )。

I think you can modify the build step to remove qmake and use your custom make file.我认为您可以修改构建步骤以删除 qmake 并使用您的自定义 make 文件。

You totally can!你完全可以!

You can write a.pro file yourself and use it as a project file to use QtCreator without linking / using any of the Qt libraries.您可以自己编写一个.pro 文件并将其用作项目文件以使用 QtCreator,而无需链接/使用任何 Qt 库。

In Project / Compilation Parameters , you can actually tune the compilation steps (removing the qmake step and adding your own).Project / Compilation Parameters中,您实际上可以调整编译步骤(删除 qmake 步骤并添加您自己的步骤)。

I use it for a big project of mine and it's very efficient: QtCreator's C analyzer is diamond.我将它用于我的一个大项目,它非常高效:QtCreator 的 C 分析仪是菱形的。

Here's a sample project file for me:这是我的示例项目文件:

TEMPLATE = app
TARGET = 
DEPENDPATH += . include
INCLUDEPATH += . include

# Input
HEADERS += include/x.h \
           include/y.h \
           include/z.h 
SOURCES += src/x.cpp

Note that I actually use qmake to generate this file automatically, but you can also put your hands into it and modify it by hand.注意,我其实是qmake自动生成这个文件的,不过你也可以把手伸进去,手动修改。

Afterwards, it's only a matter of $ qtcreator yourfile.pro .之后,这只是$ qtcreator yourfile.pro的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM