33 lines
576 B
Batchfile
33 lines
576 B
Batchfile
|
@echo on
|
|||
|
chcp 65001
|
|||
|
setlocal enabledelayedexpansion
|
|||
|
|
|||
|
set arch=x64
|
|||
|
set build_type=Debug
|
|||
|
|
|||
|
rem 如果参数1不为空,设置架构
|
|||
|
if not "%~1" == "" (
|
|||
|
set arch=%~1
|
|||
|
)
|
|||
|
|
|||
|
rem 如果参数2不为空,设置构建类型
|
|||
|
if not "%~2" == "" (
|
|||
|
set build_type=%~2
|
|||
|
)
|
|||
|
|
|||
|
rem 删除旧的构建目录
|
|||
|
if exist "build" (
|
|||
|
rmdir "build" /s /q
|
|||
|
)
|
|||
|
|
|||
|
rem 创建新的构建目录并进入
|
|||
|
mkdir "build"
|
|||
|
cd build
|
|||
|
|
|||
|
rem 运行 CMake 配置命令
|
|||
|
cmake .. -G "Visual Studio 17 2022" -A %arch% -DCMAKE_BUILD_TYPE=%build_type%
|
|||
|
|
|||
|
rem 执行构建
|
|||
|
cmake --build . --config %build_type%
|
|||
|
|
|||
|
endlocal
|