Skip to content

Commit

Permalink
[更新 GitHub Actions 工作流和脚本]: 改进 CI/CD 配置和 Windows 开发环境设置
Browse files Browse the repository at this point in the history
- 更新了 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` 变量。
  • Loading branch information
RealChuan committed Dec 19, 2024
1 parent 5a6654f commit 2ea6961
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/qmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
fail-fast: false
matrix:
os:
- windows-2019
- windows-latest
- macos-latest
- ubuntu-latest

Expand All @@ -54,7 +54,7 @@ jobs:
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
..\scripts\windows\setVsDev.ps1 -VersionRange "[16.0,17.0)" -Arch "x64"
..\scripts\windows\setVsDev.ps1
& qmake ./../.
& jom
working-directory: build
Expand Down
2 changes: 2 additions & 0 deletions cmake/qt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ elseif(CMAKE_HOST_APPLE)
elseif(CMAKE_HOST_LINUX)
list(APPEND CMAKE_PREFIX_PATH "/opt/Qt/6.8.1/gcc_64")
endif()

add_definitions(-DQT_DEPRECATED_WARNINGS)
11 changes: 8 additions & 3 deletions scripts/windows/setVsDev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ if ([string]::IsNullOrEmpty($Arch)) {
$Arch = "x64"
}

$Host_Arch = $Arch
if ($Arch -eq "arm64") {
$Host_Arch = "x64"
}

Write-Host "Architecture: $Arch"
Write-Host "VSWhere Args: $vswhereArgs"

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

if ($LASTEXITCODE -eq 0) {
Write-Host "Development environment set up successfully."
Expand All @@ -54,9 +59,9 @@ 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"
$vsInstallPath = "C:\Program Files\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
Enter-VsDevShell -VsInstallPath $vsInstallPath -DevCmdArguments "-arch=$Arch -host_arch=$Host_Arch" -SkipAutomaticLocation
}

0 comments on commit 2ea6961

Please sign in to comment.