shun-iwasawa 9f7051
name: Windows Build
shun-iwasawa 9f7051
shun-iwasawa 9f7051
on: [push, pull_request]
shun-iwasawa 9f7051
shun-iwasawa 9f7051
jobs:
shun-iwasawa 9f7051
  Windows:
shun-iwasawa 9f7051
    runs-on: windows-2019
shun-iwasawa 9f7051
    env:
shun-iwasawa 505216
      vcpkg_ref: 14e7bb4ae24616ec54ff6b2f6ef4e8659434ea44
shun-iwasawa d80b54
      BOOST_ROOT: ${{github.workspace}}/3rdparty/boost
shun-iwasawa d80b54
      BOOST_URL: https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2/download
shun-iwasawa daf4cd
      QT_ROOT: ${{github.workspace}}/3rdparty/qt
shun-iwasawa daf4cd
      QT_URL: https://github.com/shun-iwasawa/qt5/releases/download/v5.15.2_wintab/Qt5.15.2_wintab.zip
shun-iwasawa 9f7051
    steps:
shun-iwasawa 9f7051
    - uses: actions/checkout@v2
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Checkout mypaint/libmypaint
shun-iwasawa 9f7051
      uses: actions/checkout@v2
shun-iwasawa 9f7051
      with:
shun-iwasawa 9f7051
        repository: 'mypaint/libmypaint'
shun-iwasawa 9f7051
        ref: '70f7686db792fa4953dc60f28a322bf2cd388ed7'
shun-iwasawa 9f7051
        path: 'libmypaint'
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Checkout xiaoyeli/superlu
shun-iwasawa 9f7051
      uses: actions/checkout@v2
shun-iwasawa 9f7051
      with:
shun-iwasawa 9f7051
        repository: 'xiaoyeli/superlu'
shun-iwasawa 9f7051
        ref: 'a3d5233770f0caad4bc4578b46d3b26af99e9c19'
shun-iwasawa 9f7051
        path: 'superlu'
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Install vcpkg
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        rm -r -fo C:/vcpkg
shun-iwasawa 9f7051
        cd C:/
shun-iwasawa 9f7051
        git clone https://github.com/Microsoft/vcpkg
shun-iwasawa 9f7051
        cd vcpkg
shun-iwasawa 9f7051
        git checkout "$env:vcpkg_ref"
shun-iwasawa 9f7051
        ./bootstrap-vcpkg.bat
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - uses: actions/cache@v1
shun-iwasawa 9f7051
      with:
shun-iwasawa 9f7051
       path: C:/vcpkg/installed
shun-iwasawa 9f7051
       key: ${{ runner.os }}-vcpkg-${{ env.vcpkg_ref }}-${{ github.sha }}
shun-iwasawa 9f7051
       restore-keys: ${{ runner.os }}-vcpkg-${{ env.vcpkg_ref }}-
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Install libraries
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        vcpkg install --clean-after-build --triplet x64-windows icu
shun-iwasawa 9f7051
        vcpkg install --clean-after-build --triplet x64-windows-static json-c libjpeg-turbo libpng lz4 lzo openblas zlib
shun-iwasawa a71118
        vcpkg install --clean-after-build --triplet x64-windows freeglut glew
shun-iwasawa a71118
        vcpkg install --clean-after-build --triplet x64-windows --recurse opencv[world]
shun-iwasawa 9f7051
        ls -Recurse C:/vcpkg/installed -Filter *.pdb | rm
shun-iwasawa 9f7051
shun-iwasawa c03042
    - name: Cache Qt
shun-iwasawa c03042
      id: cache-qt
shun-iwasawa daf4cd
      uses: actions/cache@v2
shun-iwasawa c03042
      with:
shun-iwasawa daf4cd
        path: ${{env.QT_ROOT}}
shun-iwasawa c03042
        key: ${{ runner.os }}-QtCache
shun-iwasawa c03042
shun-iwasawa c03042
    - name: Install Qt
shun-iwasawa daf4cd
      run: |
shun-iwasawa daf4cd
        # fix up paths to be forward slashes consistently
shun-iwasawa daf4cd
        QT_ROOT=$(echo $QT_ROOT | sed 's/\\/\//g')
shun-iwasawa daf4cd
        mkdir -p $QT_ROOT
shun-iwasawa daf4cd
        curl --progress-bar -L -o $QT_ROOT/Qt.zip $QT_URL
shun-iwasawa daf4cd
        7z -o$QT_ROOT x $QT_ROOT/Qt.zip -y -bd
shun-iwasawa daf4cd
        rm -f $QT_ROOT/Qt.zip
