From 536ed2629949e799922b796802255f5bb78c655e Mon Sep 17 00:00:00 2001 From: xc Date: Sun, 28 Sep 2025 15:41:35 +0800 Subject: [PATCH] =?UTF-8?q?windows=E4=B8=8B=E6=B5=8B=E8=AF=95bat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scalib/test_compile.cmd | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 scalib/test_compile.cmd diff --git a/scalib/test_compile.cmd b/scalib/test_compile.cmd new file mode 100644 index 0000000..cd03d22 --- /dev/null +++ b/scalib/test_compile.cmd @@ -0,0 +1,33 @@ +@echo off +REM 简单的测试编译脚本 + +REM 设置Visual Studio环境 +REM 尝试检测Visual Studio安装路径 +set VS170COMNTOOLS= +for /f "delims=" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "17.0" 2^>nul') do ( + for /f "tokens=2*" %%j in ("%%i") do set "VS170COMNTOOLS=%%kCommon7\Tools\" +) + +REM 如果找不到Visual Studio 2022,尝试其他版本 +if not exist "%VS170COMNTOOLS%vsdevcmd.bat" ( + echo 无法找到Visual Studio 2022环境 + pause + exit /b 1 +) + +REM 设置环境变量 +call "%VS170COMNTOOLS%vsdevcmd.bat" -arch=x64 + +REM 设置编译选项 +set INCLUDE_DIR=include +set SRC_DIR=src + +REM 编译服务器 +cl.exe /I%INCLUDE_DIR% %SRC_DIR%\rpc_server.c %SRC_DIR%\rpc_common.c %SRC_DIR%\rpc_transport.c %SRC_DIR%\rpc_message.c /link ws2_32.lib /out:rpc_server_test.exe + +REM 检查编译结果 +if %ERRORLEVEL% EQU 0 ( + echo 编译成功!可执行文件: rpc_server_test.exe +) else ( + echo 编译失败! +) \ No newline at end of file