Enable LTO support for Chatterino builds (#4258)

This is disabled by default, and can be enabled by passing `-DCHATTERINO_LTO=On` to your cmake invocation.
This commit is contained in:
pajlada
2022-12-24 18:42:59 +01:00
committed by GitHub
parent 621134ffcb
commit 83dfb08aed
5 changed files with 50 additions and 4 deletions
+22 -4
View File
@@ -12,6 +12,9 @@ concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' }}
jobs:
build:
runs-on: ${{ matrix.os }}
@@ -20,17 +23,25 @@ jobs:
os: [windows-latest, ubuntu-20.04, macos-latest]
qt-version: [5.15.2, 5.12.12]
pch: [true]
force-lto: [false]
include:
- os: ubuntu-20.04
qt-version: 5.15.2
pch: false
force-lto: true
fail-fast: false
steps:
- name: Force LTO
if: matrix.force-lto == true
run: |
echo "C2_ENABLE_LTO=ON" >> "$GITHUB_ENV"
shell: bash
- name: Set environment variables for windows-latest
if: matrix.os == 'windows-latest'
run: |
echo "vs_version=2022" >> $GITHUB_ENV
echo "vs_version=2022" >> "$GITHUB_ENV"
shell: bash
- uses: actions/checkout@v3
@@ -80,7 +91,12 @@ jobs:
mkdir build
cd build
conan install .. -b missing
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_CONAN=ON ..
cmake `
-G"NMake Makefiles" `
-DCMAKE_BUILD_TYPE=Release `
-DUSE_CONAN=ON `
-DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" `
..
set cl=/MP
nmake /S /NOLOGO
windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/
@@ -137,8 +153,9 @@ jobs:
-DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
..
make -j$(nproc)
make -j"$(nproc)"
shell: bash
- name: clang-tidy review
@@ -203,8 +220,9 @@ jobs:
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
-DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \
-DCHATTERINO_LTO="$C2_ENABLE_LTO" \
..
make -j$(sysctl -n hw.logicalcpu)
make -j"$(sysctl -n hw.logicalcpu)"
shell: bash
- name: Package (MacOS)