Files
video-v1/build_dav1d.bat
2025-09-29 02:42:26 +09:00

133 lines
4.7 KiB
Batchfile

@echo off
echo Building dav1d static library (Release + Debug) for win64...
REM Clean previous build directories (but preserve lib\dav1d)
echo Cleaning previous build directories...
if exist include\dav1d rmdir /S /Q include\dav1d
if exist oss\dav1d\build_static_release rmdir /S /Q oss\dav1d\build_static_release
if exist oss\dav1d\build_static_debug rmdir /S /Q oss\dav1d\build_static_debug
REM Create output directories
echo Creating output directories...
mkdir lib\dav1d 2>nul
mkdir include\dav1d 2>nul
REM =============================================================================
REM Build Release version (STATIC)
REM =============================================================================
echo.
echo ========================================
echo Building RELEASE static version of dav1d...
echo ========================================
REM Create build directory
cd oss\dav1d
REM Configure with Meson (Release Static with /MD)
echo Configuring dav1d Release static build...
meson setup build_static_release --buildtype=release --default-library=static --prefix="D:/Project/video-av1/build_output/release" -Denable_tools=false -Denable_tests=false -Denable_examples=false -Db_vscrt=md
if %ERRORLEVEL% neq 0 (
echo Meson Release static configuration failed!
cd ..\..
exit /b 1
)
REM Build the library (Release)
echo Building dav1d Release static...
meson compile -C build_static_release
if %ERRORLEVEL% neq 0 (
echo Release static build failed!
cd ..\..
exit /b 1
)
REM =============================================================================
REM Build Debug version (STATIC)
REM =============================================================================
echo.
echo ========================================
echo Building DEBUG static version of dav1d...
echo ========================================
REM Configure with Meson (Debug Static with /MDd)
echo Configuring dav1d Debug static build...
meson setup build_static_debug --buildtype=debug --default-library=static --prefix="D:/Project/video-av1/build_output/debug" -Denable_tools=false -Denable_tests=false -Denable_examples=false -Db_vscrt=mdd
if %ERRORLEVEL% neq 0 (
echo Meson Debug static configuration failed!
cd ..\..
exit /b 1
)
REM Build the library (Debug)
echo Building dav1d Debug static...
meson compile -C build_static_debug
if %ERRORLEVEL% neq 0 (
echo Debug static build failed!
cd ..\..
exit /b 1
)
REM Go back to root directory
cd ..\..
REM =============================================================================
REM Install header files FIRST (to ensure headers are copied even if libraries fail)
REM =============================================================================
echo.
echo Installing header files...
xcopy /E /I /Y "oss\dav1d\include\dav1d\*" "include\dav1d\"
if %ERRORLEVEL% neq 0 (
echo WARNING: Failed to copy header files, but continuing...
) else (
echo Successfully copied dav1d headers
)
REM Copy generated version header
echo Copying generated version header...
copy "oss\dav1d\build_static_release\include\vcs_version.h" "include\dav1d\"
if %ERRORLEVEL% neq 0 (
echo WARNING: Failed to copy vcs_version.h, but continuing...
) else (
echo Successfully copied vcs_version.h
)
REM =============================================================================
REM Install static library files
REM =============================================================================
echo.
echo Installing static library files...
REM Create Windows x64 lib directory
if not exist "lib\windows-x64\dav1d" mkdir "lib\windows-x64\dav1d"
REM Copy Release static library files
echo Copying Release static library...
copy "oss\dav1d\build_static_release\src\libdav1d.a" "lib\windows-x64\dav1d\dav1d.lib"
if %ERRORLEVEL% neq 0 (
echo Failed to copy Release static library!
exit /b 1
)
echo Successfully copied Release static library: dav1d.lib
REM Copy Debug static library files (with -debug postfix)
echo Copying Debug static library...
copy "oss\dav1d\build_static_debug\src\libdav1d.a" "lib\windows-x64\dav1d\dav1d-debug.lib"
if %ERRORLEVEL% neq 0 (
echo Failed to copy Debug static library!
exit /b 1
)
echo Successfully copied Debug static library: dav1d-debug.lib
echo.
echo ========================================
echo dav1d static build completed successfully!
echo ========================================
echo Release Static Library:
echo - lib\windows-x64\dav1d\dav1d.lib (static library with /MD runtime)
echo Debug Static Library:
echo - lib\windows-x64\dav1d\dav1d-debug.lib (static library with /MDd runtime)
echo Headers: include\dav1d\
echo.
echo NOTE: Static libraries are linked directly into your executable.
echo No separate DLL files are required for distribution.
echo.