2021-04-20 23:02:19 +02:00
# Build instructions
There is basically two ways to build `client-qt` :
2022-07-28 18:10:15 +02:00
- Use `build.py` script which will build all Jami (daemon/client lib/client-qt)
- Build only this client.
2021-04-20 23:02:19 +02:00
2021-12-22 18:15:05 +01:00
## Disclaimer
Because the client-qt is multi-platforms and supporting macOS, we need a recent version of Qt to do rendering with Metal. So, Qt 6.2 is necessary.
This version is generally not packaged on a lot of platforms, and to control available plugins and such, we have our own Qt packaged (generated by https://review.jami.net/jami-project and available on https://jami.net on the distributions we support).
So, you will need to get Qt 6.2 first. For this, there is 3 methods:
### Qt from https://jami.net (recommended)
If your distribution is supported, we provide a Qt package (`libqt-jami`) on our repo. Follow instructions https://jami.net/download-jami-linux/ (but instead installing `jami` install `libqt-jami` ).
The files will be installed in `/usr/lib/libqt-jami` .
### Qt from your distribution
If Qt 6.2 is available, you can use the packages from your distribution:
It should be (For now qt5 only is packaged by distributions, so names can change).
#### Dependencies, Debian based
```
sudo apt-get install cmake make doxygen g++ gettext libnotify-dev pandoc nasm libqrencode-dev \
libnotify-dev libnm-dev \
qtbase6-dev \
qtmultimedia5-dev libqt6svg6-dev qtwebengine6-dev qtdeclarative6-dev \
qtquickcontrols2-6-dev qml-module-qtquick2 qml-module-qtquick-controls \
qml-module-qtquick-controls2 qml-module-qtquick-dialogs \
qml-module-qtquick-layouts qml-module-qtquick-privatewidgets \
qml-module-qtquick-shapes qml-module-qtquick-window2 \
qml-module-qtquick-templates2 qml-module-qt-labs-platform \
qml-module-qtwebengine qml-module-qtwebchannel \
qml-module-qt-labs-qmlmodels
```
#### Dependencies, Fedora based
```
sudo dnf install qt6-qtsvg-devel qt6-qtwebengine-devel qt6-qtmultimedia-devel qt6-qtdeclarative-devel qt6-qtquickcontrols2-devel qt6-qtquickcontrols qrencode-devel NetworkManager-libnm-devel
```
2022-07-28 18:10:15 +02:00
### Qt from sources
2021-12-22 18:15:05 +01:00
https://www.qt.io/product/qt6
2021-04-20 23:02:19 +02:00
## GNU/Linux
2021-12-22 18:15:05 +01:00
Then, you can build the project
2021-04-20 23:02:19 +02:00
### With build.py
```bash
2021-12-22 18:15:05 +01:00
git clone https://review.jami.net/jami-project
2021-04-20 23:02:19 +02:00
```
Jami installer uses **python3** . If it's not installed, please install it:
```bash
2021-12-22 18:15:05 +01:00
cd jami-project/
2021-04-20 23:02:19 +02:00
./build.py --init
```
Then you will need to install dependencies:
2022-07-28 18:10:15 +02:00
- For GNU/Linux
2021-04-20 23:02:19 +02:00
```bash
./build.py --dependencies --qt # needs sudo
```
2022-07-28 18:10:15 +02:00
Then, you can build daemon and the client with:
2021-04-20 23:02:19 +02:00
```bash
./build.py --install --qt
```
Rename dring to jamid, ring to jami.
Automated via the following command:
$ git grep -l dring | grep -v '.ts$' | xargs sed -i
's/dring/jamid/g'
$ git ls-files | xargs sed -i 's,bin/jamid.lib,bin/jami.lib,g'
$ git ls-files | xargs sed -i 's,src/jamid,src/jami,g'
$ git ls-files | xargs sed -i 's,-mutejamid,-mutejami,g'
$ git checkout docker
Change-Id: I030209b60817372f866055daadb4d0a1c1e2e9df
2021-06-09 17:51:06 +02:00
And you will have the daemon in `daemon/bin/jamid` and the client in `client-qt/build-local/jami-qt` . You also can run it with
2021-04-20 23:02:19 +02:00
2021-12-22 18:15:05 +01:00
If you use a Qt version that is not wide-system installed you need to specify its path after the `--qt` flag, i. e., `./build.py --install --qt /home/< username > /Qt/6.2.1/gcc_64
2021-04-20 23:02:19 +02:00
```bash
./build.py --run --qt
```
Notes:
2022-07-28 18:10:15 +02:00
- `--global-install` to install client-qt globally under /usr/local
- `--prefix` to change the destination of the install.
2021-04-20 23:02:19 +02:00
## Build only the client
2022-08-04 18:40:55 +02:00
In order to use the Qt Client it is necessary to have the Qt version 6.2 or higher. If your system does not have it you can install it [from sources or download the binary installer ](https://www.qt.io/download ).
2021-04-20 23:02:19 +02:00
## Build only this repository
2022-08-04 18:40:55 +02:00
Clone with common required submodule (platform specific submodules will be cloned during the configure step)
```bash
git clone https://review.jami.net/jami-client-qt
cd jami-client-qt
git submodule update --recursive --init
```
Use CMake to build
2021-04-20 23:02:19 +02:00
```bash
# In this repository
mkdir build
cd build
cmake ..
make -j
```
2021-12-22 18:15:05 +01:00
cmake can take some options:
2021-04-20 23:02:19 +02:00
2021-12-22 18:15:05 +01:00
e.g. (with Qt version from https://jami.net)
2021-04-20 23:02:19 +02:00
```
2022-07-28 18:10:15 +02:00
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=jami-project/install/client-qt -DCMAKE_PREFIX_PATH=/usr/lib/libqt-jami
2021-04-20 23:02:19 +02:00
```
After the build has finished, you are finally ready to launch jami-qt in your build directory.
If you want to install it to the path provided by `CMAKE_INSTALL_PREFIX` you can run:
```bash
make install
```
2022-03-28 16:49:51 +02:00
## Building on native Windows
2021-04-20 23:02:19 +02:00
Only 64-bit MSVC build can be compiled.
**Setup Before Building:**
2022-07-28 18:10:15 +02:00
- Download [Qt (Open Source) ](https://www.qt.io/download-open-source?hsCtaTracking=9f6a2170-a938-42df-a8e2-a9f0b1d6cdce%7C6cb0de4f-9bb5-4778-ab02-bfb62735f3e5 )
2022-03-28 16:49:51 +02:00
- Using the online installer, install the following Qt 6.2.3 components:
2022-07-28 18:10:15 +02:00
2022-03-28 16:49:51 +02:00
- MSVC 2019 64-bit
- Qt 5 Compatibility Module
- Additional Libraries
- Qt Multimedia
- Qt Network Authorization
- Qt WebChannel
- Qt WebEngine
- Qt WebSockets
- Qt WebView
2021-04-20 23:02:19 +02:00
2022-07-28 18:10:15 +02:00
- Download [Visual Studio ](https://visualstudio.microsoft.com/ ) (version >= 2019). Note: version 2022 does not work.
2021-04-20 23:02:19 +02:00
2022-07-28 18:10:15 +02:00
- Install Qt Vs Tools under extensions, and configure msvc2017_64 path under Qt Options
| | Qt Version | SDK | Toolset |
| -------------------- | ---------- | ------------ | ------- |
| Minimum requirement: | 6.2.3 | 10.0.16299.0 | V142 |
2021-04-20 23:02:19 +02:00
- Install [Python3 ](https://www.python.org/downloads/ ) for Windows
- Using **Elevated Command Prompt**
2022-07-28 18:10:15 +02:00
2021-04-20 23:02:19 +02:00
```sh
2022-03-28 16:49:51 +02:00
python build.py --dependencies
2021-04-20 23:02:19 +02:00
```
> Note:
2022-07-28 18:10:15 +02:00
>
2021-04-20 23:02:19 +02:00
> 1. This command will install **chocolatey** which may require you to restart the Command Prompt to be able to use it.
> 2. This command will install **msys2 (64 bit)** by using chocolatey command which may cause issues below: <br>
> a. Choco may require you to restart the Command Prompt after finishing installing msys2. <br>
> b. Only if you have already installed msys2 (64 bit) under the default installation folder, we will use the existing one.
> 3. This command will install **strawberry perl** by using chocolatey command which may fail if you have already installed it.
> 4. This command will install **cmake** by using chocolatey command which will not add cmake into PATH (environment variable). <br>
>
> The issue 1, 2(a), 3 can be solved by restarting the Command Prompt under Administrator right and re-run the command. <br>
> The issue 3 can be solved by uninstalling your current strawberry perl and re-run the command. <br>
> The issue 4 can be solved by adding the location of the cmake.exe into PATH. <br>
- Using a new **Non-Elevated Command Prompt**
2022-07-28 18:10:15 +02:00
```bash
python build.py --install
```
Note: If you have another version than qt 6.2.3 installed this step will build daemon correctly but will fail for the client.
When that happens you need to compile the client separately:
```bash
2022-03-28 16:49:51 +02:00
python build.py --install
2022-07-28 18:10:15 +02:00
cd client-qt
python build.py init
python build.py --qtver < your qt version >
2021-04-20 23:02:19 +02:00
```
2022-07-28 18:10:15 +02:00
- Then you should be able to use the Visual Studio Solution file in client-qt folder ** (Configuration = Release, Platform = x64)**
2021-04-20 23:02:19 +02:00
2021-04-16 23:18:09 +02:00
### Build Module Individually
2021-04-20 23:02:19 +02:00
2022-07-28 18:10:15 +02:00
- Jami-qt also support building each module (daemon, jami-qt) seperately
2021-04-20 23:02:19 +02:00
**Daemon**
- Make sure that dependencies is built by make-ring.py
2022-03-28 16:49:51 +02:00
- On MSVC folder (jami-project\daemon\MSVC):
2022-07-28 18:10:15 +02:00
2021-04-20 23:02:19 +02:00
```sh
cmake -DCMAKE_CONFIGURATION_TYPES="ReleaseLib_win32" -DCMAKE_VS_PLATFORM_NAME="x64" -G "Visual Studio 16 2019" -A x64 -T '$(DefaultPlatformToolset)' ..
python winmake.py -b daemon
```
2022-07-28 18:10:15 +02:00
- This will generate a `.lib` file in the path of ring-project\daemon\MSVC\x64\ReleaseLib_win32\bin
2021-04-20 23:02:19 +02:00
> Note: each dependencies contrib for daemon can also be updated individually <br>
> For example:
```bash
2022-07-28 18:10:15 +02:00
python winmake.py -b opendht
2021-04-20 23:02:19 +02:00
```
**Jami-qt**
2022-07-28 18:10:15 +02:00
- Make sure that daemon, is built first
2021-04-20 23:02:19 +02:00
```bash
2022-07-28 18:10:15 +02:00
cd client-qt
python build.py init
python build.py
2021-04-20 23:02:19 +02:00
```
2022-07-28 18:10:15 +02:00
Note: if your qt version is different than 6.2.3, you need to use `python build.py --qtver <your qt version>` .
2021-12-22 18:15:05 +01:00
## Building On MacOS
**Set up**
2022-07-29 17:43:47 +02:00
- macOS minimum version 10.15
2021-12-22 18:15:05 +01:00
- install python3
- download xcode
- install Qt 6.2
Qt 6.2 can be installed via brew
2022-07-28 18:10:15 +02:00
```bash
brew install qt
2021-12-22 18:15:05 +01:00
```
2022-07-28 18:10:15 +02:00
2021-12-22 18:15:05 +01:00
or downloaded from [Qt (Open Source) ](https://www.qt.io/download-open-source?hsCtaTracking=9f6a2170-a938-42df-a8e2-a9f0b1d6cdce%7C6cb0de4f-9bb5-4778-ab02-bfb62735f3e5 )
Then, you can build the project
**Build with build.py**
2022-07-28 18:10:15 +02:00
```bash
git clone https://review.jami.net/jami-project
2021-12-22 18:15:05 +01:00
cd jami-project
./build.py --init
./build.py --dependencies --qt
./build.py --install --qt
```
2022-07-28 18:10:15 +02:00
2021-12-22 18:15:05 +01:00
If you use a Qt version that is installed in a different than standard location you need to specify its path
2022-07-28 18:10:15 +02:00
```bash
./build.py --install --qt QT_ROOT_DIRECTORY=your_qt_directory
2021-12-22 18:15:05 +01:00
```
2022-07-28 18:10:15 +02:00
2021-12-22 18:15:05 +01:00
Built client could be find in `client-qt/build-local/Jami`
2021-04-20 23:02:19 +02:00
## Packaging On Native Windows
- To be able to generate a msi package, first download and install [Wixtoolset ](https://wixtoolset.org/releases/ ).
- In Visual Studio, download WiX Toolset Visual Studio Extension.
2022-07-28 18:10:15 +02:00
- Build client-qt project first, then the JamiInstaller project, msi package should be stored in jami-project\client-qt\JamiInstaller\bin\Release
2021-04-20 23:02:19 +02:00
2021-05-07 16:38:19 +02:00
## Testing for Client-qt on Windows
2021-04-16 23:18:09 +02:00
- We currently use [GoogleTest ](https://github.com/google/googletest ) and [Qt Quick Test ](https://doc.qt.io/qt-5/qtquicktest-index.html#introduction ) in our product. To build and run tests, you could use the following command.
```
2022-07-28 18:10:15 +02:00
python build.py [runtests, pack]
2021-04-16 23:18:09 +02:00
```
2021-05-07 16:38:19 +02:00
- Note that, for tests, the path of local storage files for jami will be changed based on following environment variables.
```
%JAMI_DATA_HOME% = %TEMP% + '\\jami_test\\jami'
%JAMI_CONFIG_HOME% = %TEMP% + '\\jami_test\\.config'
%JAMI_CACHE_HOME% = %TEMP% + '\\jami_test\\.cache'
```
- These environment variables will be temporarily set when using make-client.py to run tests.
2021-04-16 23:18:09 +02:00
## Debugging
2021-04-20 23:02:19 +02:00
Compile the client with `BUILD=Debug` and compile LibRingClient with
2021-12-22 18:15:05 +01:00
`-DCMAKE_BUILD_TYPE=Debug`
Then, if you want to enable logging when running `jami-qt` launch it with `-d` or `--debug`