【添加】Windows平台配置及CMake调整
This commit is contained in:
@@ -3,7 +3,10 @@ param(
|
||||
[string]$build_type,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$build_and_run
|
||||
[string]$build_and_run,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$platform
|
||||
)
|
||||
|
||||
# 定义项目和构建目录的变量
|
||||
@@ -20,11 +23,17 @@ if (-Not (Test-Path -Path $buildDir)) {
|
||||
Set-Location -Path $buildDir
|
||||
|
||||
# 运行CMake生成构建系统
|
||||
# 这里假设CMakeLists.txt在项目根目录下
|
||||
cmake -G "Visual Studio 17 2022" -T host=x64 -DCMAKE_BUILD_TYPE=$build_type ..
|
||||
cmake -G "Visual Studio 17 2022" -T host=x64 -DCMAKE_BUILD_TYPE="$build_type" -DCMAKE_BUILD_PLATFORM="$platform" ..
|
||||
|
||||
# 编译项目
|
||||
cmake --build . --config $build_type
|
||||
|
||||
# 检查编译命令的退出代码
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "CMake build failed with exit code $LASTEXITCODE. Exiting script." -ForegroundColor Red
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
# 返回项目目录
|
||||
Set-Location -Path $projectDir
|
||||
|
||||
@@ -33,7 +42,6 @@ Write-Host "build done." -ForegroundColor Darkgreen
|
||||
|
||||
if($build_and_run -eq "true"){
|
||||
Write-Host "################## APP Run ##################" -ForegroundColor Blue
|
||||
Start-Process -FilePath "build\\${build_type}\\TestCode.exe"
|
||||
# & "build\\$build_type\\TestCode.exe"
|
||||
|
||||
$env:PATH += ";3rd\win\opencv\x64\vc15\bin"
|
||||
Start-Process -FilePath "build\\${build_type}\\Demo.exe"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user