Skip to content

Commit 2ea6961

Browse files
committed
[更新 GitHub Actions 工作流和脚本]: 改进 CI/CD 配置和 Windows 开发环境设置
- 更新了 GitHub Actions 工作流文件 `qmake.yml`,将 Windows 操作系统的版本从 `windows-2019` 更新为 `windows-latest`,以确保使用最新的 Windows 版本进行构建。 - 在 `qmake.yml` 中简化了 `setVsDev.ps1` 脚本的调用,移除了版本范围和架构参数,以适应脚本的最新更改。 - 在 `qt.cmake` 文件中添加了 `-DQT_DEPRECATED_WARNINGS` 编译定义,以启用 Qt 的弃用警告。 - 在 `setVsDev.ps1` 脚本中,增加了对 ARM64 架构的支持,将 ARM64 架构的主机架构设置为 x64,并更新了 `Enter-VsDevShell` 命令行参数,使其能够根据 `$Host_Arch` 变量动态设置 `-host_arch` 参数。 - 更新了 `setVsDev.ps1` 脚本中的 Visual Studio 安装路径,从 `C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise` 改为 `C:\Program Files\Microsoft Visual Studio\2022\Enterprise`,以匹配新的安装路径,并确保在不同的 Visual Studio 安装路径下,`Enter-VsDevShell` 命令行参数能够正确地使用 `$Arch` 和 `$Host_Arch` 变量。
1 parent 5a6654f commit 2ea6961

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.github/workflows/qmake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
os:
33-
- windows-2019
33+
- windows-latest
3434
- macos-latest
3535
- ubuntu-latest
3636

@@ -54,7 +54,7 @@ jobs:
5454
if: startsWith(matrix.os, 'windows')
5555
shell: pwsh
5656
run: |
57-
..\scripts\windows\setVsDev.ps1 -VersionRange "[16.0,17.0)" -Arch "x64"
57+
..\scripts\windows\setVsDev.ps1
5858
& qmake ./../.
5959
& jom
6060
working-directory: build

cmake/qt.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ elseif(CMAKE_HOST_APPLE)
55
elseif(CMAKE_HOST_LINUX)
66
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.8.1/gcc_64")
77
endif()
8+
9+
add_definitions(-DQT_DEPRECATED_WARNINGS)

scripts/windows/setVsDev.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if ([string]::IsNullOrEmpty($Arch)) {
2424
$Arch = "x64"
2525
}
2626

27+
$Host_Arch = $Arch
28+
if ($Arch -eq "arm64") {
29+
$Host_Arch = "x64"
30+
}
31+
2732
Write-Host "Architecture: $Arch"
2833
Write-Host "VSWhere Args: $vswhereArgs"
2934

@@ -41,7 +46,7 @@ if ($null -ne $vsInstallPath) {
4146
exit 1
4247
}
4348
Import-Module $vsDevShell
44-
Enter-VsDevShell -VsInstallPath $vsInstallPath -DevCmdArguments "-arch=$Arch -host_arch=$Arch" -SkipAutomaticLocation
49+
Enter-VsDevShell -VsInstallPath $vsInstallPath -DevCmdArguments "-arch=$Arch -host_arch=$Host_Arch" -SkipAutomaticLocation
4550

4651
if ($LASTEXITCODE -eq 0) {
4752
Write-Host "Development environment set up successfully."
@@ -54,9 +59,9 @@ else {
5459
Write-Host "Using Custom Visual Studio installation path."
5560
$vsInstallPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
5661
if (-not (Test-Path $vsInstallPath)) {
57-
$vsInstallPath = "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise"
62+
$vsInstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
5863
}
5964
$vsDevShell = Join-Path $vsInstallPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
6065
Import-Module $vsDevShell
61-
Enter-VsDevShell -VsInstallPath $vsInstallPath -DevCmdArguments "-arch=x64 -host_arch=x64" -SkipAutomaticLocation
66+
Enter-VsDevShell -VsInstallPath $vsInstallPath -DevCmdArguments "-arch=$Arch -host_arch=$Host_Arch" -SkipAutomaticLocation
6267
}

0 commit comments

Comments
 (0)