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 9f7051
      vcpkg_ref: 1d8728ae1ba66ad94b344708cf8d0ace1a6330b8
shun-iwasawa 9f7051
      CLCACHE_CL: 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl_original.exe'
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 31accf
        vcpkg install --clean-after-build --triplet x64-windows freeglut glew opencv
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 c03042
      uses: actions/cache@v1
shun-iwasawa c03042
      with:
shun-iwasawa c03042
        path: ../Qt
shun-iwasawa c03042
        key: ${{ runner.os }}-QtCache
shun-iwasawa c03042
shun-iwasawa c03042
    - name: Install Qt
shun-iwasawa c03042
      uses: jurplel/install-qt-action@v2
shun-iwasawa c03042
      with:
shun-iwasawa 9a7c5b
        version: '5.15.2'
shun-iwasawa c03042
        cached: ${{ steps.cache-qt.outputs.cache-hit }}
shun-iwasawa c03042
        modules: 'qtscript'
shun-iwasawa c03042
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: Install clcache
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        pip install clcache
shun-iwasawa 9f7051
        Rename-Item -Path 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe' -NewName 'cl_original.exe'
shun-iwasawa 9f7051
        Rename-Item -Path 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe.config' -NewName 'cl_original.exe.config'
shun-iwasawa 9a7c5b
        cp 'C:/hostedtoolcache/windows/Python/3.9.1/x64/Scripts/clcache.exe' 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe'
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - uses: actions/cache@v1
shun-iwasawa 9f7051
      with:
shun-iwasawa 9f7051
       path: C:/Users/runneradmin/clcache
shun-iwasawa 9f7051
       key: ${{ runner.os }}-clcache-${{ github.sha }}
shun-iwasawa 9f7051
       restore-keys: ${{ runner.os }}-clcache-
shun-iwasawa 9f7051
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
        $env:CLCACHE_CL = '${{ env.CLCACHE_CL }}'
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
        $env:CLCACHE_CL = '${{ env.CLCACHE_CL }}'
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 9f7051
        $env:Path += ';C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29333/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
        $env:CLCACHE_CL = '${{ env.CLCACHE_CL }}'
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/jpeg.lib LibJPEG/jpeg-9/lib/LibJPEG-9_2015_64.lib
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 31accf
        mkdir libjpeg-turbo64/lib
shun-iwasawa 31accf
        cp C:/vcpkg/installed/x64-windows-static/lib/turbojpeg.lib libjpeg-turbo64/lib/turbojpeg.lib
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Copy headers
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd thirdparty
shun-iwasawa 9f7051
        cp LibJPEG/jpeg-9/jconfig.vc LibJPEG/jpeg-9/jconfig.h
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 9f7051
        $env:CLCACHE_CL = '${{ env.CLCACHE_CL }}'
shun-iwasawa 31accf
        cmake ../sources -G 'Visual Studio 16 2019' -Ax64 -DQT_PATH='D:/a/opentoonz/Qt/5.15.2/msvc2019_64' -DOpenCV_DIR='C:/vcpkg/installed/x64-windows/share/opencv' -DBOOST_ROOT="$env:BOOST_ROOT_1_72_0"
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 c03042
        D:/a/opentoonz/Qt/5.15.2/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 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