aboutsummaryrefslogblamecommitdiff
path: root/.github/workflows/windows-msys2.yml
blob: 56f12e0de5af3df80710eb9abb755cc00ab58008 (plain) (tree)



















                                                                                             
                                                                                                                                                                                














                                                                                     







                                 
                               


                                                            
                                                                                                                                         







                                                                                 
                                                                  

                          






                                                                                                                                                           

                
                                                 


                                                                 
                                                   



                                              
name: Windows MSYS2 Build
on: [push, pull_request]

jobs:
  build:
    runs-on: windows-latest
    defaults:
      run:
        shell: msys2 {0}
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - uses: msys2/setup-msys2@v2
        with:
          msystem: MINGW64
          update: true
          install: >-
            git mingw-w64-x86_64-toolchain mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake tree
            mingw-w64-x86_64-qt5
            mingw-w64-x86_64-glfw mingw-w64-x86_64-glew mingw-w64-x86_64-freetype mingw-w64-x86_64-devil mingw-w64-x86_64-freeglut mingw-w64-x86_64-zlib mingw-w64-x86_64-rtmidi
      - name: Build fluidsynth-sans-glib
        id: build-fluidsynth-sans-glib
        continue-on-error: true
        run: |
          # no longer need mingw-w64-x86_64-fluidsynth and libglib-2.0-0.dll then.
          mkdir dept_workspace && cd dept_workspace
          git clone --depth=1 https://github.com/chirs241097/fluidsynth-sans-glib.git
          cd fluidsynth-sans-glib && mkdir build && cd build
          cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=$MINGW_PREFIX
          cmake --build . --target install
          cd ../../../
      - name: Install mingw-w64-x86_64-fluidsynth if needed
        if: steps.build-fluidsynth-sans-glib.outcome == 'failure'
        run: |
          pacman --noconfirm -S mingw-w64-x86_64-fluidsynth
      - name: Build qmidiplayer
        run: |
          mkdir build && cd build
          cmake .. -G Ninja
          cmake --build .
          tree
          cd ..
      - name: package qmidiplayer
        continue-on-error: true
        run: |
          mkdir package_workspace && cd package_workspace
          cp ../build/qmidiplayer-desktop/qmidiplayer.exe ./
          windeployqt -winextras --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler ./qmidiplayer.exe
          # standalone visualization renderer
          cp ../build/visualization/renderer/qmpvisrender.exe ./
          # copy plugins
          mkdir plugins
          cp ../build/midifmt-plugin/libmidifmt-plugin.dll ./plugins/
          cp ../build/simple-visualization/libsimple-visualization.dll ./plugins/
          cp ../build/visualization/libvisualization.dll ./plugins/
          cp ../build/sample-plugin/libsampleplugin.dll ./plugins/
          cp ../build/windows-extra/libwindowsextra.dll ./plugins/
          # license file
          cp ../COPYING ./
          # dependencies
          ldd ./qmidiplayer.exe > deps-qmidiplayer.txt
          ldd ./plugins/libvisualization.dll > deps-libvisualization.txt
          bash -c 'while read -r line; do path=$(cut -d" " -f3 <<<$line); cp -v $path ./; done <<<$(grep ".*mingw.*bin" deps-qmidiplayer.txt); exit 0'
          bash -c 'while read -r line; do path=$(cut -d" " -f3 <<<$line); cp -v $path ./; done <<<$(grep ".*mingw.*bin" deps-libvisualization.txt); exit 0'
          rm deps-qmidiplayer.txt
          rm deps-libvisualization.txt
          # done
          cd ../
      - name: install libglib-2.0-*.dll if needed
        if: steps.build-fluidsynth-sans-glib.outcome == 'failure'
        run: |
          cd package_workspace
          cp $MINGW_PREFIX/bin/libglib-2.0-*.dll ./
      - uses: actions/upload-artifact@v2
        with:
          name: msys2-mingw-w64-x86_64-windows
          path: package_workspace/*