shun-iwasawa 9f7051
name: MacOS Build
shun-iwasawa 9f7051
shun-iwasawa 9f7051
on: [push, pull_request]
shun-iwasawa 9f7051
shun-iwasawa 9f7051
jobs:
shun-iwasawa 9f7051
  macOS:
shun-iwasawa 9f7051
    runs-on: macos-latest
shun-iwasawa 9f7051
    steps:
shun-iwasawa 9f7051
    - uses: actions/checkout@v2
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Install libraries
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        checkPkgAndInstall()
shun-iwasawa 9f7051
        {
shun-iwasawa 9f7051
          while [ $# -ne 0 ]
shun-iwasawa 9f7051
          do
shun-iwasawa 258c6e
            rm -f '/usr/local/bin/2to3'
shun-iwasawa 9f7051
            if brew ls --versions $1 ; then
shun-iwasawa 9f7051
              brew upgrade $1
shun-iwasawa 9f7051
            else
shun-iwasawa 9f7051
              brew install $1
shun-iwasawa 9f7051
            fi
shun-iwasawa 9f7051
            shift
shun-iwasawa 9f7051
          done
shun-iwasawa 9f7051
        }
shun-iwasawa 9f7051
        brew update
shun-iwasawa 31accf
        checkPkgAndInstall pkg-config glew lz4 libjpeg libpng lzo qt boost libusb libmypaint ccache jpeg-turbo ninja
shun-iwasawa 31accf
        brew unlink gcc@8
shun-iwasawa 31accf
        brew unlink gcc@9
shun-iwasawa 31accf
        checkPkgAndInstall opencv
shun-iwasawa 31accf
        
shun-iwasawa 9f7051
    - uses: actions/cache@v1
shun-iwasawa 9f7051
      with:
shun-iwasawa 9f7051
        path: /Users/runner/.ccache
shun-iwasawa 9f7051
        key: ${{ runner.os }}-${{ github.sha }}
shun-iwasawa 9f7051
        restore-keys: ${{ runner.os }}-
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Build libtiff
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        export PATH="/usr/local/opt/ccache/libexec:$PATH"
shun-iwasawa 9f7051
        cd thirdparty/tiff-4.0.3
shun-iwasawa 9f7051
        CFLAGS='-fPIC' CXXFLAGS='-fPIC' ./configure --disable-lzma
shun-iwasawa 9f7051
        make -j $(nproc)
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Build
shun-iwasawa 9f7051
      run: |
shun-iwasawa 31accf
        export PKG_CONFIG_PATH="/usr/local/opt/jpeg-turbo/lib/pkgconfig:$PKG_CONFIG_PATH"
shun-iwasawa 9f7051
        cd toonz
shun-iwasawa 9f7051
        mkdir build
shun-iwasawa 9f7051
        cd build
shun-iwasawa ed0e4e
        cmake ../sources -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQT_PATH='/usr/local/opt/qt/lib' -DWITH_TRANSLATION=OFF
shun-iwasawa 9f7051
        ninja -w dupbuild=warn
shun-iwasawa 9f7051
shun-iwasawa 9f7051
    - name: Create Artifact
shun-iwasawa 9f7051
      run: |
shun-iwasawa 9f7051
        cd toonz/build/toonz
shun-iwasawa 9f7051
        cp -pr ../../../stuff OpenToonz.app/portablestuff
shun-iwasawa 9f7051
        /usr/local/opt/qt/bin/macdeployqt OpenToonz.app -dmg -verbose=1 -always-overwrite \
shun-iwasawa 9f7051
        -executable=OpenToonz.app/Contents/MacOS/lzocompress \
shun-iwasawa 9f7051
        -executable=OpenToonz.app/Contents/MacOS/lzodecompress \
shun-iwasawa 9f7051
        -executable=OpenToonz.app/Contents/MacOS/tcleanup \
shun-iwasawa 9f7051
        -executable=OpenToonz.app/Contents/MacOS/tcomposer \
shun-iwasawa 9f7051
        -executable=OpenToonz.app/Contents/MacOS/tconverter \
shun-iwasawa 9f7051
        -executable=OpenToonz.app/Contents/MacOS/tfarmcontroller \
shun-iwasawa 9f7051
        -executable=OpenToonz.app/Contents/MacOS/tfarmserver
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: toonz/build/toonz/OpenToonz.dmg