User:Nils Petter Skalerud
This page is a WIP. Nils is playing around with making a checklist for interns in Qt Multimedia.
The following is an opinionated guide on how Nils likes to work, and can serve as a reference to getting started with Qt development as a new employee at The Qt Company. As a Qt employee, you generally have the freedom to setup your development environment however you want, and this guide just shows how Nils likes to do so.
Checklist for interns for getting started
- Qt Microsoft account. Ask your employer for setting this up. This will be used for: Outlook, Teams, GitLab
- Qt Account. Should be registered using your @qt.io email. This will be used for: Qt homepage, Gerrit, JIRA, Qt Maintenance Tool, Qt Wiki
- JIRA privileges. In order to be allowed to modify JIRA tickets (i.e assign them to yourself), you need special permissions. Send an e-mail to jira-admin@qt-project.org with your name, and Qt account e-mail and request to be added to the group "QtCommercial".
- Gerrit contributor permissions. In order to submit code patches to Gerrit and clone from non-public repos, you need privileges. Send an e-mail to gerrit-admin@qt-project.org with your name, and Qt account e-mail and request to be added to the group "The Qt Company".
- Git config with your name and e-mail address
- Add SSH keys to Gerrit. Find a guide online on how to generate SSH keys in terminal, and paste the public SSH key to Gerrit. (This could use better instructions).
Setting up your first development environment (Linux + Multimedia)
The Qt company releases specific public versions of the Qt framework (i.e 6.10.0 or 6.8.5) to customers every few months. We can download these using Qt Maintenance Tool from the Qt homepage, and run them. When acting as a developer for Qt, you will need to compile the Qt framework from source code on your local machine. This lets you use the newest changes to the project, and also test your own changes immediately on your machine. The latest documentation for building Qt from source can be found at: https://doc-snapshots.qt.io/qt6-dev/build-sources.html. This guide will be based on that, but with some modifications on how Nils likes to work, it will also be specialized to the Qt Multimedia module.
Folder structure
Having a strict folder structure is extremely useful for making sure you are doing the right commands in the right place, and making sure you don't mistakenly push changes that you don't want to. For this guide we assume that you will use the following folder structure:
~/qtdev
--- dev
------- ffmpeg
----------- linux
------- linux
------- linux-mm
------- src
----------- qtbase
----------- qtmultimedia
--- 6.10
------- ... same as 'dev' branch but for branch 6.10
--- 6.9
------- ... same as 'dev' branch but for branch 6.9
The pattern goes: Home-folder -> qtdev -> branch -> source/build.
The folder ~/qtdev becomes the root folder for all our Qt related work, and since this is not a system-folder we don't need any administrator privileges on our machine to modify it. The folder ~/qtdev/dev then refers to all the work we are doing when we are working on the 'dev' branch within Qt. The folder ~/qtdev/6.10 and similar, will refer to any work we do when back-porting patches / solving merge conflicts on older versions of Qt. This guide will only focus on getting set up for the 'dev' so we can assume ~/qtdev/6.10 will not be used.
Within ~/qtdev/dev, we have two types of subdirectories: the actual C++ source code, and the build artifacts for platforms. The source code is found in ~/qtdev/dev/src, and this is where we will be doing all our code changes and Git commands. For code changes targeting the Qt Multimedia submodule, you can then use the folder ~/qtdev/dev/src/qtmultimedia.
Build artifacts refer to the files that are produced whenever we compile Qt, these are the files that we want to use whenever building one of the Qt example applications. Keep in mind that Qt can be compiled for multiple platforms from your host machine (Linux, Android, WebAssembly can all be compiled from a Linux host), so we keep separate folders for each of them. We can find the build artifacts for Linux in the folder ~/qtdev/dev/linux. If we ever want to build Android, we will store that in ~/qtdev/dev/android-arm64.
In the build folders, we usually run commands such as cmake . and ninja in order to initiate a compilation, or to run a test.
Note how the folder-structure example also contains folders such as linux-mm and ffmpeg/linux. These are specific to Qt Multimedia, and we'll get to them later.
This folder structure is what I use on Windows, macOS and Linux.
Download package prequisites
When on Linux, we need several packages and tools in order to compile Qt.
Downloading Qt source files
In this step we will download the Qt source files. The Qt project is spread across multiple Git repositories, separated by Git submodules. This lets you avoid having to download all submodules of Qt, when you really only need a couple. When working on the Qt Multimedia, we will primarily be using the modules qtbase, qtdeclarative, qtshadertools, qtmultimedia. Luckily, the top-level Qt repository contains a helper script to help us clone the one we want. The following commands can be pasted into the terminal, and they will remove any existing directory ~/qtdev/dev/src, clone the up to date sources and then download all the submodules we want for Qt Multimedia.
NOTE! The terminal commands below do some configuration specific to your Gerrit account. In the two last lines, swap out 'my_gerrit_username' with your Gerrit account name
cd ~/qtdev
rm -rdf ~/qtdev/dev/src
mkdir -p ~/qtdev/dev/src
git clone git://code.qt.io/qt/qt5.git ~/qtdev/dev/src
cd ~/qtdev/dev/src
./init-repository -f --module-subset=qtbase,qtrepotools,qttools,qtdeclarative,qtshadertools,qtmultimedia,qtwayland --no-resolve-deps --no-optional-deps --codereview-username my_gerrit_username
gitdir=$(git rev-parse --git-dir); scp -O -p -P 29418 my_gerrit_username@codereview.qt-project.org:hooks/commit-msg ${gitdir}/hooks/