Add support for CMake (buildsystem generator) (#2468)

Co-authored-by: Edgar <Edgar@AnotherFoxGuy.com>
This commit is contained in:
pajlada
2021-03-28 16:58:51 +02:00
committed by GitHub
parent 093a088363
commit e00938dfde
28 changed files with 1354 additions and 107 deletions
+119 -19
View File
@@ -14,9 +14,30 @@ jobs:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
qt-version: [5.15.2, 5.12.10]
build-system: [qmake, cmake]
exclude:
- os: windows-latest
qt-version: 5.12.10
build-system: cmake
include:
- os: windows-2016
qt-version: 5.12.10
build-system: cmake
fail-fast: false
steps:
- name: Set environment variables for windows-latest
if: matrix.os == 'windows-latest'
run: |
echo "vs_version=2019" >> $GITHUB_ENV
shell: bash
- name: Set environment variables for windows-2016
if: matrix.os == 'windows-2016'
run: |
echo "vs_version=2017" >> $GITHUB_ENV
shell: bash
- uses: actions/checkout@v2.3.4
with:
submodules: true
@@ -42,18 +63,12 @@ jobs:
version: ${{ matrix.qt-version }}
# WINDOWS
- name: Cache conan
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v2.1.4
with:
key: ${{ runner.os }}-conan-root-${{ hashFiles('**/conanfile.txt') }}
path: ~/.conan
- name: Cache conan packages
if: startsWith(matrix.os, 'windows')
uses: actions/cache@v2.1.4
with:
key: ${{ runner.os }}-conan-pkg-${{ hashFiles('**/conanfile.txt') }}
key: ${{ runner.os }}-conan-${{ hashFiles('**/conanfile.txt') }}-20210307
path: C:/.conan/
- name: Install dependencies (Windows)
@@ -65,9 +80,9 @@ jobs:
shell: cmd
- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
if: startsWith(matrix.os, 'windows') && matrix.build-system == 'qmake'
run: |
call "%programfiles(x86)%\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call "%programfiles(x86)%\Microsoft Visual Studio\%vs_version%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
mkdir build
cd build
"C:\Program Files\Conan\conan\conan.exe" install ..
@@ -80,17 +95,33 @@ jobs:
7z a chatterino-windows-x86-64.zip Chatterino2/
shell: cmd
- name: Build with CMake (Windows)
if: startsWith(matrix.os, 'windows') && matrix.build-system == 'cmake'
run: |
call "%programfiles(x86)%\Microsoft Visual Studio\%vs_version%\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
mkdir build
cd build
"C:\Program Files\Conan\conan\conan.exe" install ..
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DUSE_CONAN=ON ..
set cl=/MP
nmake /S /NOLOGO
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/
shell: cmd
- name: Ensure build succeeded (Windows)
if: startsWith(matrix.os, 'windows')
run: |
cd build
ls release/chatterino.exe
ls Chatterino2/chatterino.exe
- name: Upload artifact (Windows)
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v2.2.2
with:
name: chatterino-windows-x86-64-${{ matrix.qt-version }}.zip
name: chatterino-windows-x86-64-${{ matrix.qt-version }}-${{ matrix.build-system }}.zip
path: build/chatterino-windows-x86-64.zip
# LINUX
@@ -99,6 +130,9 @@ jobs:
run: |
sudo apt-get update
sudo apt-get -y install \
cmake \
virtualenv \
rapidjson-dev \
libssl-dev \
libboost-dev \
libxcb-randr0-dev \
@@ -116,7 +150,7 @@ jobs:
libxcb-xinerama0
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
if: startsWith(matrix.os, 'ubuntu') && matrix.build-system == 'qmake'
run: |
mkdir build
cd build
@@ -124,6 +158,15 @@ jobs:
make -j8
shell: bash
- name: Build with CMake (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && matrix.build-system == 'cmake'
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=appdir/usr/ -DCMAKE_BUILD_TYPE=Release -DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On ..
make -j8
shell: bash
- name: Package (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
@@ -135,18 +178,18 @@ jobs:
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v2.2.2
with:
name: Chatterino-x86_64-${{ matrix.qt-version }}.AppImage
name: Chatterino-x86_64-${{ matrix.qt-version }}-${{ matrix.build-system }}.AppImage
path: build/Chatterino-x86_64.AppImage
# MACOS
- name: Install dependencies (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install boost openssl rapidjson p7zip create-dmg
brew install boost openssl rapidjson p7zip create-dmg cmake tree
shell: bash
- name: Build (MacOS)
if: startsWith(matrix.os, 'macos')
if: startsWith(matrix.os, 'macos') && matrix.build-system == 'qmake'
run: |
mkdir build
cd build
@@ -154,6 +197,18 @@ jobs:
make -j8
shell: bash
- name: Build with CMake (MacOS)
if: startsWith(matrix.os, 'macos') && matrix.build-system == 'cmake'
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
..
make -j8
shell: bash
- name: Package (MacOS)
if: startsWith(matrix.os, 'macos')
run: |
@@ -168,7 +223,7 @@ jobs:
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v2.2.2
with:
name: chatterino-osx-${{ matrix.qt-version }}.dmg
name: chatterino-osx-${{ matrix.qt-version }}-${{ matrix.build-system }}.dmg
path: build/chatterino-osx.dmg
create-release:
@@ -192,19 +247,34 @@ jobs:
- uses: actions/download-artifact@v2.0.8
with:
name: chatterino-windows-x86-64-5.15.2.zip
name: chatterino-windows-x86-64-5.15.2-qmake.zip
path: windows/
- uses: actions/download-artifact@v2.0.8
with:
name: Chatterino-x86_64-5.15.2.AppImage
name: chatterino-windows-x86-64-5.15.2-cmake.zip
path: windows-cmake/
- uses: actions/download-artifact@v2.0.8
with:
name: Chatterino-x86_64-5.15.2-qmake.AppImage
path: linux/
- uses: actions/download-artifact@v2.0.8
with:
name: chatterino-osx-5.15.2.dmg
name: Chatterino-x86_64-5.15.2-cmake.AppImage
path: linux-cmake/
- uses: actions/download-artifact@v2.0.8
with:
name: chatterino-osx-5.15.2-qmake.dmg
path: macos/
- uses: actions/download-artifact@v2.0.8
with:
name: chatterino-osx-5.15.2-cmake.dmg
path: macos-cmake/
# TODO: Extract dmg and appimage
# - name: Read upload URL into output
@@ -222,6 +292,16 @@ jobs:
asset_name: chatterino-windows-x86-64.zip
asset_content_type: application/zip
- name: Upload release asset (Windows) CMake
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows-cmake/chatterino-windows-x86-64.zip
asset_name: test-cmake-chatterino-windows-x86-64.zip
asset_content_type: application/zip
- name: Upload release asset (Ubuntu)
uses: actions/upload-release-asset@v1.0.2
env:
@@ -232,6 +312,16 @@ jobs:
asset_name: Chatterino-x86_64.AppImage
asset_content_type: application/x-executable
- name: Upload release asset (Ubuntu) CMake
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./linux-cmake/Chatterino-x86_64.AppImage
asset_name: test-cmake-Chatterino-x86_64.AppImage
asset_content_type: application/x-executable
- name: Upload release asset (MacOS)
uses: actions/upload-release-asset@v1.0.2
env:
@@ -241,3 +331,13 @@ jobs:
asset_path: ./macos/chatterino-osx.dmg
asset_name: chatterino-osx.dmg
asset_content_type: application/x-bzip2
- name: Upload release asset (MacOS) CMake
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./macos-cmake/chatterino-osx.dmg
asset_name: test-cmake-chatterino-osx.dmg
asset_content_type: application/x-bzip2
+2 -2
View File
@@ -69,7 +69,7 @@ jobs:
- name: Build (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
cmake -DBUILD_TESTS=On -DCMAKE_BUILD_TYPE=Release ..
cmake -DBUILD_TESTS=On -DBUILD_APP=OFF ..
cmake --build . --config Release
working-directory: build-test
shell: bash
@@ -77,6 +77,6 @@ jobs:
- name: Test (Ubuntu)
if: startsWith(matrix.os, 'ubuntu')
run: |
./chatterino-test --platform minimal
./bin/chatterino-test --platform minimal
working-directory: build-test
shell: bash