shun-iwasawa daf4cd
      shell: bash
shun-iwasawa c03042
shun-iwasawa d80b54
    - name: Restore Boost cache
shun-iwasawa d80b54
      uses: actions/cache@v2
shun-iwasawa d80b54
      id: cache-boost
shun-iwasawa d80b54
      with:
shun-iwasawa d80b54
        path: ${{env.BOOST_ROOT}}
shun-iwasawa d80b54
        key: boost
shun-iwasawa d80b54
shun-iwasawa d80b54
    - name: Install Boost
shun-iwasawa d80b54
      if: steps.cache-boost.outputs.cache-hit != 'true'
shun-iwasawa d80b54
      run: |
shun-iwasawa d80b54
        # fix up paths to be forward slashes consistently
shun-iwasawa d80b54
        BOOST_ROOT=$(echo $BOOST_ROOT | sed 's/\\/\//g')
shun-iwasawa d80b54
        mkdir -p $BOOST_ROOT
shun-iwasawa d80b54
        curl --progress-bar --location --output $BOOST_ROOT/download.tar.bz2 $BOOST_URL
shun-iwasawa d80b54
        7z -o$BOOST_ROOT x $BOOST_ROOT/download.tar.bz2 -y -bd
shun-iwasawa d80b54
        7z -o$BOOST_ROOT x $BOOST_ROOT/download.tar -y -bd
shun-iwasawa d80b54
        cd $BOOST_ROOT && cp -r boost_*/* .
shun-iwasawa d80b54
        rm -rf boost_*/* download.tar.bz2 download.tar
shun-iwasawa d80b54
      shell: bash
shun-iwasawa d80b54
      
shun-iwasawa 9a7c5b
    - name: Setup Python
shun-iwasawa 9a7c5b
      uses: actions/setup-python@v2
shun-iwasawa 9a7c5b
      with:
shun-iwasawa 9a7c5b
        python-version: '3.9.1'
shun-iwasawa 9a7c5b
shun-iwasawa 9f7051
    - name: Build libtiff
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd thirdparty/tiff-4.0.3
shun-iwasawa 9f7051
        cp libtiff/tif_config.vc.h libtiff/tif_config.h
shun-iwasawa 9f7051
        cp libtiff/tiffconf.vc.h libtiff/tiffconf.h
shun-iwasawa 9f7051
        cd prj/LibTIFF
shun-iwasawa 9f7051
        $env:Path += ';C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin'
shun-iwasawa 9f7051
        msbuild LibTIFF.vcxproj /p:PlatformToolset=v142 /p:Platform=x64 /p:Configuration=Release -maxcpucount:3
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Build mypaint/libmypaint
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd libmypaint
shun-iwasawa 9f7051
        cp ../.github/workflows/CMakeLists.txt .
shun-iwasawa 9f7051
        echo '#define MYPAINT_CONFIG_USE_GLIB 0' > config.h
shun-iwasawa 9f7051
        python generate.py mypaint-brush-settings-gen.h brushsettings-gen.h
shun-iwasawa 9f7051
        mkdir build | Out-Null
shun-iwasawa 9f7051
        cd build
shun-iwasawa 9f7051
        cmake ../ -G 'Visual Studio 16 2019' -Ax64 -Djson-c_DIR='C:/vcpkg/installed/x64-windows-static/share/json-c/' -DJSON-C_INCLUDE_DIR='C:/vcpkg/installed/x64-windows-static/include/json-c/'
shun-iwasawa 9f7051
        cmake --build . --config Release
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows-static/lib/json-c.lib .
shun-iwasawa 79ae28
        $env:Path += ';C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64'
shun-iwasawa 9f7051
        lib /OUT:libmypaint.lib Release/libmypaint.lib json-c.lib
shun-iwasawa 9f7051
        cp libmypaint.lib Release/libmypaint.lib
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Build xiaoyeli/superlu
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd superlu
shun-iwasawa 9f7051
        mkdir build | Out-Null
shun-iwasawa 9f7051
        cd build
shun-iwasawa 9f7051
        cmake ../ -G 'Visual Studio 16 2019' -Ax64 -DXSDK_ENABLE_Fortran=OFF -Denable_tests=OFF
