@echo off echo Building libwebm dynamic library (Release + Debug) for win64... REM Clean previous build echo Cleaning previous build... if exist lib\windows-x64\libwebm rmdir /S /Q lib\windows-x64\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\windows-x64\libwebm 2>nul mkdir include\libwebm 2>nul REM ============================================================================= REM Build Release version (SHARED) REM ============================================================================= echo. echo ======================================== echo Building RELEASE shared version of libwebm... echo ======================================== REM Create build directory cd oss\libwebm mkdir build_win64 2>nul cd build_win64 REM Configure with CMake (Release Shared) echo Configuring libwebm Release shared build... cmake -G "Visual Studio 17 2022" -A x64 -DBUILD_SHARED_LIBS=ON -DENABLE_TESTS=OFF -DENABLE_SAMPLE_PROGRAMS=OFF -DCMAKE_INSTALL_PREFIX="D:/Project/video-av1" .. if %ERRORLEVEL% neq 0 ( echo CMake Release shared configuration failed! cd ..\..\.. exit /b 1 ) REM Build the library (Release) echo Building libwebm Release shared... cmake --build . --config Release if %ERRORLEVEL% neq 0 ( echo Release shared build failed! cd ..\..\.. exit /b 1 ) REM Go back to libwebm source directory cd .. REM ============================================================================= REM Build Debug version (SHARED) REM ============================================================================= echo. echo ======================================== echo Building DEBUG shared version of libwebm... echo ======================================== REM Create debug build directory mkdir build_debug 2>nul cd build_debug REM Configure with CMake (Debug Shared) echo Configuring libwebm Debug shared build... cmake -G "Visual Studio 17 2022" -A x64 -DBUILD_SHARED_LIBS=ON -DENABLE_TESTS=OFF -DENABLE_SAMPLE_PROGRAMS=OFF .. if %ERRORLEVEL% neq 0 ( echo CMake Debug shared configuration failed! cd ..\..\.. exit /b 1 ) REM Build the library (Debug) echo Building libwebm Debug shared... cmake --build . --config Debug if %ERRORLEVEL% neq 0 ( echo Debug shared build failed! cd ..\..\.. exit /b 1 ) REM Rename debug library and DLL 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! ) if exist Debug\webm.dll ( ren Debug\webm.dll webm-debug.dll echo Renamed webm.dll to webm-debug.dll ) else ( echo WARNING: webm.dll 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 shared library files REM ============================================================================= echo. echo Installing shared library files... REM Copy Release shared library files echo Copying Release shared library... copy "oss\libwebm\build_win64\Release\webm.lib" "lib\windows-x64\libwebm\" copy "oss\libwebm\build_win64\Release\webm.dll" "lib\windows-x64\libwebm\" if %ERRORLEVEL% neq 0 ( echo Failed to copy Release shared library! exit /b 1 ) REM Copy Debug shared library files (already renamed) echo Copying Debug shared library... copy "oss\libwebm\build_debug\Debug\webm-debug.lib" "lib\windows-x64\libwebm\" copy "oss\libwebm\build_debug\Debug\webm-debug.dll" "lib\windows-x64\libwebm\" if %ERRORLEVEL% neq 0 ( echo Failed to copy Debug shared library! exit /b 1 ) echo. echo ======================================== echo libwebm shared build completed successfully! echo ======================================== echo Release Shared Library: echo - lib\windows-x64\libwebm\webm.lib (import library) echo - lib\windows-x64\libwebm\webm.dll (runtime library) echo Debug Shared Library: echo - lib\windows-x64\libwebm\webm-debug.lib (import library) echo - lib\windows-x64\libwebm\webm-debug.dll (runtime library) echo Headers: include\libwebm\ echo. echo NOTE: DLL files must be distributed with your application. echo Place DLL files in the same directory as your executable. echo.