In QT, a tool named qmake can generate a makefile, which is generated by the. Pro file. The. Pro file is written as follows:
1. Notes
Starting from "#" to the end of this line.
2. The template variable tells qmake which makefile is generated for this application. The following are available options:
Template = app
A>App-CreateApplicationsMakefile. This is the default value, so if the template is not specified, this will be used.
B>Lib-CreateLibraryMakefile.
C>Vcapp-Create a Visual Studio project file for the application.
D>Vclib-Create a Visual Studio project file for the library.
E>Subdirs-This is a special template. It can create a makefile that can enter a specific directory and generate makefile for a project file and call make for it.
3. Specify the directory where the generated application is stored
Destdir + = ../bin
4. specify the name of the generated Application
Target = pksystem
5. configuration information
Config is used to tell qmake about the application configuration.
Config + = QT warn_on release
"+ =" Is used here because we add our configuration options to any existing one. It is safer to replace all specified options as "=.
A>QtTell qmake that the application uses QT for connection. This means that qmake considers the QT library when connecting and adding the required include path for compilation.
B>Warn_onWhich tells qmake to set the compiler to output warning information.
C>ReleaseTell qmake that the application must be connected to a published application. In the development process, programmers can also use DEBUG to replace release.
6. Specify the UIC command to convert the. UI file to the directory where the UI _ *. h file is stored.
Ui_dir + = forms
7. Specify the RCC command to convert the. qrc file to the directory where qrc _ *. H files are stored.
Rcc_dir + = ../tmp
8. Specify the MOC command to convert the header file containing q_object to the storage directory of the standard. h file.
Moc_dir + = ../tmp
9. Specify the directory for storing the target file (OBJ)
Objects_dir + = ../tmp
10. Related paths for program Compilation
Dependpath + =. forms include qrc sources
11. header file inclusion path
Includepath + =.
12. information generated during qmake, [$ {A} string for reading variable A], [$ (PATH) for reading environment variable path]
# Message ($ (PATH ))
13. source file encoding
Codecforsrc = GBK
14. header files contained in the project
Headers + = include/painter. h
15... uidesign file included in the project
Forms + = forms/painter. UI
16. source files contained in the project
Sources + = sources/Main. cpp sources/painter. cpp
17. resource files contained in the project
Resources + = qrc/painter. qrc
18. libs + =-l folderpath // path of the introduced lib file-L: Import path
19. Release: libs + =-l folderpath // The LIB file path introduced by release
20. Debug: libs + =-l folderpath // lib file path introduced by debug
21. defines + = xx_xx_xxx // define the compilation option. You can use: # ifdefine xx_xx_xxx in the. h file.
22. rc_file = xxx. icns
23. Platform relevance Processing
What we need to do here is to use the corresponding scope for Processing Based on the platform that qmake runs. The simple scope of the platform-dependent files added for the Windows platform looks like this:
Win32 {
Sources + = hello_win.cpp
}
========================================================== ========================================================== ==========================================
When you have created your project file, it is easy to generate the makefile. All you have to do is first go to the project file you generated and enter:
Makefile can be generated by the. Pro file as follows:
Qmake-omakefile hello. Pro
For Visual Studio users, qmake can also generate the ". DSP" file, for example:
Qmake-tvcapp-O hello. DSP hello. Pro
++ A pro file instance ++ ++
Template = app # module configuration language = C ++ # C ++ language config ++ = QT warn_on debug release # The introduced lib file is used to introduce the dynamic link library libs + = qaxcontainer. lib # the header file contains the path includepath + = .. /.. /qtcompnent/qtchklisten/Inc .. /.. /qtcompnent/qtclearfile/Inc .. /.. /validator/INC/validerrcode .. /.. /qtcompnent/qtdir/INC .. /INC .. /.. /utillib/INC/xmlapi .. /.. /utillib/INC/util .. /.. /xercesc .. /.. /qtcompnent/qteditor/Inc .. /.. /qtcompnent/qtfunreview/Inc .. /.. /qtcompnent/qttable/Inc .. /.. /qtcompnent/qtversion/Inc .. /.. /qtcompnent/qini/Inc .. /.. /icdtool/icdservices/Inc .. /.. /icdtool/dataset/INC .. /.. /icdtool/Doi/INC .. /.. /icdtool/reportcontrol/INC .. /.. /icdtool/gseconctrol/INC .. /.. /icdtool/inputs/Inc .. /.. /icdtool/smvconctrol/INC .. /.. /icdtool/logcontrol/INC .. /.. /Content preview/INC/Content preview toollib .. /.. /bqpreview/form .. /.. /icdtool/sclcontrol/Inc .. /.. /icdtool/log/INC .. /.. /icdtool/settingcontrol/INC .. /.. /qtcompnent/qteditor/Inc .. /.. /qtcompnent/qttreeview/Inc .. /.. /qtcompnent/qttabwidget/INC .. /.. /communication/INC .. /.. /qtcompnent/qtabout/Inc .. /iedmanage/INC .. /ldmanage/INC .. /foriecrun/INC .. /.. /qtcompnent/validset/INC # header file headers included in the project + = .. /INC/exportstable. h /.. /INC/maintabwidget. h /.. /INC/outputtab. h /.. /INC/strutil. h /.. /INC/treeeditview. h /.. /INC/mainform. h /.. /INC/recenfileini. h /.. /INC/exportcidfunction. h # source file sources + = in the project .. /src/main. CPP /.. /src/exportstable. CPP /.. /src/maintabwidget. CPP /.. /src/outputtab. CPP /.. /src/treeeditview. CPP /.. /src/mainform. CPP /.. /src/recenfileini. CPP /.. /src/exportcidfunction. CPP #. uidesign file forms = .. /form/xmlmainform. UI /.. /form/exportiedform. UI /.. /form/exportsedform. UI /.. /form/importsedform. UI /.. /form/formiminputs. ui # image file images = images/substation.png/images/communication.png/images/autocom.png/images/reportcfg.png/images/filetrans.png/images/review.png/images # Engineering resources = scintilla. qrc # config-= releaseconfig-= debugrc_file = stctool. RC binlib = .. /.. /bin .. /.. /xercesc/libui_headers_dir = .. /INC #. transfer the UI file **. directory where H is stored: ui_sources_dir = .. /src #. transfer the UI file **. directory where CPP is stored qmake_libdir =$ {binlib} release {target = bqtool # specify the generated Application name objects_dir = .. /.. /obj/bqtool/release # specify the directory where the target file (OBJ) is stored} debug {target = bqtool_d # specify the name of the generated application objects_dir = .. /.. /obj/bqtool/debug # specify the directory where the target file (OBJ) is stored} moc_dir =$ {objects_dir} destdir = .. /.. /bin # specify the directory where the generated application is stored