<p>
This page shows an elegant way of developing Qt 6 desktop applications in<br />
a Conan 2 environment. The commands are intended to run on a Debian-based<br />
Linux distribution. With adapted commands, the shown approach also works on<br />
other operating systems.
</p>

<h3>Contents</h3>
<ul>
<li><a href="#prerequisites">Prerequisites</a>
<ul>
<li><a href="#prerequisites_tools">C++ build tools</a></li>
<li><a href="#prerequisites_conan">Conan</a></li>
</ul>
</li>
<li><a href="#qt">Qt</a>
<ul>
<li><a href="#qt_requirements">Requirements for building</a></li>
<li><a href="#qt_conan">Building a Conan package</a></li>
</ul>
</li>
<li><a href="#qtcreator">Qt Creator</a>
<ul>
<li><a href="#qtcreator_requirements">Requirements for building</a></li>
<li><a href="#qtcreator_conan">Building a Conan package</a></li>
<li><a href="#qtcreator_development">Using Qt Creator for development</a></li>
</ul>
</li>
<li><a href="#links">External links for further information</a></li>
</ul>

<h3 id="prerequisites">Prerequisites</h3>

<h4 id="prerequisites_tools">C++ build tools</h4>
<p>
Install build tools using apt:
</p>
<pre><code class="language-bash">sudo apt install build-essential cmake ninja-build</code></pre>

<h4 id="prerequisites_conan">Conan</h4>
<p>
Download and install conan:
</p>
<pre><code class="language-bash">curl -OL https://github.com/conan-io/conan/releases/download/2.2.3/conan-2.2.3-amd64.deb
sudo dpkg -i conan-2.2.3-amd64.deb
</code></pre>
<ul>
<li><a href="https://conan.io/downloads" target="_blank">
https://conan.io/downloads</a></li>
</ul>

<h3 id="qt">Qt</h3>
<p>
Qt is a cute framework for creating graphical user interfaces (GUIs).
</p>

<h4 id="qt_requirements">Requirements for building</h4>
<pre><code class="language-bash">sudo apt install \
libfontconfig1-dev \
libfreetype6-dev \
libx11-dev \
libx11-xcb-dev \
libxext-dev \
libxfixes-dev \
libxi-dev \
libxrender-dev \
libxcb1-dev \
libxcb-cursor-dev \
libxcb-glx0-dev \
libxcb-keysyms1-dev \
libxcb-image0-dev \
libxcb-shm0-dev \
libxcb-icccm4-dev \
libxcb-sync-dev \
libxcb-xfixes0-dev \
libxcb-shape0-dev \
libxcb-randr0-dev \
libxcb-render-util0-dev \
libxcb-util-dev \
libxcb-xinerama0-dev \
libxcb-xkb-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev
</code></pre>
<ul>
<li><a href="https://doc.qt.io/qt-6/linux-requirements.html" target="_blank">
https://doc.qt.io/qt-6/linux-requirements.html</a></li>
</ul>

<h4 id="qt_conan">Building a Conan package</h4>
<p>
Download the package recipe for Qt to a folder named <code>qt</code>:
</p>
<pre><code class="language-bash">mkdir qt
curl https://gernot-walzl.at/C++/Qt/qt.conanfile.py -o qt/conanfile.py
</code></pre>
<p>
Create the package by specifying the directory with the recipe:
</p>
<pre><code class="language-bash">conan create qt</code></pre>
<p>
Building Qt may take an hour.
</p>

<h3 id="qtcreator">Qt Creator</h3>
<p>
Qt Creator is an integrated development environment (IDE) for C++ and Qt.
</p>

<h4 id="qtcreator_requirements">Requirements for building</h4>
<pre><code class="language-bash">sudo apt install clang clangd libclang-dev
</code></pre>
<ul>
<li><a href="https://wiki.qt.io/Building_Qt_Creator_from_Git" target="_blank">
https://wiki.qt.io/Building_Qt_Creator_from_Git</a></li>
</ul>

<h4 id="qtcreator_conan">Building a Conan package</h4>
<p>
Download the package recipe for Qt Creator to a folder named <code>qtcreator</code>:
</p>
<pre><code class="language-bash">mkdir qtcreator
curl https://gernot-walzl.at/C++/Qt/qtcreator.conanfile.py -o qtcreator/conanfile.py
</code></pre>
<p>
Create the package by specifying the directory with the recipe:
</p>
<pre><code class="language-bash">conan create qtcreator</code></pre>
<p>
Building Qt Creator may take an hour.
</p>

<h4 id="qtcreator_development">Using Qt Creator for development</h4>
<p>
Create a Conan environment with Qt libraries and Qt Creator in it:
</p>
<pre><code class="language-bash">mkdir qtconanrunenv
cd qtconanrunenv
conan install --requires=qt/6.5.3 --requires=qtcreator/12.0.2
source conanrun.sh
qtcreator
</code></pre>
<p>
In the Conan environment, Qt Creator will automatically find the Qt libraries.
</p>

<h3 id="links">External links for further information</h3>
<ul>
<li><a href="https://www.qt.io/" target="_blank">
https://www.qt.io/</a></li>
<li><a href="https://conan.io/" target="_blank">
https://conan.io/</a></li>
</ul>