~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qmake-common-projects.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/doc/src/qmake-manual.qdoc -->
 
6
<head>
 
7
    <title>Qt 4.0: qmake Common Projects</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
    <link rel="prev" href="qmake-tutorial.html" />
 
15
    <link rel="contents" href="qmake-manual.html" />
 
16
</head>
 
17
<body>
 
18
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
19
<tr>
 
20
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
21
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
22
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><p>
 
23
[Previous: <a href="qmake-tutorial.html">qmake Tutorial</a>]
 
24
[<a href="qmake-manual.html">Contents</a>]
 
25
</p>
 
26
<h1 align="center">qmake Common Projects</h1>
 
27
<p>This chapter describes how to set up <tt>qmake</tt> project files for three common types of project that are based on Qt. Although all kinds of project use many of the same variables, each of them use special variables to define</p>
 
28
<ul><li><a href="#building-an-application">Building an Application</a></li>
 
29
<ul><li><a href="#the-template">The <tt>app</tt> Template</a></li>
 
30
</ul>
 
31
<li><a href="#building-a-library">Building a Library</a></li>
 
32
<ul><li><a href="#the-template">The <tt>lib</tt> Template</a></li>
 
33
</ul>
 
34
</ul>
 
35
<a name="application"></a><a name="building-an-application"></a>
 
36
<h2>Building an Application</h2>
 
37
<a name="the-template"></a>
 
38
<h3>The <tt>app</tt> Template</h3>
 
39
<p>The <tt>app</tt> template tells <tt>qmake</tt> to generate a Makefile that will build an application. With this template, the type of application can be specified by adding one of the following options to the <tt>CONFIG</tt> variable definition:</p>
 
40
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
41
<tr valign="top" bgcolor="#a2c511"><th>Option</th><th>Description</th></tr>
 
42
<tr valign="top" bgcolor="#f0f0f0"><td>windows</td><td>The application is a Windows GUI application.</td></tr>
 
43
<tr valign="top" bgcolor="#e0e0e0"><td>console</td><td><tt>app</tt> template only: the application is a Windows console application.</td></tr>
 
44
</table>
 
45
<p>When using this template the following <tt>qmake</tt> system variables are recognized. You should use these in your .pro file to specify information about your application.</p>
 
46
<ul>
 
47
<li>HEADERS - A list of all the header files for the application.</li>
 
48
<li>SOURCES - A list of all the source files for the application.</li>
 
49
<li>FORMS - A list of all the .ui files (created using <tt>Qt Designer</tt>) for the application.</li>
 
50
<li>LEXSOURCES - A list of all the lex source files for the application.</li>
 
51
<li>YACCSOURCES - A list of all the yacc source files for the application.</li>
 
52
<li>TARGET - Name of the executable for the application. This defaults to the name of the project file. (The extension, if any, is added automatically).</li>
 
53
<li>DESTDIR - The directory in which the target executable is placed.</li>
 
54
<li>DEFINES - A list of any additional pre-processor defines needed for the application.</li>
 
55
<li>INCLUDEPATH - A list of any additional include paths needed for the application.</li>
 
56
<li>DEPENDPATH - The dependency search path for the application.</li>
 
57
<li>VPATH - The search path to find supplied files.</li>
 
58
<li><a href="qmake-variable-reference.html#def-file">DEF_FILE</a> - Windows only: A .def file to be linked against for the application.</li>
 
59
<li><a href="qmake-variable-reference.html#rc-file">RC_FILE</a> - Windows only: A resource file for the application.</li>
 
60
<li><a href="qmake-variable-reference.html#res-file">RES_FILE</a> - Windows only: A resource file to be linked against for the application.</li>
 
61
</ul>
 
62
<p>You only need to use the system variables that you have values for, for instance, if you don't have any extra INCLUDEPATHs then you don't need to specify any, <tt>qmake</tt> will add in the default ones needed. For instance, an example project file might look like this:</p>
 
63
<pre>&nbsp;   TEMPLATE = app
 
64
    DESTDIR  = c:\helloapp
 
65
    HEADERS += hello.h
 
66
    SOURCES += hello.cpp
 
67
    SOURCES += main.cpp
 
68
    DEFINES += QT_DLL
 
69
    CONFIG  += qt warn_on release</pre>
 
70
<p>For items that are single valued, e.g. the template or the destination directory, we use &quot;=&quot;; but for multi-valued items we use &quot;+=&quot; to <i>add</i> to the existing items of that type. Using &quot;=&quot; replaces the item's value with the new value, for example if we wrote <tt>DEFINES=QT_DLL</tt>, all other definitions would be deleted.</p>
 
71
<a name="library"></a><a name="building-a-library"></a>
 
72
<h2>Building a Library</h2>
 
73
<a name="the-template"></a>
 
74
<h3>The <tt>lib</tt> Template</h3>
 
75
<p>The <tt>lib</tt> template tells <tt>qmake</tt> to generate a Makefile that will build a library. When using this template, in addition to the system variables mentioned above for the <tt>app</tt> template the <tt>VERSION</tt> variable is supported. You should use these in your .pro file to specify information about the library.</p>
 
76
<p>When using the <tt>lib</tt> template, the following options determine the type of library that is built:</p>
 
77
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
78
<tr valign="top" bgcolor="#a2c511"><th>Option</th><th>Description</th></tr>
 
79
<tr valign="top" bgcolor="#f0f0f0"><td>dll</td><td>The library is a shared library (dll).</td></tr>
 
80
<tr valign="top" bgcolor="#e0e0e0"><td>staticlib</td><td>The library is a static library.</td></tr>
 
81
<tr valign="top" bgcolor="#f0f0f0"><td>plugin</td><td>The library is a plugin; this also enables the dll option.</td></tr>
 
82
</table>
 
83
<ul>
 
84
<li>VERSION - The version number of the target library, for example, 2.3.1.</li>
 
85
</ul>
 
86
<p>
 
87
[Previous: <a href="qmake-tutorial.html">qmake Tutorial</a>]
 
88
[<a href="qmake-manual.html">Contents</a>]
 
89
</p>
 
90
<p /><address><hr /><div align="center">
 
91
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
92
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
93
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
94
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
95
</tr></table></div></address></body>
 
96
</html>