feat(ci): update CI and release workflows to use Clang on Windows
- Changed the compiler configuration for Windows jobs in CI and release workflows from MSVC to Clang. - Updated CMake commands to utilize the Ninja generator and set the C and C++ compilers dynamically based on the matrix configuration. - Simplified artifact paths in the packaging steps to reflect the new build structure. Benefits: - Improved compatibility and performance by leveraging Clang for Windows builds, enhancing cross-platform consistency.
This commit is contained in:
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
@@ -58,10 +58,10 @@ jobs:
|
|||||||
os: macos-14
|
os: macos-14
|
||||||
cc: clang
|
cc: clang
|
||||||
cxx: clang++
|
cxx: clang++
|
||||||
- name: "Windows 2022 (MSVC)"
|
- name: "Windows 2022 (Clang)"
|
||||||
os: windows-2022
|
os: windows-2022
|
||||||
cc: cl
|
cc: clang-cl
|
||||||
cxx: cl
|
cxx: clang-cl
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -69,19 +69,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup vcpkg Cache (Windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ github.workspace }}/vcpkg
|
|
||||||
!${{ github.workspace }}/vcpkg/buildtrees
|
|
||||||
!${{ github.workspace }}/vcpkg/packages
|
|
||||||
!${{ github.workspace }}/vcpkg/downloads
|
|
||||||
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
vcpkg-${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Set up vcpkg (Windows)
|
- name: Set up vcpkg (Windows)
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
uses: lukka/run-vcpkg@v11
|
uses: lukka/run-vcpkg@v11
|
||||||
@@ -235,8 +222,10 @@ jobs:
|
|||||||
$vcpkgToolchain = "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -replace '\\', '/'
|
$vcpkgToolchain = "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -replace '\\', '/'
|
||||||
Write-Host "Using vcpkg toolchain: $vcpkgToolchain"
|
Write-Host "Using vcpkg toolchain: $vcpkgToolchain"
|
||||||
|
|
||||||
cmake -B build -G "Visual Studio 17 2022" -A x64 `
|
cmake -B build -G "Ninja" `
|
||||||
-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE `
|
-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE `
|
||||||
|
-DCMAKE_C_COMPILER=${{ matrix.cc }} `
|
||||||
|
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} `
|
||||||
-DCMAKE_TOOLCHAIN_FILE="$vcpkgToolchain" `
|
-DCMAKE_TOOLCHAIN_FILE="$vcpkgToolchain" `
|
||||||
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
|
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
|
||||||
-DVCPKG_MANIFEST_MODE=ON `
|
-DVCPKG_MANIFEST_MODE=ON `
|
||||||
@@ -360,7 +349,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
Write-Host "=== Post-Build Diagnostics ===" -ForegroundColor Green
|
Write-Host "=== Post-Build Diagnostics ===" -ForegroundColor Green
|
||||||
|
|
||||||
$binPath = "build/bin/${{ env.BUILD_TYPE }}"
|
$binPath = "build/bin"
|
||||||
if (Test-Path $binPath) {
|
if (Test-Path $binPath) {
|
||||||
Write-Host "`nBuilt executables and libraries:" -ForegroundColor Cyan
|
Write-Host "`nBuilt executables and libraries:" -ForegroundColor Cyan
|
||||||
Get-ChildItem -Path $binPath -Include *.exe,*.dll -Recurse | ForEach-Object {
|
Get-ChildItem -Path $binPath -Include *.exe,*.dll -Recurse | ForEach-Object {
|
||||||
@@ -389,8 +378,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: yaze-windows-ci-${{ github.run_number }}
|
name: yaze-windows-ci-${{ github.run_number }}
|
||||||
path: |
|
path: |
|
||||||
build/bin/${{ env.BUILD_TYPE }}/*.exe
|
build/bin/*.exe
|
||||||
build/bin/${{ env.BUILD_TYPE }}/*.dll
|
build/bin/*.dll
|
||||||
if-no-files-found: warn
|
if-no-files-found: warn
|
||||||
retention-days: 3
|
retention-days: 3
|
||||||
|
|
||||||
|
|||||||
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -118,8 +118,10 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- name: "Windows x64"
|
- name: "Windows x64 (Clang)"
|
||||||
os: windows-2022
|
os: windows-2022
|
||||||
|
cc: clang-cl
|
||||||
|
cxx: clang-cl
|
||||||
artifact_name: "yaze-windows-x64"
|
artifact_name: "yaze-windows-x64"
|
||||||
- name: "macOS arm64"
|
- name: "macOS arm64"
|
||||||
os: macos-14
|
os: macos-14
|
||||||
@@ -227,8 +229,10 @@ jobs:
|
|||||||
$vcpkgToolchain = "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -replace '\\', '/'
|
$vcpkgToolchain = "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -replace '\\', '/'
|
||||||
Write-Host "Using vcpkg toolchain: $vcpkgToolchain"
|
Write-Host "Using vcpkg toolchain: $vcpkgToolchain"
|
||||||
|
|
||||||
cmake -B build -G "Visual Studio 17 2022" -A x64 `
|
cmake -B build -G "Ninja" `
|
||||||
-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE `
|
-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE `
|
||||||
|
-DCMAKE_C_COMPILER=${{ matrix.cc }} `
|
||||||
|
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} `
|
||||||
-DCMAKE_TOOLCHAIN_FILE="$vcpkgToolchain" `
|
-DCMAKE_TOOLCHAIN_FILE="$vcpkgToolchain" `
|
||||||
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
|
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
|
||||||
-DVCPKG_MANIFEST_MODE=ON `
|
-DVCPKG_MANIFEST_MODE=ON `
|
||||||
@@ -354,14 +358,14 @@ jobs:
|
|||||||
mkdir -p stage
|
mkdir -p stage
|
||||||
|
|
||||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||||
# Windows uses Visual Studio generator: build/bin/Release/
|
# Windows uses Ninja generator: build/bin/
|
||||||
echo "Packaging Windows artifacts..."
|
echo "Packaging Windows artifacts..."
|
||||||
if [[ ! -f build/bin/${{ env.BUILD_TYPE }}/yaze.exe ]]; then
|
if [[ ! -f build/bin/yaze.exe ]]; then
|
||||||
echo "::error::Windows binary not found at build/bin/${{ env.BUILD_TYPE }}/yaze.exe"
|
echo "::error::Windows binary not found at build/bin/yaze.exe"
|
||||||
ls -la build/bin/ || true
|
ls -la build/bin/ || true
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cp -r build/bin/${{ env.BUILD_TYPE }}/* stage/
|
cp -r build/bin/* stage/
|
||||||
cp -r assets/ stage/assets/
|
cp -r assets/ stage/assets/
|
||||||
cp LICENSE README.md stage/
|
cp LICENSE README.md stage/
|
||||||
(cd stage && powershell -Command "Compress-Archive -Path * -DestinationPath ../${ARTIFACT_NAME}.zip")
|
(cd stage && powershell -Command "Compress-Archive -Path * -DestinationPath ../${ARTIFACT_NAME}.zip")
|
||||||
|
|||||||
Reference in New Issue
Block a user