Skip to content

Commit 7d1c791

Browse files
authored
Windows: Add FFmpeg build job (#752)
1 parent e2dc28d commit 7d1c791

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

.github/workflows/build_ffmpeg.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,25 @@ jobs:
7070
artifact_dir="${RUNNER_ARTIFACT_DIR}/$(date +%Y-%m-%d)/macos_$(uname -m)"
7171
mkdir -p "${artifact_dir}"
7272
mv ffmpeg.tar.gz "${artifact_dir}/${FFMPEG_VERSION}.tar.gz"
73+
74+
LGPL-Windows:
75+
strategy:
76+
fail-fast: false
77+
matrix:
78+
ffmpeg-version: ["4.4.4", "5.1.4", "6.1.1", "7.0.1"]
79+
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
80+
with:
81+
job-name: Build
82+
upload-artifact: ffmpeg-lgpl-windows_x86_64-${{ matrix.ffmpeg-version }}
83+
repository: pytorch/torchcodec
84+
script: |
85+
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
86+
export FFMPEG_ROOT="${PWD}/ffmpeg"
87+
88+
packaging/build_ffmpeg.bat
89+
90+
tar -cf ffmpeg.tar.gz ffmpeg/include ffmpeg/bin
91+
92+
artifact_dir="${RUNNER_ARTIFACT_DIR}/$(date +%Y-%m-%d)/windows_$(uname -m)"
93+
mkdir -p "${artifact_dir}"
94+
mv ffmpeg.tar.gz "${artifact_dir}/${FFMPEG_VERSION}.tar.gz"

packaging/build_ffmpeg.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:: Taken from torchaudio
2+
@echo off
3+
4+
set PROJ_FOLDER=%cd%
5+
6+
choco install -y --no-progress msys2 --package-parameters "/NoUpdate"
7+
C:\tools\msys64\usr\bin\env MSYSTEM=MINGW64 /bin/bash -l -c "pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain diffutils"
8+
C:\tools\msys64\usr\bin\env MSYSTEM=MINGW64 /bin/bash -l -c "cd ${PROJ_FOLDER} && packaging/vc_env_helper.bat bash packaging/build_ffmpeg.sh"
9+
10+
:end

packaging/vc_env_helper.bat

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
:: Taken from torchaudio
2+
@echo on
3+
4+
set VC_VERSION_LOWER=17
5+
set VC_VERSION_UPPER=18
6+
7+
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
8+
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
9+
set "VS15INSTALLDIR=%%i"
10+
set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat"
11+
goto vswhere
12+
)
13+
)
14+
15+
:vswhere
16+
if "%VSDEVCMD_ARGS%" == "" (
17+
call "%VS15VCVARSALL%" x64 || exit /b 1
18+
) else (
19+
call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% || exit /b 1
20+
)
21+
22+
@echo on
23+
24+
if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
25+
26+
set DISTUTILS_USE_SDK=1
27+
28+
set args=%1
29+
shift
30+
:start
31+
if [%1] == [] goto done
32+
set args=%args% %1
33+
shift
34+
goto start
35+
36+
:done
37+
if "%args%" == "" (
38+
echo Usage: vc_env_helper.bat [command] [args]
39+
echo e.g. vc_env_helper.bat cl /c test.cpp
40+
)
41+
42+
%args% || exit /b 1

0 commit comments

Comments
 (0)