68 lines
1.4 KiB
PowerShell
68 lines
1.4 KiB
PowerShell
|
Param($cmd)
|
||
|
|
||
|
$Env:PATH="C:\Program Files\Common Files\Pleora\eBUS SDK;" #开发光谱相机所必需的路径
|
||
|
$Env:PATH+="C:\Program Files\Git\cmd;" #开发所需的git命令的路径
|
||
|
$Env:PATH+=(Resolve-Path ../CompliteEnv/mingw64/bin).path+";" #g++所在路径
|
||
|
$Env:PATH+=(Resolve-Path ../CompliteEnv/CMake/bin).path+";" #cmake所在路径
|
||
|
$Env:PATH+=(Resolve-Path ./lib).path+";" #本项目所需的动态链接库所在路径
|
||
|
|
||
|
Write-Host "PATH is set to $Env:PATH"
|
||
|
|
||
|
|
||
|
function Remove-Build-Dir
|
||
|
{
|
||
|
If(Test-Path "build"){ #如果当前目录下build文件夹存在
|
||
|
Remove-Item -Path "build" -Recurse #递归阐述build文件夹
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
function ReBuild-Target
|
||
|
{
|
||
|
# 编译生成Makefile
|
||
|
cmake -B build -G "MinGW Makefiles"
|
||
|
# 编译生成可执行程序
|
||
|
cmake --build build
|
||
|
}
|
||
|
|
||
|
|
||
|
function Run-All-Exe
|
||
|
{
|
||
|
$exeFiles= Get-ChildItem -Path "build" -Filter *.exe
|
||
|
|
||
|
Write-Host "Exe Files: $exeFiles"
|
||
|
ForEach($exeFile in $exeFiles){
|
||
|
Write-Host "Processing file: $($exeFile.FullName)"
|
||
|
Start-Process -Wait -FilePath $exeFile.FullName -PassThru
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
If($cmd -eq "b"){
|
||
|
Write-Host "Rebuilding all targets..."
|
||
|
|
||
|
Remove-Build-Dir
|
||
|
|
||
|
ReBuild-Target
|
||
|
|
||
|
Run-All-Exe
|
||
|
}
|
||
|
|
||
|
|
||
|
If($cmd -eq "p"){
|
||
|
Write-Host "Packing all targets..."
|
||
|
cmake --build build --target package
|
||
|
}
|
||
|
|
||
|
If([String]::IsNullOrEmpty($cmd)){ #如果没有任何参数就运行所有exe
|
||
|
Run-All-Exe
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|