-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 移除了原有的`Configure msvc for amd64`步骤,替换为`Configure and build windows`,以简化配置流程并整合构建步骤 - 将`shell`从`bash`更改为`pwsh`(PowerShell),以提升Windows环境下的脚本兼容性和现代性 - 引入了新的PowerShell脚本`setVsDev.ps1`,用于自动化设置Visual Studio开发环境,包括定位安装路径和启动开发命令行 - 通过`setVsDev.ps1`脚本,可以自动选择最新版本的Visual Studio,或者根据提供的版本范围参数选择特定版本 - 脚本支持指定目标架构(如`x64`),并能够在找不到Visual Studio安装时提供反馈 - 优化了`cmake`命令的执行,添加了错误检查和反馈机制,确保在配置失败时能够提供有用的信息 - 移除了`Configure macos or ubuntu`和`Build`步骤中的重复错误检查和反馈逻辑,因为这些现在可以通过`cmake`命令的错误检查来处理 - 更新了`.github/workflows/build.yml`文件,以反映新的配置和构建流程 - 在`scripts/windows/`目录下添加了新的`setVsDev.ps1`脚本,为Windows构建流程提供了更强的灵活性和鲁棒性
- Loading branch information
Showing
3 changed files
with
76 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
param( | ||
[Parameter(Mandatory = $false)] | ||
[string]$VersionRange, | ||
[Parameter(Mandatory = $false)] | ||
[string]$Arch | ||
) | ||
|
||
|
||
$vswhereArgs = @() | ||
|
||
if ($VersionRange) { | ||
$vswhereArgs += "-version" | ||
$vswhereArgs += $VersionRange | ||
} | ||
else { | ||
$vswhereArgs += "-latest" | ||
} | ||
|
||
|
||
$vswhereArgs += "-property" | ||
$vswhereArgs += "installationPath" | ||
|
||
if ([string]::IsNullOrEmpty($Arch)) { | ||
$Arch = "x64" | ||
} | ||
|
||
Write-Host "Architecture: $Arch" | ||
Write-Host "VSWhere Args: $vswhereArgs" | ||
|
||
# 使用 vswhere 获取 Visual Studio 的安装路径 | ||
$vswherePath = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" | ||
$vsInstallPath = & $vswherePath $vswhereArgs | ForEach-Object { $_ } | ||
# Output the results | ||
Write-Host "Visual Studio installation paths:" | ||
$vsInstallPath | ||
|
||
if ($null -ne $vsInstallPath) { | ||
$vsDevShell = Join-Path $vsInstallPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | ||
if (-not (Test-Path $vsDevShell)) { | ||
Write-Host "Failed to find Visual Studio DevShell DLL: $vsDevShell" | ||
exit 1 | ||
} | ||
Import-Module $vsDevShell | ||
Enter-VsDevShell -VsInstallPath $vsInstallPath -DevCmdArguments "-arch=$Arch -host_arch=$Arch" -SkipAutomaticLocation | ||
|
||
if ($LASTEXITCODE -eq 0) { | ||
Write-Host "Development environment set up successfully." | ||
} | ||
else { | ||
Write-Host "Failed to set up the development environment." | ||
} | ||
} | ||
else { | ||
Write-Host "Using Custom Visual Studio installation path." | ||
$vsInstallPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" | ||
if (-not (Test-Path $vsInstallPath)) { | ||
$vsInstallPath = "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise" | ||
} | ||
$vsDevShell = Join-Path $vsInstallPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll" | ||
Import-Module $vsDevShell | ||
Enter-VsDevShell -VsInstallPath $vsInstallPath -DevCmdArguments "-arch=x64 -host_arch=x64" -SkipAutomaticLocation | ||
} |