shun-iwasawa 9f7051
        cmake --build . --config Release
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Workaround
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd thirdparty
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows-static/lib/libpng16.lib libpng-1.6.21/lib/libpng16_2015_64.lib
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows-static/lib/lz4.lib Lz4/Lz4_131/lz4_64.lib
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows-static/lib/lzo2.lib lzo/2.03/LZO_lib/lzo2_64.lib
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows-static/lib/openblas.lib openblas/libopenblas_64.lib
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows-static/lib/zlib.lib zlib-1.2.8/lib/zlib-1.2.8_2015_64.lib
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows/lib/freeglut.lib glut/3.7.6/lib/glut64.lib
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows/lib/glew32.lib glew/glew-1.9.0/lib/glew64.lib
shun-iwasawa 9f7051
        cp D:/a/opentoonz/opentoonz/libmypaint/build/Release/libmypaint.lib libmypaint/dist/64/libmypaint.lib
shun-iwasawa 9f7051
        cp D:/a/opentoonz/opentoonz/superlu/build/SRC/Release/superlu.lib superlu/SuperLU_2015_64.lib
shun-iwasawa 9f7051
        cp D:/a/opentoonz/opentoonz/thirdparty/tiff-4.0.3/prj/LibTIFF/x64/Release/LibTIFF.lib tiff-4.0.3/lib/LibTIFF-4.0.3_2015_64.lib
shun-iwasawa 82a8f5
        cp C:/vcpkg/installed/x64-windows-static/lib/turbojpeg.lib libjpeg-turbo/lib/turbojpeg-static_2015_64.lib
shun-iwasawa 82a8f5
        cp C:/vcpkg/installed/x64-windows-static/lib/jpeg.lib libjpeg-turbo/lib/jpeg-static_2015_64.lib
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Copy headers
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd thirdparty
shun-iwasawa 9f7051
        cp libpng-1.6.21/scripts/pnglibconf.h.prebuilt libpng-1.6.21/pnglibconf.h
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Build
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd toonz
shun-iwasawa 6bac0f
        mkdir build | Out-Null
shun-iwasawa 9f7051
        cd build
shun-iwasawa d80b54
        $env:BOOST_ROOT = '${{ env.BOOST_ROOT }}'
shun-iwasawa daf4cd
        $env:QT_PATH = '${{ env.QT_ROOT }}/Qt5.15.2_wintab/5.15.2_wintab/msvc2019_64'
shun-iwasawa daf4cd
        cmake ../sources -G 'Visual Studio 16 2019' -Ax64 -DQT_PATH="$env:QT_PATH" -DOpenCV_DIR='C:/vcpkg/installed/x64-windows/share/opencv' -DBOOST_ROOT="$env:BOOST_ROOT" -DWITH_WINTAB=ON
shun-iwasawa 9f7051
        cmake --build . --config Release
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Create Artifact
shun-iwasawa c03042
      env:
shun-iwasawa c03042
        VCINSTALLDIR: 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC'
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        mkdir artifact | Out-Null
shun-iwasawa 9f7051
        cd artifact
shun-iwasawa 9f7051
        cp -Recurse ../stuff portablestuff
shun-iwasawa 9f7051
        cp ../toonz/build/Release/* .
shun-iwasawa daf4cd
        ${{ env.QT_ROOT }}/Qt5.15.2_wintab/5.15.2_wintab/msvc2019_64/bin/windeployqt.exe OpenToonz.exe
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows/bin/freeglut.dll .
shun-iwasawa 9f7051
        cp C:/vcpkg/installed/x64-windows/bin/glew32.dll .
shun-iwasawa a71118
        cp C:/vcpkg/installed/x64-windows/bin/opencv_world.dll .
shun-iwasawa a71118
        cp C:/vcpkg/installed/x64-windows/bin/zlib1.dll .
shun-iwasawa a71118
        cp C:/vcpkg/installed/x64-windows/bin/webp.dll .
shun-iwasawa a71118
        cp C:/vcpkg/installed/x64-windows/bin/libpng16.dll .
shun-iwasawa a71118
        cp C:/vcpkg/installed/x64-windows/bin/jpeg62.dll .
shun-iwasawa a71118
        cp C:/vcpkg/installed/x64-windows/bin/tiff.dll .
shun-iwasawa 505216
        cp C:/vcpkg/installed/x64-windows/bin/liblzma.dll .
shun-iwasawa a71118
        cp C:/vcpkg/installed/x64-windows/bin/libprotobuf.dll .
shun-iwasawa 505216
        cp C:/vcpkg/installed/x64-windows/bin/webpdecoder.dll .
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - uses: actions/upload-artifact@v1
shun-iwasawa 9f7051
      with:
shun-iwasawa 9f7051
        name: Opentoonz-${{ runner.os }}-${{ github.sha }}
shun-iwasawa 9f7051
        path: artifact