@echo off :: ============================================================================ :: Intel VPL Static Library Build Script :: Builds Debug and Release static configurations with custom naming and /MD runtime :: ============================================================================ setlocal enabledelayedexpansion set SOURCE_DIR=D:\Project\video-av1\oss\libvpl set BUILD_DIR_BASE=D:\Project\video-av1\build\libvpl set TEMP_INSTALL_PREFIX=%BUILD_DIR_BASE%\temp_install set FINAL_INSTALL_PREFIX=D:\Project\video-av1 echo ============================================================================ echo Building Intel VPL Static Library echo ============================================================================ echo Source Directory: %SOURCE_DIR% echo Build Directory: %BUILD_DIR_BASE% echo Temp Install: %TEMP_INSTALL_PREFIX% echo Final Install: %FINAL_INSTALL_PREFIX% echo. :: Check if source directory exists if not exist "%SOURCE_DIR%" ( echo ERROR: Source directory not found: %SOURCE_DIR% exit /b 1 ) :: Clean previous build directories if exist "%BUILD_DIR_BASE%" ( echo Cleaning previous build directories... rmdir /s /q "%BUILD_DIR_BASE%" ) :: Create build directories mkdir "%BUILD_DIR_BASE%\debug" mkdir "%BUILD_DIR_BASE%\release" echo ============================================================================ echo Building Debug Configuration echo ============================================================================ cd "%BUILD_DIR_BASE%\debug" cmake "%SOURCE_DIR%" ^ -G "Visual Studio 17 2022" ^ -A x64 ^ -DCMAKE_BUILD_TYPE=Debug ^ -DCMAKE_INSTALL_PREFIX="%TEMP_INSTALL_PREFIX%" ^ -DBUILD_SHARED_LIBS=OFF ^ -DBUILD_TESTS=OFF ^ -DCMAKE_DEBUG_POSTFIX=-debug ^ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL if errorlevel 1 ( echo ERROR: CMake configuration failed for Debug exit /b 1 ) cmake --build . --config Debug --parallel 4 if errorlevel 1 ( echo ERROR: Build failed for Debug configuration exit /b 1 ) echo Installing Debug configuration... cmake --install . --config Debug echo ============================================================================ echo Building Release Configuration echo ============================================================================ cd "%BUILD_DIR_BASE%\release" cmake "%SOURCE_DIR%" ^ -G "Visual Studio 17 2022" ^ -A x64 ^ -DCMAKE_BUILD_TYPE=Release ^ -DCMAKE_INSTALL_PREFIX="%TEMP_INSTALL_PREFIX%" ^ -DBUILD_SHARED_LIBS=OFF ^ -DBUILD_TESTS=OFF ^ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL if errorlevel 1 ( echo ERROR: CMake configuration failed for Release exit /b 1 ) cmake --build . --config Release --parallel 4 if errorlevel 1 ( echo ERROR: Build failed for Release configuration exit /b 1 ) echo Installing Release configuration... cmake --install . --config Release echo ============================================================================ echo Organizing Output Files echo ============================================================================ :: Copy headers to final location if exist "%TEMP_INSTALL_PREFIX%\include" ( echo Copying headers to %FINAL_INSTALL_PREFIX%\include\libvpl\... if not exist "%FINAL_INSTALL_PREFIX%\include\libvpl" mkdir "%FINAL_INSTALL_PREFIX%\include\libvpl" xcopy /E /Y "%TEMP_INSTALL_PREFIX%\include\vpl" "%FINAL_INSTALL_PREFIX%\include\libvpl\" ) :: Copy static libraries to final location if exist "%TEMP_INSTALL_PREFIX%\lib" ( echo Copying static libraries to %FINAL_INSTALL_PREFIX%\lib\windows-x64\libvpl\... if not exist "%FINAL_INSTALL_PREFIX%\lib\windows-x64\libvpl" mkdir "%FINAL_INSTALL_PREFIX%\lib\windows-x64\libvpl" xcopy /E /Y "%TEMP_INSTALL_PREFIX%\lib\*" "%FINAL_INSTALL_PREFIX%\lib\windows-x64\libvpl\" ) :: Note: No DLL copying needed for static libraries echo ============================================================================ echo Verifying Build Results echo ============================================================================ echo Checking headers: if exist "%FINAL_INSTALL_PREFIX%\include\libvpl\mfx.h" ( echo [OK] Headers installed successfully ) else ( echo [ERROR] Headers not found ) echo. echo Checking libraries: dir "%FINAL_INSTALL_PREFIX%\lib\windows-x64\libvpl\*.lib" 2>nul if errorlevel 1 ( echo [ERROR] Library files not found ) else ( echo [OK] Library files found ) echo. echo Note: DLL files are not needed for static library build echo ============================================================================ echo Static Library Build Complete! echo ============================================================================ echo Headers: %FINAL_INSTALL_PREFIX%\include\libvpl\ echo Static Libraries: %FINAL_INSTALL_PREFIX%\lib\windows-x64\libvpl\ echo. echo Debug static libraries have '-debug' postfix with /MDd runtime echo Release static libraries use standard names with /MD runtime echo ============================================================================ :: Clean up temporary build directory (optional - uncomment to enable) :: echo Cleaning up temporary build directory... :: rmdir /s /q "%BUILD_DIR_BASE%" echo Build files are in: %BUILD_DIR_BASE% echo Final output is in: %FINAL_INSTALL_PREFIX% cd "%FINAL_INSTALL_PREFIX%" pause