/usr/share/qt5/doc/qtdoc/third-party-libraries.html is in qt5-doc-html 5.3.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- third-party-libraries.qdoc -->
<title>Third Party Libraries | QtDoc 5.3</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li><a href="index.html">Qt 5.3</a></li>
<li>Third Party Libraries</li>
<li id="buildversion">
Qt 5.3.2 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#source-code">Source code</a></li>
<li class="level1"><a href="#library-files">Library files</a></li>
<li class="level1"><a href="#destination-directory">Destination directory</a></li>
</ul>
</div>
<h1 class="title">Third Party Libraries</h1>
<span class="subtitle"></span>
<!-- $$$third-party-libraries.html-description -->
<div class="descr"> <a name="details"></a>
<p>Using a third-party library with Qt is a simple process. Suppose you know of a cross-platform library that accepts audio samples of a cat's meows and translates them into English words. This library is named <tt>CatWhisperer</tt>, and has several files that it provides as part of its library. Your project, <tt>MyQtApp</tt>, stores these files in a folder named <tt>3rdparty</tt>:</p>
<ul>
<li>MyQtApp/<ul>
<li>MyQtApp.pro</li>
<li>src/<ul>
<li>main.cpp</li>
</ul>
</li>
<li>3rdparty/<ul>
<li>CatWhisperer<ul>
<li>include/<ul>
<li>CatWhisperer.h</li>
</ul>
</li>
<li>lib/<ul>
<li>libCatWhisperer.so</li>
<li>CatWhisperer.lib</li>
</ul>
</li>
<li>bin/<ul>
<li>CatWhisperer.dll</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>To use the <tt>CatWhisperer</tt> library in <tt>MyQtApp</tt>, <tt>qmake</tt> requires the location and names of the <tt>CatWhisperer</tt> libraries. Optionally, you can also:</p>
<ul>
<li>Provide the location of the <tt>CatWhisperer</tt> source code so that you don't have to type out the full path to each file when you include them in your own code.</li>
<li>Choose the destination in which the <tt>MyQtApp</tt> executable will be created.</li>
</ul>
<p>The information above is provided in the <tt>.pro</tt> file, so that <tt>qmake</tt> can parse it and produce makefiles. Makefiles contain all the information needed by your compiler and linker to produce output, whether it is an executable, another library file, etc. The next sections explain the syntax with which <tt>qmake</tt> expects you to provide this information.</p>
<a name="source-code"></a>
<h2>Source code</h2>
<p>To be able to write</p>
<pre class="cpp"><span class="preprocessor">#include <CatWhisperer.h></span></pre>
<p>instead of</p>
<pre class="cpp"><span class="preprocessor">#include <3rdparty/CatWhisperer/include/CatWhisperer.h></span></pre>
<p>you can provide the path to the <tt>CatWhisperer</tt> <tt>include</tt> directory, using the <a href="../qmake/qmake-variable-reference.html#qmake-variable-reference">INCLUDEPATH</a> variable:</p>
<pre class="cpp">INCLUDEPATH <span class="operator">+</span><span class="operator">=</span> <span class="number">3rdparty</span><span class="operator">/</span>CatWhisperer<span class="operator">/</span><span class="keyword">include</span></pre>
<a name="library-files"></a>
<h2>Library files</h2>
<p>To let <tt>qmake</tt> know where to find the <tt>CatWhisperer</tt> library files, use the <a href="../qmake/qmake-variable-reference.html#qmake-variable-reference">LIBS</a> variable:</p>
<pre class="cpp">LIBS <span class="operator">+</span><span class="operator">=</span> <span class="operator">-</span>L<span class="string">"3rdparty/CatWhisperer/lib"</span> <span class="operator">-</span>lCatWhisperer</pre>
<p>The first part of the expression lets the linker know in which directory it should look for the library files. The double quotes are only necessary when the path contains spaces, so we could have omitted them in this example.</p>
<p>The second part tells the linker which libraries to link against. We have two different library files for UNIX platforms and Windows, respectively: <tt>libCatWhisperer.so</tt> and <tt>CatWhisperer.lib</tt>. It is not necessary to specify the <tt>.lib</tt> extension, nor the <tt>lib</tt> prefix (on UNIX platforms).</p>
<a name="destination-directory"></a>
<h2>Destination directory</h2>
<p>By default, <tt>qmake</tt> creates the executable in the same directory as the <tt>.pro</tt> file. We can choose our own directory using the <a href="../qmake/qmake-variable-reference.html#qmake-variable-reference">DESTDIR</a> variable:</p>
<pre class="cpp">DESTDIR <span class="operator">=</span> bin</pre>
<p>That's it! You can now use the <tt>CatWhisperer</tt> library in your project. The final <tt>.pro</tt> file looks like this:</p>
<pre class="cpp">TARGET <span class="operator">=</span> MyQtApp
TEMPLATE <span class="operator">=</span> app
INCLUDEPATH <span class="operator">+</span><span class="operator">=</span> <span class="number">3rdparty</span><span class="operator">/</span>CatWhisperer<span class="operator">/</span><span class="keyword">include</span>
SOURCES <span class="operator">+</span><span class="operator">=</span> src<span class="operator">/</span>main<span class="operator">.</span>cpp
LIBS <span class="operator">+</span><span class="operator">=</span> <span class="operator">-</span>L<span class="string">"3rdparty/CatWhisperer/lib"</span> <span class="operator">-</span>lCatWhisperer</pre>
</div>
<p><b>See also </b><a href="../qmake/qmake-manual.html">qmake Manual</a> and <a href="http://qt-project.org/doc/qtcreator/creator-project-qmake-libraries.html">Qt Creator: Adding Libraries to Projects</a>.</p>
<!-- @@@third-party-libraries.html -->
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2014 Digia Plc and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. </p>
</div>
</body>
</html>
|