You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.4 KiB
61 lines
1.4 KiB
@echo off
|
|
|
|
|
|
|
|
REM Windows平台构建脚本
|
|
|
|
|
|
|
|
REM 配置参数
|
|
|
|
set BUILD_DIR=build_windows
|
|
|
|
set CMAKE_GENERATOR="Visual Studio 17 2022"
|
|
|
|
set INSTALL_PREFIX=install
|
|
|
|
|
|
|
|
REM 检查命令行参数
|
|
|
|
:parse_args
|
|
|
|
if "%1"=="--clean" (
|
|
|
|
echo Cleaning build directory...
|
|
|
|
if exist %BUILD_DIR% rmdir /s /q %BUILD_DIR%
|
|
|
|
if exist %INSTALL_PREFIX% rmdir /s /q %INSTALL_PREFIX%
|
|
|
|
shift
|
|
|
|
)
|
|
|
|
|
|
|
|
REM 创建构建目录
|
|
|
|
if not exist %BUILD_DIR% mkdir %BUILD_DIR%
|
|
|
|
|
|
|
|
REM 运行CMake配置
|
|
|
|
pushd %BUILD_DIR%
|
|
|
|
echo Running CMake configuration...
|
|
|
|
cmake .. -G %CMAKE_GENERATOR% -DCMAKE_INSTALL_PREFIX=../%INSTALL_PREFIX%
|
|
|
|
if %ERRORLEVEL% neq 0 (
|
|
|
|
echo CMake configuration failed!
|
|
|
|
popd
|
|
|
|
exit /b 1
|
|
|
|
)
|
|
|
|
REM 构建项目
echo Building project...
cmake --build . --config Release
if %ERRORLEVEL% neq 0 (
echo Build failed!
popd
exit /b 1
)
REM 安装项目
echo Installing project...
cmake --build . --config Release --target install
if %ERRORLEVEL% neq 0 (
echo Installation failed!
popd
exit /b 1
)
popd
echo Build completed successfully!
echo Server executable: %INSTALL_PREFIX%\bin\rpc_server.exeecho Client executable: %INSTALL_PREFIX%\bin\rpc_client.exe
echo
echo To run the server:
cd %INSTALL_PREFIX%\bin
echo rpc_server.exe
echo
echo Then in another terminal:
echo rpc_client.exe
|