Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Chatterino/chatterino2 into danke…
Browse files Browse the repository at this point in the history
…rino
  • Loading branch information
Mm2PL committed Apr 3, 2024
2 parents 6984e45 + 2ea24c1 commit b003386
Show file tree
Hide file tree
Showing 85 changed files with 2,730 additions and 648 deletions.
34 changes: 34 additions & 0 deletions .CI/setup-clang-tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -ev;

# aqt installs into .qtinstall/Qt/<version>/gcc_64
# This is doing the same as jurplel/install-qt-action
# See https://github.com/jurplel/install-qt-action/blob/74ca8cd6681420fc8894aed264644c7a76d7c8cb/action/src/main.ts#L52-L74
qtpath=$(echo .qtinstall/Qt/[0-9]*/*/bin/qmake | sed -e s:/bin/qmake$::)
export LD_LIBRARY_PATH="$qtpath/lib"
export QT_ROOT_DIR=$qtpath
export QT_PLUGIN_PATH="$qtpath/plugins"
export PATH="$PATH:$(realpath "$qtpath/bin")"
export Qt6_DIR="$(realpath "$qtpath")"

cmake -S. -Bbuild-clang-tidy \
-DCMAKE_BUILD_TYPE=Debug \
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DCHATTERINO_LTO=Off \
-DCHATTERINO_PLUGINS=On \
-DBUILD_WITH_QT6=On \
-DBUILD_TESTS=On \
-DBUILD_BENCHMARKS=On

# Run MOC and UIC
# This will compile the dependencies
# Get the targets using `ninja -t targets | grep autogen`
cmake --build build-clang-tidy --parallel -t \
Core_autogen \
LibCommuni_autogen \
Model_autogen \
Util_autogen \
chatterino-lib_autogen
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ PointerBindsToType: false
SpacesBeforeTrailingComments: 2
Standard: Auto
ReflowComments: false
InsertNewlineAtEOF: true
113 changes: 15 additions & 98 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,25 @@ concurrency:
group: clang-tidy-${{ github.ref }}
cancel-in-progress: true

env:
CHATTERINO_REQUIRE_CLEAN_GIT: On
C2_BUILD_WITH_QT6: Off

jobs:
build:
review:
name: "clang-tidy ${{ matrix.os }}, Qt ${{ matrix.qt-version }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Ubuntu 22.04, Qt 5.15
# Ubuntu 22.04, Qt 6.6
- os: ubuntu-22.04
qt-version: 5.15.2
plugins: false
qt-version: 6.6.2

fail-fast: false

steps:
- name: Enable plugin support
if: matrix.plugins
run: |
echo "C2_PLUGINS=ON" >> "$GITHUB_ENV"
shell: bash

- name: Set BUILD_WITH_QT6
if: startsWith(matrix.qt-version, '6.')
run: |
echo "C2_BUILD_WITH_QT6=ON" >> "$GITHUB_ENV"
shell: bash

- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # allows for tags access

- name: Install Qt5
if: startsWith(matrix.qt-version, '5.')
uses: jurplel/[email protected]
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
version: ${{ matrix.qt-version }}

- name: Install Qt 6.5.3 imageformats
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/[email protected]
with:
cache: false
modules: qtimageformats
set-env: false
version: 6.5.3
extra: --noarchives

- name: Install Qt6
if: startsWith(matrix.qt-version, '6.')
uses: jurplel/[email protected]
Expand All @@ -70,79 +35,31 @@ jobs:
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: qt5compat qtimageformats
version: ${{ matrix.qt-version }}

# LINUX
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install \
cmake \
virtualenv \
rapidjson-dev \
libfuse2 \
libssl-dev \
libboost-dev \
libxcb-randr0-dev \
libboost-system-dev \
libboost-filesystem-dev \
libpulse-dev \
libxkbcommon-x11-0 \
build-essential \
libgl1-mesa-dev \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-xinerama0
- name: Apply Qt5 patches
if: startsWith(matrix.qt-version, '5.')
run: |
patch "$Qt5_DIR/include/QtConcurrent/qtconcurrentthreadengine.h" .patches/qt5-on-newer-gcc.patch
shell: bash

- name: Build
run: |
mkdir build
cd build
CXXFLAGS=-fno-sized-deallocation cmake \
-DCMAKE_INSTALL_PREFIX=appdir/usr/ \
-DCMAKE_BUILD_TYPE=Release \
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
..
shell: bash
dir: ${{ github.workspace }}/.qtinstall
set-env: false

- name: clang-tidy review
timeout-minutes: 20
uses: ZedThree/clang-tidy-review@v0.17.1
uses: ZedThree/clang-tidy-review@v0.18.0
with:
build_dir: build-clang-tidy
config_file: ".clang-tidy"
split_workflow: true
exclude: "lib/*,tools/crash-handler/*"
cmake_command: >-
cmake -S. -Bbuild-clang-tidy
-DCMAKE_BUILD_TYPE=Release
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On
-DUSE_PRECOMPILED_HEADERS=OFF
-DCMAKE_EXPORT_COMPILE_COMMANDS=On
-DCHATTERINO_LTO=Off
-DCHATTERINO_PLUGINS=On
-DBUILD_WITH_QT6=Off
-DBUILD_TESTS=On
-DBUILD_BENCHMARKS=On
./.CI/setup-clang-tidy.sh
apt_packages: >-
qttools5-dev, qt5-image-formats-plugins, libqt5svg5-dev,
libsecret-1-dev,
libboost-dev, libboost-system-dev, libboost-filesystem-dev,
libssl-dev,
rapidjson-dev,
libbenchmark-dev
libbenchmark-dev,
build-essential,
libgl1-mesa-dev, libgstreamer-gl1.0-0, libpulse-dev,
libxcb-glx0, libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-randr0,
libxcb-render-util0, libxcb-render0, libxcb-shape0, libxcb-shm0, libxcb-sync1,
libxcb-util1, libxcb-xfixes0, libxcb-xinerama0, libxcb1, libxkbcommon-dev,
libxkbcommon-x11-0, libxcb-xkb-dev, libxcb-cursor0
- name: clang-tidy-review upload
uses: ZedThree/clang-tidy-review/upload@v0.17.1
uses: ZedThree/clang-tidy-review/upload@v0.18.0
5 changes: 3 additions & 2 deletions .github/workflows/post-clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ on:
- completed

jobs:
build:
post:
runs-on: ubuntu-latest
# Only when a build succeeds
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- uses: ZedThree/clang-tidy-review/post@v0.17.1
- uses: ZedThree/clang-tidy-review/post@v0.18.0
with:
lgtm_comment_body: ""
num_comments_as_exitcode: false
46 changes: 31 additions & 15 deletions BUILDING_ON_LINUX.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
# Linux

Note on Qt version compatibility: If you are installing Qt from a package manager, please ensure the version you are installing is at least **Qt 5.15 or newer**.
For all dependencies below we use Qt6. Our minimum supported version is Qt5.15, but you are on your own.

## Install dependencies

### Ubuntu 20.04
### Ubuntu

_Most likely works the same for other Debian-like distros._
Building on Ubuntu requires Docker.

Install all the dependencies using `sudo apt install qttools5-dev qt5-image-formats-plugins libqt5svg5-dev libboost-dev libssl-dev libboost-system-dev libboost-filesystem-dev cmake g++ libsecret-1-dev`
Use https://github.com/Chatterino/docker/pkgs/container/chatterino2-build-ubuntu-20.04 as your base if you're on Ubuntu 20.04.

Use https://github.com/Chatterino/docker/pkgs/container/chatterino2-build-ubuntu-22.04 if you're on Ubuntu 22.04.

The built binary should be exportable from the final image & able to run on your system assuming you perform a static build. See our [build.yml github workflow file](.github/workflows/build.yml) for the cmake line used for Ubuntu builds.

### Debian 12 (bookworm) or later

```sh
sudo apt install qt6-base-dev qt6-5compat-dev qt6-svg-dev qt6-image-formats-plugins libboost1.81-dev libssl-dev cmake g++ git
```

### Arch Linux

Install all the dependencies using `sudo pacman -S --needed qt5-base qt5-imageformats qt5-svg qt5-tools boost rapidjson pkgconf openssl cmake`
```sh
sudo pacman -S --needed qt6-base qt6-tools boost-libs openssl qt6-imageformats qt6-5compat qt6-svg boost rapidjson pkgconf openssl cmake
```

Alternatively you can use the [chatterino2-git](https://aur.archlinux.org/packages/chatterino2-git/) package to build and install Chatterino for you.

### Fedora 28 and above
### Fedora 39 and above

_Most likely works the same for other Red Hat-like distros. Substitute `dnf` with `yum`._

Install all the dependencies using `sudo dnf install qt5-qtbase-devel qt5-qtimageformats qt5-qtsvg-devel qt5-linguist libsecret-devel openssl-devel boost-devel cmake`
```sh
sudo dnf install qt6-qtbase-devel qt6-qtimageformats qt6-qtsvg-devel qt6-qt5compat-devel g++ git openssl-devel boost-devel cmake
```

### NixOS 18.09+

Enter the development environment with all the dependencies: `nix-shell -p openssl boost qt5.full pkg-config cmake`
```sh
nix-shell -p openssl boost qt6.full pkg-config cmake
```

## Compile

### Through Qt Creator

1. Install C++ IDE Qt Creator by using `sudo apt install qtcreator`
1. Open `CMakeLists.txt` with Qt Creator and select build

## Manually

1. In the project directory, create a build directory and enter it
Expand All @@ -42,9 +53,14 @@ Enter the development environment with all the dependencies: `nix-shell -p opens
```
1. Generate build files
```sh
cmake ..
cmake -DBUILD_WITH_QT6=ON -DBUILD_WITH_QTKEYCHAIN=OFF ..
```
1. Build the project
```sh
make
cmake --build .
```

### Through Qt Creator

1. Install C++ IDE Qt Creator by using `sudo apt install qtcreator` (Or whatever equivalent for your distro)
1. Open `CMakeLists.txt` with Qt Creator and select build
Loading

0 comments on commit b003386

Please sign in to comment.