Skip to content

Commit

Permalink
Allow the FFMPEG raw libraries to be built for Windows 7 desktop using
Browse files Browse the repository at this point in the history
the build scripts.
  • Loading branch information
markslwong committed Feb 2, 2017
1 parent 6f8062f commit 0d6f008
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 4 deletions.
53 changes: 49 additions & 4 deletions BuildFFmpeg.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if "%~1" == "" goto Usage
set BUILD.ARM=N
set BUILD.x86=N
set BUILD.x64=N
set BUILD.win7=N
set BUILD.win10=N
set BUILD.win8.1=N
set BUILD.phone8.1=N
Expand All @@ -23,6 +24,8 @@ for %%a in (%*) do (
set BUILD.x86=Y
) else if /I "%%a"=="x64" (
set BUILD.x64=Y
) else if /I "%%a"=="win7" (
set BUILD.win7=Y
) else if /I "%%a"=="win10" (
set BUILD.win10=Y
) else if /I "%%a"=="win8.1" (
Expand All @@ -49,7 +52,9 @@ if %BUILD.ARM%==N (
if %BUILD.win10%==N (
if %BUILD.win8.1%==N (
if %BUILD.phone8.1%==N (
goto Usage
if %BUILD.win7%==N (
goto Usage
)
)
)
)
Expand Down Expand Up @@ -185,7 +190,7 @@ endlocal

:: Build and deploy Windows Phone 8.1 library
:Phone8.1
if %BUILD.phone8.1%==N goto Cleanup
if %BUILD.phone8.1%==N goto Win7

:: Check for required tools
if not defined VS120COMNTOOLS (
Expand All @@ -209,7 +214,7 @@ set INCLUDE=%VSINSTALLDIR%VC\include;%VSINSTALLDIR%VC\atlmfc\include;%WindowsSdk
endlocal

:Phone8.1x86
if %BUILD.x86%==N goto Cleanup
if %BUILD.x86%==N goto Win7
echo Building FFmpeg for Windows Phone 8.1 apps x86...
echo:

Expand All @@ -222,6 +227,45 @@ set INCLUDE=%VSINSTALLDIR%VC\INCLUDE;%VSINSTALLDIR%VC\ATLMFC\INCLUDE;%WindowsSdk
%MSYS2_BIN% --login -x %~dp0FFmpegConfig.sh Phone8.1 x86
endlocal

:: Build and deploy Windows 7 library
:Win7
if %BUILD.win7%==N goto Cleanup

:: Check for required tools
if not defined VS120COMNTOOLS (
echo:
echo VS120COMNTOOLS environment variable is not found. Check your Visual Studio 2013 installation
goto Cleanup
)

:Win7x86
if %BUILD.x86%==N goto Win7x64
echo Building FFmpeg for Windows 7 desktop x86...
echo:

setlocal
call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" x86
set LIB=%VSINSTALLDIR%VC\lib;%VSINSTALLDIR%VC\atlmfc\lib;%WindowsSdkDir%lib\winv6.3\um\x86;
set LIBPATH=%WindowsSdkDir%References\CommonConfiguration\Neutral;%VSINSTALLDIR%VC\lib;
set INCLUDE=%VSINSTALLDIR%VC\include;%WindowsSdkDir%Include\um;%WindowsSdkDir%Include\shared;

%MSYS2_BIN% --login -x %~dp0FFmpegConfig.sh Win7 x86
endlocal

:Win7x64
if %BUILD.x64%==N goto Cleanup
echo Building FFmpeg for Windows 7 desktop x64...
echo:

setlocal
call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" x64
set LIB=%VSINSTALLDIR%VC\lib\amd64;%VSINSTALLDIR%VC\atlmfc\lib\amd64;%WindowsSdkDir%lib\winv6.3\um\x64;
set LIBPATH=%WindowsSdkDir%References\CommonConfiguration\Neutral;%VSINSTALLDIR%VC\lib\amd64;
set INCLUDE=%VSINSTALLDIR%VC\include;%WindowsSdkDir%Include\um;%WindowsSdkDir%Include\shared;

%MSYS2_BIN% --login -x %~dp0FFmpegConfig.sh Win7 x64
endlocal

goto Cleanup

:: Display help message
Expand All @@ -232,13 +276,14 @@ echo %0 [target platform] [architecture]
echo:
echo where
echo:
echo [target platform] is: win10 ^| win8.1 ^| phone8.1 (at least one)
echo [target platform] is: win10 ^| win8.1 ^| phone8.1 ^| win7 (at least one)
echo [architecture] is: x86 ^| x64 ^| ARM (optional)
echo:
echo For example:
echo %0 win10 - Build for Windows 10 ARM, x64, and x86
echo %0 phone8.1 ARM - Build for Windows Phone 8.1 ARM only
echo %0 win8.1 x86 x64 - Build for Windows 8.1 x86 and x64 only
echo %0 win7 x86 x64 - Build for Windows 7 x86 and x64 only
echo %0 phone8.1 win10 ARM - Build for Windows 10 and Windows Phone 8.1 ARM only
echo %0 win8.1 phone8.1 win10 - Build all architecture for all target platform
goto :eof
Expand Down
47 changes: 47 additions & 0 deletions FFmpegConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,53 @@ elif [ "$1" == "Phone8.1" ]; then
popd

fi

elif [ "$1" == "Win7" ]; then
echo "Make Win7"

if [ "$2" == "x86" ]; then
echo "Make Win7 x86"
pushd $DIR/ffmpeg
rm -rf Output/Windows7/x86
mkdir -p Output/Windows7/x86
cd Output/Windows7/x86
../../../configure \
--toolchain=msvc \
--disable-programs \
--disable-d3d11va \
--disable-dxva2 \
--arch=x86 \
--enable-shared \
--enable-cross-compile \
--target-os=win32 \
--extra-cflags="-MD -D_WINDLL" \
--extra-ldflags="-APPCONTAINER:NO -MACHINE:x86" \
--prefix=../../../Build/Windows7/x86
make install
popd

elif [ "$2" == "x64" ]; then
echo "Make Win7 x64"
pushd $DIR/ffmpeg
rm -rf Output/Windows7/x64
mkdir -p Output/Windows7/x64
cd Output/Windows7/x64
../../../configure \
--toolchain=msvc \
--disable-programs \
--disable-d3d11va \
--disable-dxva2 \
--arch=amd64 \
--enable-shared \
--enable-cross-compile \
--target-os=win32 \
--extra-cflags="-MD -D_WINDLL" \
--extra-ldflags="-APPCONTAINER:NO -MACHINE:x64" \
--prefix=../../../Build/Windows7/x64
make install
popd

fi
fi

exit 0

0 comments on commit 0d6f008

Please sign in to comment.