1 changed files with 33 additions and 0 deletions
@ -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 编译失败! |
||||
|
) |
||||
Loading…
Reference in new issue