Add Crashpad Support on Windows (#4351)

* feat: crashpad on windows

* feat: inline it

* feat: more crashpad

* chore: remove qBreakpad

* fix: add mention to crashpad

* refactor: version string

* feat: add crashpad module

* refactor: build crashpad from source

* fix: minor adjustments

* chore: add changelog entry

* fix: formatting and include

* fix: format

* build: use flags similar to release profile

* ci: build with crashpad on windows

* ci: recurse submodules

* ci: always include crashpad

* fix: try 7z

for some reason zstd just doesn't run

* fix: wrong path for symbols

* fix: copy

pls don't build

* ci: use new cache key

* fix: missing pragma

* ci: add workflow without crashpad

* docs: elevate changelog entry

* fix: add link to cmake issue

* fix: windows include issue

Someone (crashpad) includes Windows.h before winsock2.h

* fix: working directory

* fix: another working directory
This commit is contained in:
nerix
2023-02-12 20:36:58 +01:00
committed by GitHub
parent 8e24a29c85
commit e377c30192
17 changed files with 426 additions and 26 deletions
+44 -7
View File
@@ -26,6 +26,7 @@ jobs:
pch: [true]
force-lto: [false]
skip_artifact: ["no"]
crashpad: [true]
include:
# Ubuntu 20.04, Qt 5.12
- os: ubuntu-20.04
@@ -43,6 +44,13 @@ jobs:
pch: false
force-lto: true
skip_artifact: "yes"
# Test for disabling crashpad on Windows
- os: windows-latest
qt-version: 5.15.2
pch: false
force-lto: true
skip_artifact: "yes"
crashpad: false
fail-fast: false
steps:
@@ -52,6 +60,12 @@ jobs:
echo "C2_ENABLE_LTO=ON" >> "$GITHUB_ENV"
shell: bash
- name: Set Crashpad
if: matrix.crashpad == true
run: |
echo "C2_ENABLE_CRASHPAD=ON" >> "$GITHUB_ENV"
shell: bash
- name: Set environment variables for windows-latest
if: matrix.os == 'windows-latest'
run: |
@@ -60,7 +74,7 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
submodules: recursive
fetch-depth: 0 # allows for tags access
- name: Install Qt
@@ -76,14 +90,14 @@ jobs:
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v3
with:
key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.txt') }}
key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-user-${{ hashFiles('**/conanfile.txt') }}
path: ~/.conan/
- name: Cache conan packages part 2
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v3
with:
key: ${{ runner.os }}-conan-root-${{ hashFiles('**/conanfile.txt') }}
key: ${{ runner.os }}-${{ matrix.crashpad }}-conan-root-${{ hashFiles('**/conanfile.txt') }}
path: C:/.conan/
- name: Add Conan to path
@@ -110,27 +124,50 @@ jobs:
run: |
mkdir build
cd build
conan install .. -s build_type=Release -b missing -pr:b=default
conan install .. -s build_type=RelWithDebInfo -b missing -pr:b=default
cmake `
-G"NMake Makefiles" `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" `
-DBUILD_WITH_CRASHPAD="$Env:C2_ENABLE_CRASHPAD" `
-DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" `
..
set cl=/MP
nmake /S /NOLOGO
- name: Build crashpad (Windows)
if: startsWith(matrix.os, 'windows') && matrix.crashpad
run: |
cd build
set cl=/MP
nmake /S /NOLOGO crashpad_handler
mkdir Chatterino2/crashpad
cp bin/crashpad/crashpad_handler.exe Chatterino2/crashpad/crashpad_handler.exe
7z a bin/chatterino.pdb.7z bin/chatterino.pdb
- name: Package (windows)
if: startsWith(matrix.os, 'windows')
run: |
cd build
windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/
cp bin/chatterino.exe Chatterino2/
echo nightly > Chatterino2/modes
7z a chatterino-windows-x86-64.zip Chatterino2/
- name: Upload artifact (Windows)
if: startsWith(matrix.os, 'windows')
- name: Upload artifact (Windows - binary)
if: startsWith(matrix.os, 'windows') && matrix.skip_artifact != 'yes'
uses: actions/upload-artifact@v3
with:
name: chatterino-windows-x86-64-${{ matrix.qt-version }}.zip
path: build/chatterino-windows-x86-64.zip
- name: Upload artifact (Windows - symbols)
if: startsWith(matrix.os, 'windows') && matrix.skip_artifact != 'yes'
uses: actions/upload-artifact@v3
with:
name: chatterino-windows-x86-64-${{ matrix.qt-version }}-symbols.pdb.7z
path: build/bin/chatterino.pdb.7z
- name: Clean Conan pkgs
if: startsWith(matrix.os, 'windows')
run: conan remove "*" -fsb