Build Chiaki (Qt6) #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Chiaki (Qt6) | |
on: | |
workflow_dispatch: | |
# workflow_call: #testing! | |
# TODO: https://www.qt.io/blog/qt-multimedia-in-qt-6 | |
# Not as easy as updating a cmakelists.txt file :( | |
jobs: | |
build-mac_x64: | |
name: Build Chiaki macOS x64 | |
runs-on: macos-13 | |
steps: | |
- name: Clean Workspace Action | |
uses: yumis-coconudge/clean-workspace-action@v1 | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
path: 'chiaki-qt6' | |
- name: Install Dependencies | |
run: | | |
HOMEBREW_NO_AUTO_UPDATE=1 brew install opus [email protected] ffmpeg@5 nasm sdl2 protobuf | |
- name: Setup Python | |
id: python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
architecture: "x64" | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade setuptools wheel | |
python -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller | |
python -c 'import google.protobuf; print(google.protobuf.__file__)' | |
- name: Setup Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: '6.5.1' | |
host: 'mac' | |
target: 'desktop' | |
arch: 'clang_64' | |
modules: 'qtmultimedia' | |
cache: true | |
- name: Configure Chiaki | |
working-directory: chiaki-qt6 | |
run: | | |
cmake \ | |
-S . \ | |
-B build \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE \ | |
-DCHIAKI_ENABLE_CLI=OFF \ | |
-DCHIAKI_GUI_ENABLE_SDL_GAMECONTROLLER=ON \ | |
-DPYTHON_EXECUTABLE="${{ env.pythonLocation }}\python" \ | |
-DCMAKE_PREFIX_PATH="/usr/local/opt/[email protected];/usr/local/opt/ffmpeg@5;${{ env.Qt6_Dir }}" | |
- name: Build Chiaki | |
working-directory: chiaki-qt6 | |
env: | |
VERBOSE: 1 | |
run: | | |
cmake --build build --config Release --clean-first --target chiaki --parallel 4 | |
- name: Prepare Qt Deployment Package | |
working-directory: chiaki-qt6 | |
run: | | |
mkdir Chiaki-Mac-Qt6 | |
cp -a build/gui/chiaki.app Chiaki-Mac-Qt6 | |
macdeployqt Chiaki-Mac-Qt6/chiaki.app -dmg -verbose=3 | |
- name: Upload Chiaki Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Chiaki-Mac-Qt6-Release | |
path: chiaki-qt6/Chiaki-Mac-Qt6 | |
if-no-files-found: error | |
retention-days: 1 | |
build-win_x64: | |
name: Build Chiaki Windows x64 (VC) | |
runs-on: windows-2022 | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- name: Clean Workspace Action | |
uses: yumis-coconudge/clean-workspace-action@v1 | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
path: 'chiaki-qt6' | |
- name: Setup NASM | |
uses: ilammy/setup-nasm@v1 | |
- name: Setup ffmpeg | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n5.1-latest-win64-lgpl-shared-5.1.zip" -OutFile ".\ffmpeg-n5.1-latest-win64-lgpl-shared-5.1.zip" | |
Expand-Archive -LiteralPath "ffmpeg-n5.1-latest-win64-lgpl-shared-5.1.zip" -DestinationPath "." | |
Rename-Item "ffmpeg-n5.1-latest-win64-lgpl-shared-5.1" "ffmpeg" | |
Write-Output "${{ github.workspace }}\ffmpeg\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Setup protoc | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-win64.zip" -OutFile ".\protobuf.zip" | |
Expand-Archive -LiteralPath ".\protobuf.zip" -DestinationPath ".\protobuf" | |
Write-Output "${{ github.workspace }}\protobuf\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Setup OpenSSL | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -UseBasicParsing -Uri "https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1u.zip" -OutFile ".\openssl-1.1.1u.zip" | |
Expand-Archive -LiteralPath "openssl-1.1.1u.zip" -DestinationPath "." | |
Rename-Item "openssl-1.1" "openssl" | |
Write-Output "${{ github.workspace }}\openssl" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Setup SDL2 | |
run: | | |
$ProgressPreference = 'SilentlyContinue' | |
Invoke-WebRequest -UseBasicParsing -Uri "https://www.libsdl.org/release/SDL2-devel-2.28.1-VC.zip" -OutFile ".\SDL2-devel-2.28.1-VC.zip" | |
Expand-Archive -LiteralPath "SDL2-devel-2.28.1-VC.zip" -DestinationPath "." | |
Rename-Item "SDL2-2.28.1" "SDL2" | |
Write-Output "SDL2_DIR=${{ github.workspace }}\SDL2" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
Set-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'set(TARGET_NAME SDL2::SDL2)' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'add_library(${TARGET_NAME} SHARED IMPORTED)' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'set_target_properties(${TARGET_NAME} PROPERTIES' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' IMPORTED_LOCATION "${SDL2_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}"' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' INTERFACE_INCLUDE_DIRECTORIES "$ENV{SDL2_DIR}/include"' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' INTERFACE_LINK_LIBRARIES "$ENV{SDL2_DIR}/lib/x64/SDL2.lib;$ENV{SDL2_DIR}/lib/x64/SDL2main.lib"' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ' IMPORTED_LINK_INTERFACE_LANGUAGES "C"' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value ')' | |
Add-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" -Value 'set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_IMPLIB "$ENV{SDL2_DIR}/lib/x64/SDL2.lib")' | |
Get-Content -Path "${{ github.workspace }}\SDL2\sdl2-config.cmake" | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
architecture: "x64" | |
- name: Install Python Dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install --upgrade setuptools wheel | |
python3 -m pip install --user --upgrade scons protobuf grpcio-tools pyinstaller | |
python3 -c 'import google.protobuf; print(google.protobuf.__file__)' | |
# aqt list-qt windows desktop --modules 6.2.4 win64_msvc2019_64 | |
# debug_info qt3d qt5compat qtactiveqt qtcharts qtconnectivity qtdatavis3d | |
# qtimageformats qtlottie qtmultimedia qtnetworkauth qtpositioning qtquick3d | |
# qtquicktimeline qtremoteobjects qtscxml qtsensors qtserialbus qtserialport | |
# qtshadertools qtvirtualkeyboard qtwebchannel qtwebengine qtwebsockets qtwebview | |
- name: Setup Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: '6.5.1' | |
host: 'windows' | |
target: 'desktop' | |
arch: 'win64_msvc2019_64' | |
modules: 'qtmultimedia' | |
cache: true | |
- name: Setup MSVC | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: "x86_64" | |
toolset: "14" | |
- name: Configure & Build Opus | |
run: | | |
git clone https://github.com/xiph/opus.git | |
cd opus | |
mkdir build | |
cmake ` | |
-S . ` | |
-B build ` | |
-G "Visual Studio 17 2022" -A x64 ` | |
-DCMAKE_C_COMPILER=cl ` | |
-DCMAKE_BUILD_TYPE=Release ` | |
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}\opus-prefix" | |
cmake --build build --config Release | |
cmake --install build | |
- name: Configure Chiaki | |
working-directory: chiaki-qt6 | |
run: | | |
cmake ` | |
-S . ` | |
-B build ` | |
-G "Visual Studio 17 2022" -A x64 ` | |
-DCMAKE_C_COMPILER=cl ` | |
-DCMAKE_C_FLAGS="-we4013" ` | |
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE ` | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo ` | |
-DCHIAKI_ENABLE_CLI=OFF ` | |
-DCHIAKI_GUI_ENABLE_SDL_GAMECONTROLLER=ON ` | |
-DPYTHON_EXECUTABLE="${{ env.pythonLocation }}\python.exe" ` | |
-DCMAKE_PREFIX_PATH="${{ github.workspace }}\nanopb;${{ github.workspace }}\ffmpeg;${{ github.workspace }}\opus-prefix;${{ github.workspace }}\openssl\x64;${{ github.workspace }}\SDL2;${{ env.Qt6_Dir }}" | |
- name: Build Chiaki | |
working-directory: chiaki-qt6 | |
env: | |
VERBOSE: 1 | |
run: | | |
cmake --build build --config Release --clean-first --target chiaki --parallel 4 | |
- name: Prepare Qt Deployment Package | |
working-directory: chiaki-qt6 | |
run: | | |
mkdir Chiaki-Win-Qt6 | |
cp build\gui\Release\chiaki.exe Chiaki-Win-Qt6 | |
cp "${{ github.workspace }}\openssl\x64\bin\libcrypto-1_1-x64.dll" Chiaki-Win-Qt6 | |
cp "${{ github.workspace }}\openssl\x64\bin\libssl-1_1-x64.dll" Chiaki-Win-Qt6 | |
cp "${{ github.workspace }}\SDL2\lib\x64\SDL2.dll" Chiaki-Win-Qt6 | |
cp "${{ github.workspace }}\ffmpeg\bin\swresample-4.dll" Chiaki-Win-Qt6 | |
cp "${{ github.workspace }}\ffmpeg\bin\avcodec-59.dll" Chiaki-Win-Qt6 | |
cp "${{ github.workspace }}\ffmpeg\bin\avutil-57.dll" Chiaki-Win-Qt6 | |
windeployqt.exe --no-translations Chiaki-Win-Qt6\chiaki.exe | |
- name: Package Chiaki | |
working-directory: chiaki-qt6 | |
run: | | |
$CHIAKI_VERSION_MAJOR = (Select-String -Path .\CMakeLists.txt -Pattern 'set\(CHIAKI_VERSION_MAJOR ([0-9]+)\)') | %{$_.Matches.Groups[1].value} | |
$CHIAKI_VERSION_MINOR = (Select-String -Path .\CMakeLists.txt -Pattern 'set\(CHIAKI_VERSION_MINOR ([0-9]+)\)') | %{$_.Matches.Groups[1].value} | |
$CHIAKI_VERSION_PATCH = (Select-String -Path .\CMakeLists.txt -Pattern 'set\(CHIAKI_VERSION_PATCH ([0-9]+)\)') | %{$_.Matches.Groups[1].value} | |
$RELEASE_PACKAGE_FILE = "Chiaki-win_x64-VC-Qt6-$CHIAKI_VERSION_MAJOR.$CHIAKI_VERSION_MINOR.$CHIAKI_VERSION_PATCH.zip" | |
Compress-Archive Chiaki-Win-Qt6 $RELEASE_PACKAGE_FILE | |
$release_filepath = Get-ChildItem $RELEASE_PACKAGE_FILE | %{$_[0].FullName} | |
echo "RELEASE_PACKAGE_PATH=$release_filepath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Upload Chiaki Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Chiaki-win_x64-VC-Qt6-Release | |
path: ${{ env.RELEASE_PACKAGE_PATH }} | |
if-no-files-found: error | |
retention-days: 1 |