@echo off echo ===== AV解码器测试构建脚本 ===== :: 设置编码为UTF-8 chcp 65001 > nul :: 检查CMake是否存在 cmake --version > nul 2>&1 if %errorlevel% neq 0 ( echo 错误: 未找到CMake,请先安装CMake pause exit /b 1 ) :: 创建构建目录 if not exist "build_test" ( mkdir build_test ) cd build_test echo. echo 正在配置CMake项目... :: 使用CMakeLists_test.txt作为CMakeLists.txt copy /Y "..\CMakeLists_test.txt" "CMakeLists.txt" > nul :: 配置项目 cmake .. -G "Visual Studio 16 2019" -A x64 if %errorlevel% neq 0 ( echo 错误: CMake配置失败 echo 请检查: echo 1. FFmpeg是否正确安装 echo 2. 环境变量FFMPEG_ROOT是否设置 echo 3. Visual Studio是否正确安装 pause exit /b 1 ) echo. echo 正在编译项目... :: 编译项目 cmake --build . --config Release if %errorlevel% neq 0 ( echo 错误: 编译失败 echo 请检查编译错误信息 pause exit /b 1 ) echo. echo 编译成功!正在运行测试... echo. :: 运行测试 if exist "bin\Release\test_decoder.exe" ( bin\Release\test_decoder.exe ) else if exist "Release\test_decoder.exe" ( Release\test_decoder.exe ) else ( echo 错误: 找不到测试可执行文件 pause exit /b 1 ) echo. echo 测试完成! pause