User Tools

Site Tools


qt:pro_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
qt:pro_files [2010/12/07 18:59] – [Enabling debug/release builds] mithatqt:pro_files [2010/12/08 19:44] (current) mithat
Line 2: Line 2:
  
 ===== Description ===== ===== Description =====
-For every Qt project there is a ''{directory-name}.pro'' file that describes the project to [[qmake]]. To create a ''*.pro'' file in a project directory, run <code bash>qmake -project</code> in a terminal shell. If there are any files in the directory when the above is run, those files will be included in ''*.pro''.+For every Qt project there is a ''*.pro'' file in the project directory that describes the project to [[qmake]]. The file takes its name from the project directory.
  
-Typically a ''*.pro'' file is created once in a project's lifetime and then is updated to reflect the additional of code files, etc.+The project'''{directory-name}.pro'' file is typically created once in a project's lifetime and then edited to reflect configuration options, the addition of code files, etc.
  
-===== Synopsis  ===== +===== Syntax ===== 
-==== Syntax ==== +|''#''                      comment               | 
-''# '' //comment//\\ +|'' .''                     | the current directory | 
-''= '' //sets an option//\\  +|''{PROPERTY} {option}''  sets an option        | 
-''+='' //adds an option//\\ +|''{PROPERTY} += {option}'' adds an option        | 
-''-+'' //removes an option//\\ +|''{PROPERTY} -+ {option}'' removes an option     |
-''. '' //the current directory//\\+
  
-==== File creation ====+===== File creation ====
 +To create a ''{directory-name}.pro'' file in a project directory, run <code bash>qmake -project</code> in a terminal shell. If there are any source or other project files in the directory when the above is run, those files will be automatically included in ''{directory-name}.pro''.
  
-The virgin ''*.pro'' file in virgin directory:<code bash> +Running ''qmake -project'' when there is at least a ''main.cpp'' (or similar) file will greatly simplify future modifications. Here is a virgin ''*.pro'' file for a directory that has ''main.cpp'' in it (where main.cpp is a Qt application):<code bash>
-###################################################################### +
-# Automatically generated by qmake (2.01a) Tue Dec 7 17:07:32 2010 +
-###################################################################### +
- +
-TEMPLATE = subdirs +
- +
-# Directories +
-</code> +
- +
-The virgin ''*.pro'' file in a directory that has main.cpp in it (where main.cpp is a Qt application):<code bash>+
 ###################################################################### ######################################################################
 # Automatically generated by qmake (2.01a) Tue Dec 7 17:15:59 2010 # Automatically generated by qmake (2.01a) Tue Dec 7 17:15:59 2010
Line 40: Line 30:
 </code> </code>
  
-==== Enabling debug/release builds ====+In contrast, here is a virgin ''*.pro'' file in a virgin (empty) directory:<code bash> 
 +###################################################################### 
 +# Automatically generated by qmake (2.01a) Tue Dec 7 17:07:32 2010 
 +###################################################################### 
 + 
 +TEMPLATE = subdirs 
 + 
 +# Directories 
 +</code> 
 +===== Enabling debug/release builds =====
 In Unix (including Linux and OS X) you can explicitly specify debug and release build options: In Unix (including Linux and OS X) you can explicitly specify debug and release build options:
 <code bash>CONFIG += debug_and_release</code> <code bash>CONFIG += debug_and_release</code>
Line 51: Line 50:
  
 I have not yet tested Windows, but the above config option is supposedly not needed and/or invalid in Windows. I have not yet tested Windows, but the above config option is supposedly not needed and/or invalid in Windows.
-==== Additions/tweaks ====+ 
 +===== Adding source code files ===== 
 +To add the files ''{YourClass}.h'' and ''{YourClass}.cpp'' to your project, replace 
 +<code>SOURCES += main.cpp</code> with 
 +<code> 
 +SOURCES main.cpp \ 
 +          {YourClass}.cpp 
 +HEADERS {YourClass}.h           
 +</code> 
 + 
 +===== Adding resource collection files ===== 
 +For a resource to be compiled into the binary the *.qrc file must be mentioned in the .pro file: 
 +<code>RESOURCES = foo.qrc</code> 
 + 
 +===== Additional Qt libraries ===== 
 +The QtCore and QtGUI libraries are included in all projects by default. To add additional Qt libraries to your project, include: 
 +<code>QT += {libname1} {libname2} ... {libnameN}</code> 
 +to remove: 
 +<code>QT -= {libname1}</code> 
 +where ''{libnameX}'' is one of: ''network'', ''opengl'', ''sql'', ''xml'', ''support''. (Note: this list may not be complete as new libraries may have been added since this was written.) 
 + 
 +The above names correspond to the QtNetwork, QtOpenGL, QtSQL, QtXML, and QtAssistantClient+Qt3Support libraries. 
 + 
 +===== Official documentation ===== 
 +[[http://doc.qt.nokia.com/qmake-project-files.html]]
qt/pro_files.1291748349.txt.gz · Last modified: 2010/12/07 18:59 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki