diff --git a/.ci/mxe.sh b/.ci/mxe.sh new file mode 100755 index 000000000..2aa2ccfa9 --- /dev/null +++ b/.ci/mxe.sh @@ -0,0 +1,26 @@ +#!/bin/bash -ex + +# TODO: Why doesn't the CI environment use the PATH set in the Dockerimage? +# It works fine when using the image locally. +export PATH="/mxe/usr/bin:${PATH}" + +mkdir build && cd build + +if [ "$GITHUB_REF_TYPE" == "tag" ]; then + export EXTRA_CMAKE_FLAGS=(-DENABLE_QT_UPDATE_CHECKER=ON) +fi + +x86_64-w64-mingw32.shared-cmake .. \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DENABLE_QT_TRANSLATION=ON \ + -DUSE_DISCORD_PRESENCE=ON \ + -DUSE_SYSTEM_BOOST=ON \ + -DUSE_SYSTEM_CRYPTOPP=ON \ + "${EXTRA_CMAKE_FLAGS[@]}" +x86_64-w64-mingw32.shared-cmake --build . -- -j$(nproc) +x86_64-w64-mingw32.shared-strip -s bin/Release/*.exe +make bundle + +ccache -s -v diff --git a/.ci/pack.sh b/.ci/pack.sh index 1a6356e11..71c2339b4 100755 --- a/.ci/pack.sh +++ b/.ci/pack.sh @@ -36,10 +36,10 @@ function pack_artifacts() { fi # Create .zip/.tar.gz - if [ "$OS" = "windows" ]; then + if [ "$OS" = "windows" ] && [ "$TARGET" != "mxe" ]; then ARCHIVE_FULL_NAME="$ARCHIVE_NAME.zip" powershell Compress-Archive "$REV_NAME" "$ARCHIVE_FULL_NAME" - elif [ "$OS" = "android" ] || [ "$OS" = "macos" ]; then + elif [ "$OS" = "android" ] || [ "$OS" = "macos" ] || [ "$TARGET" = "mxe" ]; then ARCHIVE_FULL_NAME="$ARCHIVE_NAME.zip" zip -r "$ARCHIVE_FULL_NAME" "$REV_NAME" else diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0201aa3b0..70a8417f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -143,11 +143,21 @@ jobs: path: artifacts/ windows: - runs-on: windows-latest strategy: fail-fast: false matrix: - target: ["msvc", "msys2"] + include: + - target: msvc + os: windows-latest + - target: msys2 + os: windows-latest + - target: mxe + os: ubuntu-latest + container: + image: opensauce04/azahar-build-environment:latest + options: -u 1001 + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} defaults: run: shell: ${{ (matrix.target == 'msys2' && 'msys2') || 'bash' }} {0} @@ -195,23 +205,35 @@ jobs: with: args: install ptime wget - name: Install NSIS - if: ${{ github.ref_type == 'tag' }} + if: ${{ github.ref_type == 'tag' && matrix.target != 'mxe' }} run: | wget https://download.sourceforge.net/project/nsis/NSIS%203/3.11/nsis-3.11-setup.exe -O D:/a/_temp/nsis-setup.exe ptime D:/a/_temp/nsis-setup.exe /S shell: pwsh - name: Disable line ending translation run: git config --global core.autocrlf input - - name: Build + - name: Build (Native) + if: ${{ matrix.target != 'mxe' }} run: ./.ci/windows.sh - - name: Generate installer - if: ${{ github.ref_type == 'tag' }} + - name: Build (MXE) + if: ${{ matrix.target == 'mxe' }} + run: ./.ci/mxe.sh + - name: Generate installer (Native) + if: ${{ github.ref_type == 'tag' && matrix.target != 'mxe' }} run: | cd src\installer "C:\Program Files (x86)\NSIS\makensis.exe" /DPRODUCT_VARIANT=${{ matrix.target }} /DPRODUCT_VERSION=${{ github.ref_name }} citra.nsi mkdir ..\..\artifacts 2> NUL move /y *.exe ..\..\artifacts\ shell: cmd + - name: Generate installer (MXE) + if: ${{ github.ref_type == 'tag' && matrix.target == 'mxe' }} + run: | + export PATH="/mxe/usr/bin:${PATH}" # TODO: Why do we have to do this if it's in the image? + cd src/installer + x86_64-w64-mingw32.shared-makensis -DPRODUCT_VARIANT=${{ matrix.target }} -DPRODUCT_VERSION=${{ github.ref_name }} citra.nsi + mkdir -p ../../artifacts + mv ./*.exe ../../artifacts/ - name: Pack run: ./.ci/pack.sh - name: Upload