159 lines
4.6 KiB
Batchfile
159 lines
4.6 KiB
Batchfile
@echo off
|
|
echo Building libwebm library (Release + Debug) for win64...
|
|
|
|
REM Clean previous build
|
|
echo Cleaning previous build...
|
|
if exist lib\libwebm rmdir /S /Q lib\libwebm
|
|
if exist include\libwebm rmdir /S /Q include\libwebm
|
|
if exist oss\libwebm\build_win64 rmdir /S /Q oss\libwebm\build_win64
|
|
if exist oss\libwebm\build_debug rmdir /S /Q oss\libwebm\build_debug
|
|
|
|
REM Create output directories
|
|
echo Creating output directories...
|
|
mkdir lib\libwebm 2>nul
|
|
mkdir include\libwebm 2>nul
|
|
|
|
REM =============================================================================
|
|
REM Build Release version
|
|
REM =============================================================================
|
|
echo.
|
|
echo ========================================
|
|
echo Building RELEASE version of libwebm...
|
|
echo ========================================
|
|
|
|
REM Create build directory
|
|
cd oss\libwebm
|
|
mkdir build_win64 2>nul
|
|
cd build_win64
|
|
|
|
REM Configure with CMake (Release)
|
|
echo Configuring libwebm Release build...
|
|
cmake -G "Visual Studio 17 2022" -A x64 -DENABLE_TESTS=OFF -DENABLE_SAMPLE_PROGRAMS=OFF -DCMAKE_INSTALL_PREFIX="D:/Project/video-av1" ..
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo CMake Release configuration failed!
|
|
cd ..\..\..
|
|
exit /b 1
|
|
)
|
|
|
|
REM Build the library (Release)
|
|
echo Building libwebm Release...
|
|
cmake --build . --config Release
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo Release build failed!
|
|
cd ..\..\..
|
|
exit /b 1
|
|
)
|
|
|
|
REM Go back to libwebm source directory
|
|
cd ..
|
|
|
|
REM =============================================================================
|
|
REM Build Debug version
|
|
REM =============================================================================
|
|
echo.
|
|
echo ========================================
|
|
echo Building DEBUG version of libwebm...
|
|
echo ========================================
|
|
|
|
REM Create debug build directory
|
|
mkdir build_debug 2>nul
|
|
cd build_debug
|
|
|
|
REM Configure with CMake (Debug)
|
|
echo Configuring libwebm Debug build...
|
|
cmake -G "Visual Studio 17 2022" -A x64 -DENABLE_TESTS=OFF -DENABLE_SAMPLE_PROGRAMS=OFF ..
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo CMake Debug configuration failed!
|
|
cd ..\..\..
|
|
exit /b 1
|
|
)
|
|
|
|
REM Build the library (Debug)
|
|
echo Building libwebm Debug...
|
|
cmake --build . --config Debug
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo Debug build failed!
|
|
cd ..\..\..
|
|
exit /b 1
|
|
)
|
|
|
|
REM Rename debug library immediately after build
|
|
echo Renaming debug library...
|
|
if exist Debug\webm.lib (
|
|
ren Debug\webm.lib webm-debug.lib
|
|
echo Renamed webm.lib to webm-debug.lib
|
|
) else (
|
|
echo WARNING: webm.lib not found in debug build!
|
|
)
|
|
|
|
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...
|
|
copy "oss\libwebm\*.hpp" "include\libwebm\" 2>nul
|
|
echo Copied root header files
|
|
|
|
xcopy /E /I /Y "oss\libwebm\mkvmuxer" "include\libwebm\mkvmuxer"
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo WARNING: Failed to copy mkvmuxer headers, but continuing...
|
|
) else (
|
|
echo Successfully copied mkvmuxer headers
|
|
)
|
|
|
|
xcopy /E /I /Y "oss\libwebm\mkvparser" "include\libwebm\mkvparser"
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo WARNING: Failed to copy mkvparser headers, but continuing...
|
|
) else (
|
|
echo Successfully copied mkvparser headers
|
|
)
|
|
|
|
xcopy /E /I /Y "oss\libwebm\common" "include\libwebm\common"
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo WARNING: Failed to copy common headers, but continuing...
|
|
) else (
|
|
echo Successfully copied common headers
|
|
)
|
|
|
|
xcopy /E /I /Y "oss\libwebm\webvtt" "include\libwebm\webvtt"
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo WARNING: Failed to copy webvtt headers, but continuing...
|
|
) else (
|
|
echo Successfully copied webvtt headers
|
|
)
|
|
|
|
REM =============================================================================
|
|
REM Install library files
|
|
REM =============================================================================
|
|
echo.
|
|
echo Installing library files...
|
|
|
|
REM Copy Release library
|
|
echo Copying Release library...
|
|
copy "oss\libwebm\build_win64\Release\webm.lib" "lib\libwebm\"
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo Failed to copy Release library!
|
|
exit /b 1
|
|
)
|
|
|
|
REM Copy Debug library (already renamed)
|
|
echo Copying Debug library...
|
|
copy "oss\libwebm\build_debug\Debug\webm-debug.lib" "lib\libwebm\"
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo Failed to copy Debug library!
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo ========================================
|
|
echo libwebm build completed successfully!
|
|
echo ========================================
|
|
echo Release Library:
|
|
echo - lib\libwebm\webm.lib
|
|
echo Debug Library:
|
|
echo - lib\libwebm\webm-debug.lib
|
|
echo Headers: include\libwebm\
|
|
echo. |