name: libx265-10

inputs:
  refId:
    type: string
    required: true
  config:
    type: string
    required: true

runs:
  using: "composite"
  steps:
  - name: Checkout X265
    shell: cmd
    run: |
      git config --global core.autocrlf false
      git config --global core.eol lf
      git clone -b ${{ inputs.refId }} https://github.com/videolan/x265.git x265
  - name: Set up MSBuild
    uses: microsoft/setup-msbuild@v1.1
  - name: Set up NASM
    uses: ilammy/setup-nasm@v1.2.1
  - name: Build X265 (10 bit)
    shell: cmd
    run: |
      call "${{ env.vsPath }}VC\Auxiliary\Build\vcvars64.bat"
      md build dist
      cd x265/build/vc15-x86_64
      md work
      cd work
      cmake -G "Visual Studio 17 2022" ..\..\..\source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=OFF -DENABLE_SHARED=OFF -DENABLE_CLI=OFF
      MSBuild.exe /property:Configuration="${{ env.msbuildConfig }}" x265-static.vcxproj
      move ${{ inputs.config }}\x265-static.lib ..\..\..\..\dist\x265_10bit.lib
  - name: Publish artifact
    uses: actions/upload-artifact@v2
    with:
      name: x265_10bit-${{ runner.os }}-${{ inputs.config }}
      path: dist/x265_10bit.lib
