name: libx265 on: workflow_call: inputs: env: type: string required: true default: 'windows-2022' description: 'Environment' config: type: string required: true default: 'debug' description: 'Configuration' env: vsPath: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\ cFlags: ${{ inputs.config == 'release' && '-MD' || '-MDd' }} msbuildConfig: ${{ inputs.config == 'release' && 'Release' || 'Debug' }} jobs: libx265-12: runs-on: ${{ inputs.env }} steps: - name: Checkout X265 shell: cmd run: | git config --global core.autocrlf false git config --global core.eol lf git clone -b Release_3.5 https://github.com/videolan/x265.git x265 - name: Check cache id: libx26512-cache uses: actions/cache@v3 with: path: dist key: libx265-12-${{ inputs.env }}-${{ inputs.config }}-${{ hashFiles('x265') }} - name: Set up MSBuild if: steps.libx26512-cache.outputs.cache-hit != 'true' uses: microsoft/setup-msbuild@v1.1 - name: Set up NASM if: steps.libx26512-cache.outputs.cache-hit != 'true' uses: ilammy/setup-nasm@v1.2.1 - name: Build X265 (12 bit) if: steps.libx26512-cache.outputs.cache-hit != 'true' 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 -DMAIN12=ON MSBuild.exe /property:Configuration="${{ env.msbuildConfig }}" x265-static.vcxproj move ${{ inputs.config }}\x265-static.lib ..\..\..\..\dist\x265_12bit.lib - name: Publish artifact uses: actions/upload-artifact@v2 with: name: x265_12bit-${{ inputs.env }}-${{ inputs.config }} path: dist/x265_12bit.lib libx265-10: runs-on: ${{ inputs.env }} steps: - name: Checkout X265 shell: cmd run: | git config --global core.autocrlf false git config --global core.eol lf git clone -b Release_3.5 https://github.com/videolan/x265.git x265 - name: Check cache id: libx26510-cache uses: actions/cache@v3 with: path: dist key: libx265-10-${{ inputs.env }}-${{ inputs.config }}-${{ hashFiles('x265') }} - name: Set up MSBuild if: steps.libx26510-cache.outputs.cache-hit != 'true' uses: microsoft/setup-msbuild@v1.1 - name: Set up NASM if: steps.libx26510-cache.outputs.cache-hit != 'true' uses: ilammy/setup-nasm@v1.2.1 - name: Build X265 (10 bit) if: steps.libx26510-cache.outputs.cache-hit != 'true' 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-${{ inputs.env }}-${{ inputs.config }} path: dist/x265_10bit.lib libx265: runs-on: ${{ inputs.env }} needs: [libx265-12,libx265-10] steps: - name: Checkout X265 shell: cmd run: | git config --global core.autocrlf false git config --global core.eol lf git clone -b Release_3.5 https://github.com/videolan/x265.git x265 - name: Check cache id: libx265-cache uses: actions/cache@v3 with: path: di key: libx265-${{ inputs.env }}-${{ inputs.config }}-${{ hashFiles('x265') }} - name: Set up MSYS2 if: steps.libx265-cache.outputs.cache-hit != 'true' uses: msys2/setup-msys2@v2 with: install: base-devel binutils autotools automake path-type: inherit - name: Set up MSBuild if: steps.libx265-cache.outputs.cache-hit != 'true' uses: microsoft/setup-msbuild@v1.1 - name: Set up NASM if: steps.libx265-cache.outputs.cache-hit != 'true' uses: ilammy/setup-nasm@v1.2.1 - name: Set up dependant libs if: steps.libx265-cache.outputs.cache-hit != 'true' uses: actions/download-artifact@v3 with: path: build - name: Build X265 if: steps.libx265-cache.outputs.cache-hit != 'true' shell: cmd run: | call "${{ env.vsPath }}VC\Auxiliary\Build\vcvars64.bat" md di dist dist\include dist\lib dist\lib\pkgconfig cd x265/build/vc15-x86_64 md work cd work cmake -G "Visual Studio 17 2022" ..\..\..\source -DCMAKE_INSTALL_PREFIX=..\..\..\..\build -DENABLE_SHARED=OFF -DENABLE_CLI=OFF -DEXTRA_LIB="libx265_10bit.lib;libx265_12bit.lib" -DLINKED_10BIT=ON -DLINKED_12BIT=ON MSBuild.exe /property:Configuration="${{ env.msbuildConfig }}" x265-static.vcxproj cp x265.pc ..\..\..\..\dist\lib\pkgconfig\x265.pc move ${{ inputs.config }}\x265-static.lib ..\..\..\..\build\ move x265_config.h ..\..\..\..\dist\include\ cd ..\..\..\.. "${{ env.vsPath }}VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64\lib.exe" /ignore:4006 /ignore:4221 /OUT:dist\lib\x265.lib build\x265-static.lib build\x265_10bit-${{ inputs.env }}-${{ inputs.config }}\x265_10bit.lib build\x265_12bit-${{ inputs.env }}-${{ inputs.config }}\x265_12bit.lib copy x265\source\x265.h dist\include\ D:\a\_temp\setup-msys2\msys2.cmd -c 'cd dist ; tar czf ../di/libx265.tgz *' - name: Publish artifact uses: actions/upload-artifact@v2 with: name: libx265-${{ inputs.env }}-${{ inputs.config }} path: di/libx265.tgz