Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build possibility on windows #6

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions install.bat → !1_install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ set "Extract-->=%AV1%\7zr.exe -y x"
:: Correct path
cd "%AV1%"

echo Installing
echo ────────────
echo ----------
echo Installing
echo ----------
:: Create directories if they don't exist
for %%d in (
".\dependencies\av1an"
Expand All @@ -33,6 +34,9 @@ for %%d in (
".\dependencies\rav1e"
".\dependencies\x264"
".\dependencies\x265"
".\dependencies\nasm"
".\dependencies\git"
".\dependencies\clang"
".\scripts\ffmpeg\input"
".\scripts\ffmpeg\input\completed-inputs"
".\scripts\ffmpeg\output"
Expand Down Expand Up @@ -70,14 +74,8 @@ cd .\ffmpeg-6.1.1

:: Download ffmpeg with shared libaries ~6.1.1
%Download-->% https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z -O ffmpeg-release-full-shared.7z
%Extract-->% .\ffmpeg-release-full-shared.7z ffmpeg-6.1.1-full_build-shared\bin > nul

:: Move contents of bin
for /R "ffmpeg-6.1.1-full_build-shared\bin" %%f in (*) do (
move "%%f" "%destination%" > nul
)

rmdir /s /q .\ffmpeg-6.1.1-full_build-shared
tar -xf ffmpeg-release-full-shared.7z --strip-components=1
del ffmpeg-release-full-shared.7z

cd ..\
cd .\ffmpeg-latest
Expand Down Expand Up @@ -160,7 +158,7 @@ del .\python-3.11.2-embed-amd64.zip
:: Download VapourSynth64 Portable ~R63
%Download-->% https://github.com/vapoursynth/vapoursynth/releases/download/R63/VapourSynth64-Portable-R63.7z
%Extract-->% .\VapourSynth64-Portable-R63.7z > nul
del .\VapourSynth64-Portable-R63.7z
del .\VapourSynth64-Portable-R63.7z > nul

:: Download plugins [These plugins used can spit out errors and is known to be broken on VapourSynth64-R62]
.\python.exe .\vsrepo.py update -p > nul
Expand All @@ -181,14 +179,14 @@ curl -sLf "https://gitlab.com/AOMediaCodec/SVT-AV1/-/jobs/5763507189/artifacts/d


%Download-->% -i .\downloadlink.txt -O SVT-AV1-1.8.zip
tar -xf .\SVT-AV1-1.8.zip --strip-components 2 > nul
del SVT-AV1-1.8.zip

:: Clean up
del download > nul 2>&1
del downloadlink.txt > nul
del raw.txt > nul

tar -xf .\SVT-AV1-1.8.zip --strip-components 2 > nul

:: Add reminder about using diffrent builds, forks, branches of encoders.
echo 'If you want to use a diffrent build or version of an encoder, Just replace it using the same executable name.' > readme.txt

Expand Down
25 changes: 25 additions & 0 deletions !2_av1an.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off
TITLE Av1an Run

cls

setlocal enabledelayedexpansion

:: Set path
set "AV1=%~dp0"

:: Correct path
cd "%AV1%"

:: Set the base path variable
set PATH=%AV1%\dependencies

:: Append paths
for /D %%G in ("%AV1%\dependencies\*") do (
set PATH=!PATH!;%%G
)

copy dependencies\ffmpeg-6.1.1\bin\*.dll .

:: run av1an.exe --version
start cmd.exe /k av1an.exe --version
68 changes: 68 additions & 0 deletions (1.2)_install_build_deps.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@echo off
TITLE Av1an Win Build Script 🐦

cls

setlocal enabledelayedexpansion

:: Set path
set "AV1=%~dp0"

:: Set Wget command
set "Download-->=%AV1%\wget.exe -q -N --no-check-certificate --show-progress"

:: Set 7zr command
set "Extract-->=%AV1%\7zr.exe -y x"

:: Correct path
cd "%AV1%"

echo ---------------------
echo Installing Build deps
echo ---------------------

:: Download portable Wget
curl -O -C - --progress-bar https://web.archive.org/web/20230511215002/https://eternallybored.org/misc/wget/1.21.4/64/wget.exe

:: Download portable 7zip
%Download-->% https://www.7-zip.org/a/7zr.exe

:: Download nasm from https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip
%Download-->% https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip
tar -xf .\nasm-2.16.01-win64.zip --strip-components 1 -C dependencies\nasm

:: Download git from https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/PortableGit-2.43.0-64-bit.7z.exe
%Download-->% https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/PortableGit-2.43.0-64-bit.7z.exe
%Extract-->% PortableGit-2.43.0-64-bit.7z.exe -odependencies\git > nul

:: Download clang from https://github.com/vovkos/llvm-package-windows/releases/download/clang-master/clang-13.0.0-windows-amd64-msvc15-msvcrt.7z
%Download-->% https://github.com/vovkos/llvm-package-windows/releases/download/clang-master/clang-13.0.0-windows-amd64-msvc15-msvcrt.7z
tar -xf clang-13.0.0-windows-amd64-msvc15-msvcrt.7z --strip-components=1 -C dependencies\clang > nul

:: Download vs build tools
%Download-->% https://aka.ms/vs/17/release/vs_BuildTools.exe
::vs_BuildTools.exe --add Microsoft.VisualStudio.Workload.VCTools --wait --quiet
::vs_BuildTools.exe --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --wait --quiet
::vs_BuildTools.exe --add Microsoft.VisualStudio.Component.Windows11SDK.22000 --wait --quiet
::winget install Microsoft.VisualStudio.2022.BuildTools --force --override "--wait --passive --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22000"
vs_BuildTools.exe --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows11SDK.22000 --wait --quiet

:: Download Rustup
%Download-->% https://win.rustup.rs/x86_64 -O rustup-init.exe
rustup-init.exe -qy

:: Clean up
del .wget-hsts > nul
del wget.exe > nul
del 7zr.exe > nul
del nasm-2.16.01-win64.zip > nul
del PortableGit-2.43.0-64-bit.7z.exe > nul
del clang-13.0.0-windows-amd64-msvc15-msvcrt.7z > nul
del vs_BuildTools.exe > nul
del rustup-init.exe > nul

echo ---------------------------------
echo Build deps Installation Finished!
echo Exiting...
echo ---------------------------------
PAUSE
100 changes: 100 additions & 0 deletions (1.3)_build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
@echo off
TITLE Av1an Build

cls

setlocal enabledelayedexpansion

:: Set path
set "AV1=%~dp0"

:: Correct path
cd "%AV1%"

:: Set the base path variable
set PATH=%AV1%\dependencies

:: Append paths
for /D %%G in ("%AV1%\dependencies\*") do (
set PATH=!PATH!;%%G
)

:: install git from https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/PortableGit-2.43.0-64-bit.7z.exe
set PATH=!PATH!;%AV1%\dependencies\git\bin
git clone https://github.com/microsoft/vcpkg dependencies\vcpkg 2>nul
:: Clone av1an repo
git clone https://github.com/master-of-zen/Av1an source 2>nul
cd source
git pull
cd ..

set PATH=!PATH!;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
set PATH=!PATH!;%SYSTEMROOT%\System32

:: TODO make this dynamic
set PATH=!PATH!;"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64"

::LLVM
:: powershell.exe Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
:: powershell.exe Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
:: scoop install main/llvm

cd dependencies\vcpkg\scripts
powershell.exe -NoProfile -ExecutionPolicy Bypass -File bootstrap.ps1 >$null 2>&1

cd ..

::vcpkg update
git pull
vcpkg update
::vcpkg install
::vcpkg install ffmpeg
::setx VCPKG_ROOT %AV1%\dependencies\vcpkg

REM :: make it build debug only
REM cd triplets
REM del x64-windows-dbg.cmake
REM ECHO set(VCPKG_TARGET_ARCHITECTURE x64) >> x64-windows-dbg.cmake
REM ECHO set(VCPKG_CRT_LINKAGE dynamic) >> x64-windows-dbg.cmake
REM ECHO set(VCPKG_LIBRARY_LINKAGE dynamic) >> x64-windows-dbg.cmake
REM ECHO set(VCPKG_BUILD_TYPE debug) >> x64-windows-dbg.cmake
REM cd ..
REM vcpkg install ffmpeg:x64-windows-dbg

REM :: make it build release only
REM cd triplets
REM del x64-windows-rel.cmake
REM ECHO set(VCPKG_TARGET_ARCHITECTURE x64) >> x64-windows-rel.cmake
REM ECHO set(VCPKG_CRT_LINKAGE dynamic) >> x64-windows-rel.cmake
REM ECHO set(VCPKG_LIBRARY_LINKAGE dynamic) >> x64-windows-rel.cmake
REM ECHO set(VCPKG_BUILD_TYPE release) >> x64-windows-rel.cmake
REM cd ..
REM vcpkg install ffmpeg:x64-windows-rel

::TOFIX
:: Install pkgconfig (pkgconf)
vcpkg install pkgconf --triplet x64-windows
copy dependencies\ffmpeg-6.1.1\lib\*.lib source > NUL
copy dependencies\vcpkg\packages\pkgconf_x64-windows\lib\pkgconf.lib source > NUL

:: FFMPEG_DIR
setx FFMPEG_DIR %AV1%\dependencies\ffmpeg-6.1.1

:: Clang
setx LIBCLANG_PATH %AV1%\dependencies\clang\bin

::Copy vs libs
cd "%AV1%"
copy dependencies\vapoursynth64\sdk\lib64\VapourSynth.lib source
copy dependencies\vapoursynth64\sdk\lib64\VSScript.lib source

:: assuming rust is installed
set PATH=!PATH!;C:\Users\%username%\.cargo\bin
cd source
git pull
::cargo build
cargo build -r

copy target\release\av1an.exe ..\dependencies\av1an > NUL

pause
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SVT-AV1-1.8.zip
SvtAv1ApiTests.exe
SvtAv1Dec.dll
SvtAv1DecApp.exe
SvtAv1E2ETests.exe
SvtAv1Enc.dll
SvtAv1EncApp.exe
SvtAv1UnitTests.exe
av1an.exe
dependencies/
gtest.dll
gtest_all.dll
gtest_main.dll
readme.txt
source/
*.dll