From 9458fbcfe4574a27bba6c106ecc3f43fccdd1d16 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:45:47 +0000 Subject: [PATCH 01/11] Initial plan From 13020037751af70e5f231746907041ee10b78b16 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:50:06 +0000 Subject: [PATCH 02/11] Add MSVC 2026 (Visual Studio 2025) workflow support Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 277 +++++++++++++++++++++++++++- 1 file changed, 273 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 278d2b7..8573029 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -8,8 +8,8 @@ on: workflow_dispatch: jobs: - build: - name: Windows Build (${{ matrix.config }}-${{ matrix.library_type }}) + build-vs2022: + name: Windows Build VS2022 (${{ matrix.config }}-${{ matrix.library_type }}) runs-on: windows-latest strategy: @@ -187,7 +187,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ccap-windows-${{ matrix.config }}-${{ matrix.library_type }} + name: ccap-windows-vs2022-${{ matrix.config }}-${{ matrix.library_type }} path: | build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/ccap*.* build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/0-print_camera.exe @@ -195,4 +195,273 @@ jobs: build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/2-capture_grab.exe build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/3-capture_callback.exe build/${{ matrix.config }}-${{ matrix.library_type }}/*_results.xml - if-no-files-found: error \ No newline at end of file + if-no-files-found: error + + build-vs2025: + name: Windows Build VS2025/MSVC2026 (${{ matrix.config }}-${{ matrix.library_type }}) + runs-on: windows-latest + + strategy: + matrix: + config: [Debug, Release] + library_type: [static, shared] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup latest CMake + uses: lukka/get-cmake@latest + + - name: Setup Visual Studio 2025 Preview + shell: pwsh + run: | + Write-Host "Checking for Visual Studio 2025..." + + # Check if VS 2025 is available + $vs2025Path = "C:\Program Files\Microsoft Visual Studio\2025" + $vs2025PreviewPath = "C:\Program Files\Microsoft Visual Studio\2025\Preview" + + if (Test-Path $vs2025PreviewPath) { + Write-Host "Visual Studio 2025 Preview found at: $vs2025PreviewPath" + echo "VS_2025_AVAILABLE=true" >> $env:GITHUB_ENV + } elseif (Test-Path $vs2025Path) { + Write-Host "Visual Studio 2025 found at: $vs2025Path" + echo "VS_2025_AVAILABLE=true" >> $env:GITHUB_ENV + } else { + Write-Host "Visual Studio 2025 not found on this runner" + Write-Host "Available Visual Studio installations:" + Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -Directory -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName } + Write-Host "" + Write-Host "Installing Visual Studio 2025 Build Tools Preview..." + + # Download VS installer + $installerUrl = "https://aka.ms/vs/18/pre/vs_BuildTools.exe" + $installerPath = "$env:TEMP\vs_buildtools.exe" + + Write-Host "Downloading installer from: $installerUrl" + try { + Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -ErrorAction Stop + Write-Host "Download completed" + + # Install VS 2025 Build Tools with required components + Write-Host "Installing Visual Studio 2025 Build Tools (this may take several minutes)..." + $arguments = @( + "--quiet", + "--wait", + "--norestart", + "--nocache", + "--add", "Microsoft.VisualStudio.Workload.VCTools", + "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", + "--add", "Microsoft.VisualStudio.Component.Windows11SDK.22621" + ) + + $process = Start-Process -FilePath $installerPath -ArgumentList $arguments -Wait -PassThru -NoNewWindow + + if ($process.ExitCode -eq 0 -or $process.ExitCode -eq 3010) { + Write-Host "Visual Studio 2025 Build Tools installed successfully" + echo "VS_2025_AVAILABLE=true" >> $env:GITHUB_ENV + } else { + Write-Host "Installation failed with exit code: $($process.ExitCode)" + Write-Host "Will skip VS2025 builds" + echo "VS_2025_AVAILABLE=false" >> $env:GITHUB_ENV + } + } catch { + Write-Host "Error during installation: $_" + Write-Host "Will skip VS2025 builds" + echo "VS_2025_AVAILABLE=false" >> $env:GITHUB_ENV + } + } + + - name: Configure CMake with VS2025 + if: env.VS_2025_AVAILABLE == 'true' + run: | + $SHARED_FLAG = "" + if ("${{ matrix.library_type }}" -eq "shared") { + $SHARED_FLAG = "-DCCAP_BUILD_SHARED=ON" + Write-Host "Configuring Windows build ${{ matrix.config }} with VS2025/MSVC2026 - SHARED LIBRARY (DLL)" + } else { + Write-Host "Configuring Windows build ${{ matrix.config }} with VS2025/MSVC2026 - STATIC LIBRARY" + } + + # Check CMake version + cmake --version + + mkdir -p "build/${{ matrix.config }}-${{ matrix.library_type }}" + cd "build/${{ matrix.config }}-${{ matrix.library_type }}" + + # Try Visual Studio 18 2025 generator + try { + Write-Host "Attempting to use Visual Studio 18 2025 generator..." + cmake ../.. -G "Visual Studio 18 2025" -A x64 -DCCAP_BUILD_TESTS=ON $SHARED_FLAG + } catch { + Write-Host "Visual Studio 18 2025 generator not available, trying alternative detection..." + cmake ../.. -A x64 -DCCAP_BUILD_TESTS=ON $SHARED_FLAG + } + + - name: Skip message + if: env.VS_2025_AVAILABLE != 'true' + run: | + Write-Host "Visual Studio 2025 is not available on this runner" + Write-Host "Skipping VS2025/MSVC2026 build" + + - name: Build + if: env.VS_2025_AVAILABLE == 'true' + run: | + cd "build/${{ matrix.config }}-${{ matrix.library_type }}" + cmake --build . --config ${{ matrix.config }} --parallel + + - name: Verify library type + if: env.VS_2025_AVAILABLE == 'true' + shell: bash + working-directory: build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }} + run: | + echo "Checking built libraries:" + ls -la | grep -E "ccap" || echo "No ccap libraries found" + + # Verify library type + # Debug versions have 'd' suffix, Release versions don't + if [ "${{ matrix.config }}" = "Debug" ]; then + LIB_BASENAME="ccapd" + DLL_NAME="ccapd.dll" + else + LIB_BASENAME="ccap" + DLL_NAME="ccap.dll" + fi + + if [ "${{ matrix.library_type }}" = "shared" ]; then + if [ -f "$DLL_NAME" ]; then + echo "✓ Windows shared library $DLL_NAME successfully built with VS2025/MSVC2026" + # Check if import library exists + if [ -f "${LIB_BASENAME}.lib" ]; then + echo "✓ Windows import library ${LIB_BASENAME}.lib also created" + fi + else + echo "✗ Windows shared library $DLL_NAME not found" + exit 1 + fi + else + if [ -f "${LIB_BASENAME}.lib" ]; then + echo "✓ Windows static library ${LIB_BASENAME}.lib successfully built with VS2025/MSVC2026" + else + echo "✗ Windows static library ${LIB_BASENAME}.lib not found" + exit 1 + fi + fi + + - name: Test shared library linking (Windows VS2025) + if: env.VS_2025_AVAILABLE == 'true' && matrix.library_type == 'shared' + shell: bash + working-directory: build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }} + run: | + echo "Testing Windows shared library linking with VS2025/MSVC2026..." + + # Create a simple test program + cat > test_shared.cpp << 'EOF' + #include "ccap_c.h" + #include + int main() { + const char* version = ccap_get_version(); + printf("Library version: %s\n", version ? version : "unknown"); + CcapProvider* provider = ccap_provider_create(); + if (provider) { + printf("Provider created successfully\n"); + ccap_provider_destroy(provider); + return 0; + } + return 1; + } + EOF + + # Find Visual Studio 2025 compiler + VCVARS_PATH=$(find "/c/Program Files/Microsoft Visual Studio/2025" -name "vcvars64.bat" 2>/dev/null | head -n1) + + if [ -n "$VCVARS_PATH" ]; then + echo "Using Visual Studio 2025 environment from: $VCVARS_PATH" + # Convert path for cmd + VCVARS_WIN_PATH=$(echo "$VCVARS_PATH" | sed 's|/c/|C:/|g' | sed 's|/|\\|g') + + # Determine library names based on config + if [ "${{ matrix.config }}" = "Debug" ]; then + LIB_NAME="ccapd.lib" + DLL_NAME="ccapd.dll" + else + LIB_NAME="ccap.lib" + DLL_NAME="ccap.dll" + fi + + # Create a temporary batch file to avoid quote escaping issues + cat > compile_test.bat << EOF + @echo off + call "$VCVARS_WIN_PATH" + set "INCLUDE_DIR=%GITHUB_WORKSPACE%\\include" + if not exist "%INCLUDE_DIR%" ( + echo Include directory not found: %INCLUDE_DIR% + exit /b 1 + ) + cl /I"%INCLUDE_DIR%" test_shared.cpp $LIB_NAME /Fe:test_shared.exe + EOF + + # Execute the batch file + cmd //c compile_test.bat + + # Ensure DLL is available beside the test executable + if [ ! -f "./$DLL_NAME" ]; then + DLL_PATH=$(find .. -name "$DLL_NAME" -print -quit) + if [ -z "$DLL_PATH" ]; then + echo "✗ Windows shared library $DLL_NAME not found for runtime" + exit 1 + fi + cp "$DLL_PATH" . + fi + ./test_shared.exe + echo "✓ Windows shared library linking test with VS2025/MSVC2026 passed" + else + echo "⚠ Visual Studio 2025 compiler not found, skipping link test" + fi + + - name: Run Unit Tests + if: env.VS_2025_AVAILABLE == 'true' + shell: bash + run: | + # Create symbolic links to make test script work with new build directory structure + mkdir -p build/tests + + # Create symbolic link for the config directory + if [ ! -L "build/${{ matrix.config }}" ]; then + ln -sf "${{ matrix.config }}-${{ matrix.library_type }}" "build/${{ matrix.config }}" + fi + + # Create symbolic link for the tests directory to match expected path structure + if [ ! -L "build/tests/${{ matrix.config }}" ]; then + ln -sf "../${{ matrix.config }}-${{ matrix.library_type }}/tests/${{ matrix.config }}" "build/tests/${{ matrix.config }}" + fi + + cd scripts + if [ "${{ matrix.config }}" == "Debug" ]; then + # Set library path for shared library tests + if [ "${{ matrix.library_type }}" = "shared" ]; then + export PATH="$PWD/../build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}:$PATH" + fi + ./run_tests.sh --functional --skip-build + else + # Set library path for shared library tests + if [ "${{ matrix.library_type }}" = "shared" ]; then + export PATH="$PWD/../build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}:$PATH" + fi + ./run_tests.sh --performance --skip-build + fi + + - name: Upload artifacts + if: env.VS_2025_AVAILABLE == 'true' + uses: actions/upload-artifact@v4 + with: + name: ccap-windows-vs2025-${{ matrix.config }}-${{ matrix.library_type }} + path: | + build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/ccap*.* + build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/0-print_camera.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/1-minimal_example.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/2-capture_grab.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/3-capture_callback.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/*_results.xml + if-no-files-found: warn \ No newline at end of file From 35e2620020446e0c47041305388ca617a37ed24b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:51:11 +0000 Subject: [PATCH 03/11] Update documentation to include MSVC 2025/2026 support Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- BUILD_AND_INSTALL.md | 4 ++-- README.md | 4 ++-- README.zh-CN.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BUILD_AND_INSTALL.md b/BUILD_AND_INSTALL.md index 7340812..d9bb91e 100644 --- a/BUILD_AND_INSTALL.md +++ b/BUILD_AND_INSTALL.md @@ -5,8 +5,8 @@ This document describes how to build, install, and use the ccap library. ## Prerequisites - **macOS**: Xcode Command Line Tools or full Xcode -- **Windows**: Visual Studio 2019+ or Build Tools for Visual Studio -- **Common**: CMake 3.14+ +- **Windows**: Visual Studio 2019+ or Build Tools for Visual Studio (including VS 2025/MSVC 2026) +- **Common**: CMake 3.14+ (CMake 3.31+ recommended for MSVC 2025/2026 support) ## Quick Start diff --git a/README.md b/README.md index 7e05852..44f9af7 100644 --- a/README.md +++ b/README.md @@ -206,12 +206,12 @@ int main() { | Platform | Compiler | System Requirements | |----------|----------|---------------------| -| **Windows** | MSVC 2019+ | DirectShow | +| **Windows** | MSVC 2019+ (including 2025/2026) | DirectShow | | **macOS** | Xcode 11+ | macOS 10.13+ | | **iOS** | Xcode 11+ | iOS 13.0+ | | **Linux** | GCC 7+ / Clang 6+ | V4L2 (Linux 2.6+) | -**Build Requirements**: CMake 3.14+, C++17 (C++ interface), C99 (C interface) +**Build Requirements**: CMake 3.14+ (3.31+ recommended for MSVC 2025/2026), C++17 (C++ interface), C99 (C interface) ### Supported Linux Distributions diff --git a/README.zh-CN.md b/README.zh-CN.md index 993102a..a16943f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -167,12 +167,12 @@ int main() { | 平台 | 编译器 | 系统要求 | |------|--------|----------| -| **Windows** | MSVC 2019+ | DirectShow | +| **Windows** | MSVC 2019+(包括 2025/2026) | DirectShow | | **macOS** | Xcode 11+ | macOS 10.13+ | | **iOS** | Xcode 11+ | iOS 13.0+ | | **Linux** | GCC 7+ / Clang 6+ | V4L2 (Linux 2.6+) | -**构建要求**:CMake 3.14+,C++17(C++ 接口),C99(C 接口) +**构建要求**:CMake 3.14+(推荐使用 3.31+ 以支持 MSVC 2025/2026),C++17(C++ 接口),C99(C 接口) ### 支持的 Linux 发行版 From cda9aaee87afb84f797b0c431d7fb957bb956dd5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:53:02 +0000 Subject: [PATCH 04/11] Fix: Update VS2022 job to use actions/checkout@v4 for consistency Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 8573029..8a8c041 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -1,5 +1,10 @@ name: Windows Build +# This workflow builds the project on Windows with multiple Visual Studio versions: +# - build-vs2022: Uses Visual Studio 2022 (stable) +# - build-vs2025: Uses Visual Studio 2025/MSVC 2026 (preview, auto-installs if needed) +# Both jobs test Debug/Release builds with static/shared library configurations. + on: push: branches: [ main, ci_test ] @@ -19,7 +24,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Visual Studio environment uses: microsoft/setup-msbuild@v1.1 From 214b646e64a63d2c213457673a3c14337679101d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:54:32 +0000 Subject: [PATCH 05/11] Add documentation comments for VS 2025 installer URL and artifact handling Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 8a8c041..3c9ceab 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -241,6 +241,8 @@ jobs: Write-Host "Installing Visual Studio 2025 Build Tools Preview..." # Download VS installer + # Note: This URL points to the preview version. Update to stable URL when VS 2025 is officially released: + # Stable URL will likely be: https://aka.ms/vs/18/release/vs_BuildTools.exe $installerUrl = "https://aka.ms/vs/18/pre/vs_BuildTools.exe" $installerPath = "$env:TEMP\vs_buildtools.exe" @@ -469,4 +471,5 @@ jobs: build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/2-capture_grab.exe build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/3-capture_callback.exe build/${{ matrix.config }}-${{ matrix.library_type }}/*_results.xml + # Use 'warn' instead of 'error' since VS 2025 build is optional (may not be available on all runners) if-no-files-found: warn \ No newline at end of file From be2017b70450cd81a4f0f9f39d3e862943edd0b6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:55:56 +0000 Subject: [PATCH 06/11] Improve documentation comments for URL pattern and CMake version Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 3c9ceab..5f01c6b 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -216,6 +216,8 @@ jobs: uses: actions/checkout@v4 - name: Setup latest CMake + # Use @latest to ensure CMake 3.31+ is available, which is required for VS 2025 support + # VS 2025 is very new and requires the latest CMake version uses: lukka/get-cmake@latest - name: Setup Visual Studio 2025 Preview @@ -241,8 +243,8 @@ jobs: Write-Host "Installing Visual Studio 2025 Build Tools Preview..." # Download VS installer - # Note: This URL points to the preview version. Update to stable URL when VS 2025 is officially released: - # Stable URL will likely be: https://aka.ms/vs/18/release/vs_BuildTools.exe + # Note: This URL points to the preview version. When VS 2025 is officially released, + # verify and update the URL from Microsoft's official documentation. $installerUrl = "https://aka.ms/vs/18/pre/vs_BuildTools.exe" $installerPath = "$env:TEMP\vs_buildtools.exe" From 02e3d2bb1405a0df1eb9f419fdb590a184d89f30 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:57:29 +0000 Subject: [PATCH 07/11] Clarify error handling for installer URL Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 5f01c6b..102e9fa 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -245,6 +245,7 @@ jobs: # Download VS installer # Note: This URL points to the preview version. When VS 2025 is officially released, # verify and update the URL from Microsoft's official documentation. + # If the URL becomes unavailable, the error handling below will catch it and skip the build. $installerUrl = "https://aka.ms/vs/18/pre/vs_BuildTools.exe" $installerPath = "$env:TEMP\vs_buildtools.exe" From 0bbc47987c4258b0ea75d2c7f9f8c3b75df66fd5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:58:37 +0000 Subject: [PATCH 08/11] Document aka.ms URL usage and exit code 3010 meaning Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 102e9fa..8491ed5 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -243,7 +243,8 @@ jobs: Write-Host "Installing Visual Studio 2025 Build Tools Preview..." # Download VS installer - # Note: This URL points to the preview version. When VS 2025 is officially released, + # Note: Using aka.ms redirect URL per Microsoft's standard distribution method. + # This URL points to the preview version. When VS 2025 is officially released, # verify and update the URL from Microsoft's official documentation. # If the URL becomes unavailable, the error handling below will catch it and skip the build. $installerUrl = "https://aka.ms/vs/18/pre/vs_BuildTools.exe" @@ -268,6 +269,7 @@ jobs: $process = Start-Process -FilePath $installerPath -ArgumentList $arguments -Wait -PassThru -NoNewWindow + # Exit codes: 0 = success, 3010 = success with reboot required (common for VS installers) if ($process.ExitCode -eq 0 -or $process.ExitCode -eq 3010) { Write-Host "Visual Studio 2025 Build Tools installed successfully" echo "VS_2025_AVAILABLE=true" >> $env:GITHUB_ENV From 81b27775b44a361af4e24490742cc9598a90ab12 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 09:57:25 +0000 Subject: [PATCH 09/11] Fix VS naming (vs2025->vs2026), add MinGW workflow Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 250 +++++++++++++++++++++------- BUILD_AND_INSTALL.md | 4 +- README.md | 4 +- README.zh-CN.md | 4 +- 4 files changed, 198 insertions(+), 64 deletions(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 8491ed5..fa2eaf2 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -1,9 +1,10 @@ name: Windows Build -# This workflow builds the project on Windows with multiple Visual Studio versions: +# This workflow builds the project on Windows with multiple compilers: # - build-vs2022: Uses Visual Studio 2022 (stable) -# - build-vs2025: Uses Visual Studio 2025/MSVC 2026 (preview, auto-installs if needed) -# Both jobs test Debug/Release builds with static/shared library configurations. +# - build-vs2026: Uses Visual Studio 2026 (preview, auto-installs if needed) +# - build-mingw: Uses MinGW-w64 (latest version) +# All jobs test Debug/Release builds with static/shared library configurations. on: push: @@ -202,8 +203,8 @@ jobs: build/${{ matrix.config }}-${{ matrix.library_type }}/*_results.xml if-no-files-found: error - build-vs2025: - name: Windows Build VS2025/MSVC2026 (${{ matrix.config }}-${{ matrix.library_type }}) + build-vs2026: + name: Windows Build VS2026 (${{ matrix.config }}-${{ matrix.library_type }}) runs-on: windows-latest strategy: @@ -216,35 +217,35 @@ jobs: uses: actions/checkout@v4 - name: Setup latest CMake - # Use @latest to ensure CMake 3.31+ is available, which is required for VS 2025 support - # VS 2025 is very new and requires the latest CMake version + # Use @latest to ensure CMake 3.31+ is available, which is required for VS 2026 support + # VS 2026 is very new and requires the latest CMake version uses: lukka/get-cmake@latest - - name: Setup Visual Studio 2025 Preview + - name: Setup Visual Studio 2026 Preview shell: pwsh run: | - Write-Host "Checking for Visual Studio 2025..." - - # Check if VS 2025 is available - $vs2025Path = "C:\Program Files\Microsoft Visual Studio\2025" - $vs2025PreviewPath = "C:\Program Files\Microsoft Visual Studio\2025\Preview" - - if (Test-Path $vs2025PreviewPath) { - Write-Host "Visual Studio 2025 Preview found at: $vs2025PreviewPath" - echo "VS_2025_AVAILABLE=true" >> $env:GITHUB_ENV - } elseif (Test-Path $vs2025Path) { - Write-Host "Visual Studio 2025 found at: $vs2025Path" - echo "VS_2025_AVAILABLE=true" >> $env:GITHUB_ENV + Write-Host "Checking for Visual Studio 2026..." + + # Check if VS 2026 is available + $vs2026Path = "C:\Program Files\Microsoft Visual Studio\2026" + $vs2026PreviewPath = "C:\Program Files\Microsoft Visual Studio\2026\Preview" + + if (Test-Path $vs2026PreviewPath) { + Write-Host "Visual Studio 2026 Preview found at: $vs2026PreviewPath" + echo "VS_2026_AVAILABLE=true" >> $env:GITHUB_ENV + } elseif (Test-Path $vs2026Path) { + Write-Host "Visual Studio 2026 found at: $vs2026Path" + echo "VS_2026_AVAILABLE=true" >> $env:GITHUB_ENV } else { - Write-Host "Visual Studio 2025 not found on this runner" + Write-Host "Visual Studio 2026 not found on this runner" Write-Host "Available Visual Studio installations:" Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -Directory -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName } Write-Host "" - Write-Host "Installing Visual Studio 2025 Build Tools Preview..." + Write-Host "Installing Visual Studio 2026 Build Tools Preview..." # Download VS installer # Note: Using aka.ms redirect URL per Microsoft's standard distribution method. - # This URL points to the preview version. When VS 2025 is officially released, + # This URL points to the preview version. When VS 2026 is officially released, # verify and update the URL from Microsoft's official documentation. # If the URL becomes unavailable, the error handling below will catch it and skip the build. $installerUrl = "https://aka.ms/vs/18/pre/vs_BuildTools.exe" @@ -255,8 +256,8 @@ jobs: Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -ErrorAction Stop Write-Host "Download completed" - # Install VS 2025 Build Tools with required components - Write-Host "Installing Visual Studio 2025 Build Tools (this may take several minutes)..." + # Install VS 2026 Build Tools with required components + Write-Host "Installing Visual Studio 2026 Build Tools (this may take several minutes)..." $arguments = @( "--quiet", "--wait", @@ -271,29 +272,29 @@ jobs: # Exit codes: 0 = success, 3010 = success with reboot required (common for VS installers) if ($process.ExitCode -eq 0 -or $process.ExitCode -eq 3010) { - Write-Host "Visual Studio 2025 Build Tools installed successfully" - echo "VS_2025_AVAILABLE=true" >> $env:GITHUB_ENV + Write-Host "Visual Studio 2026 Build Tools installed successfully" + echo "VS_2026_AVAILABLE=true" >> $env:GITHUB_ENV } else { Write-Host "Installation failed with exit code: $($process.ExitCode)" - Write-Host "Will skip VS2025 builds" - echo "VS_2025_AVAILABLE=false" >> $env:GITHUB_ENV + Write-Host "Will skip VS2026 builds" + echo "VS_2026_AVAILABLE=false" >> $env:GITHUB_ENV } } catch { Write-Host "Error during installation: $_" - Write-Host "Will skip VS2025 builds" - echo "VS_2025_AVAILABLE=false" >> $env:GITHUB_ENV + Write-Host "Will skip VS2026 builds" + echo "VS_2026_AVAILABLE=false" >> $env:GITHUB_ENV } } - - name: Configure CMake with VS2025 - if: env.VS_2025_AVAILABLE == 'true' + - name: Configure CMake with VS2026 + if: env.VS_2026_AVAILABLE == 'true' run: | $SHARED_FLAG = "" if ("${{ matrix.library_type }}" -eq "shared") { $SHARED_FLAG = "-DCCAP_BUILD_SHARED=ON" - Write-Host "Configuring Windows build ${{ matrix.config }} with VS2025/MSVC2026 - SHARED LIBRARY (DLL)" + Write-Host "Configuring Windows build ${{ matrix.config }} with VS2026 - SHARED LIBRARY (DLL)" } else { - Write-Host "Configuring Windows build ${{ matrix.config }} with VS2025/MSVC2026 - STATIC LIBRARY" + Write-Host "Configuring Windows build ${{ matrix.config }} with VS2026 - STATIC LIBRARY" } # Check CMake version @@ -302,29 +303,29 @@ jobs: mkdir -p "build/${{ matrix.config }}-${{ matrix.library_type }}" cd "build/${{ matrix.config }}-${{ matrix.library_type }}" - # Try Visual Studio 18 2025 generator + # Try Visual Studio 18 2026 generator try { - Write-Host "Attempting to use Visual Studio 18 2025 generator..." - cmake ../.. -G "Visual Studio 18 2025" -A x64 -DCCAP_BUILD_TESTS=ON $SHARED_FLAG + Write-Host "Attempting to use Visual Studio 18 2026 generator..." + cmake ../.. -G "Visual Studio 18 2026" -A x64 -DCCAP_BUILD_TESTS=ON $SHARED_FLAG } catch { - Write-Host "Visual Studio 18 2025 generator not available, trying alternative detection..." + Write-Host "Visual Studio 18 2026 generator not available, trying alternative detection..." cmake ../.. -A x64 -DCCAP_BUILD_TESTS=ON $SHARED_FLAG } - name: Skip message - if: env.VS_2025_AVAILABLE != 'true' + if: env.VS_2026_AVAILABLE != 'true' run: | - Write-Host "Visual Studio 2025 is not available on this runner" - Write-Host "Skipping VS2025/MSVC2026 build" + Write-Host "Visual Studio 2026 is not available on this runner" + Write-Host "Skipping VS2026 build" - name: Build - if: env.VS_2025_AVAILABLE == 'true' + if: env.VS_2026_AVAILABLE == 'true' run: | cd "build/${{ matrix.config }}-${{ matrix.library_type }}" cmake --build . --config ${{ matrix.config }} --parallel - name: Verify library type - if: env.VS_2025_AVAILABLE == 'true' + if: env.VS_2026_AVAILABLE == 'true' shell: bash working-directory: build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }} run: | @@ -343,7 +344,7 @@ jobs: if [ "${{ matrix.library_type }}" = "shared" ]; then if [ -f "$DLL_NAME" ]; then - echo "✓ Windows shared library $DLL_NAME successfully built with VS2025/MSVC2026" + echo "✓ Windows shared library $DLL_NAME successfully built with VS2026" # Check if import library exists if [ -f "${LIB_BASENAME}.lib" ]; then echo "✓ Windows import library ${LIB_BASENAME}.lib also created" @@ -354,19 +355,19 @@ jobs: fi else if [ -f "${LIB_BASENAME}.lib" ]; then - echo "✓ Windows static library ${LIB_BASENAME}.lib successfully built with VS2025/MSVC2026" + echo "✓ Windows static library ${LIB_BASENAME}.lib successfully built with VS2026" else echo "✗ Windows static library ${LIB_BASENAME}.lib not found" exit 1 fi fi - - name: Test shared library linking (Windows VS2025) - if: env.VS_2025_AVAILABLE == 'true' && matrix.library_type == 'shared' + - name: Test shared library linking (Windows VS2026) + if: env.VS_2026_AVAILABLE == 'true' && matrix.library_type == 'shared' shell: bash working-directory: build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }} run: | - echo "Testing Windows shared library linking with VS2025/MSVC2026..." + echo "Testing Windows shared library linking with VS2026..." # Create a simple test program cat > test_shared.cpp << 'EOF' @@ -385,11 +386,11 @@ jobs: } EOF - # Find Visual Studio 2025 compiler - VCVARS_PATH=$(find "/c/Program Files/Microsoft Visual Studio/2025" -name "vcvars64.bat" 2>/dev/null | head -n1) + # Find Visual Studio 2026 compiler + VCVARS_PATH=$(find "/c/Program Files/Microsoft Visual Studio/2026" -name "vcvars64.bat" 2>/dev/null | head -n1) if [ -n "$VCVARS_PATH" ]; then - echo "Using Visual Studio 2025 environment from: $VCVARS_PATH" + echo "Using Visual Studio 2026 environment from: $VCVARS_PATH" # Convert path for cmd VCVARS_WIN_PATH=$(echo "$VCVARS_PATH" | sed 's|/c/|C:/|g' | sed 's|/|\\|g') @@ -427,13 +428,13 @@ jobs: cp "$DLL_PATH" . fi ./test_shared.exe - echo "✓ Windows shared library linking test with VS2025/MSVC2026 passed" + echo "✓ Windows shared library linking test with VS2026 passed" else - echo "⚠ Visual Studio 2025 compiler not found, skipping link test" + echo "⚠ Visual Studio 2026 compiler not found, skipping link test" fi - name: Run Unit Tests - if: env.VS_2025_AVAILABLE == 'true' + if: env.VS_2026_AVAILABLE == 'true' shell: bash run: | # Create symbolic links to make test script work with new build directory structure @@ -465,10 +466,10 @@ jobs: fi - name: Upload artifacts - if: env.VS_2025_AVAILABLE == 'true' + if: env.VS_2026_AVAILABLE == 'true' uses: actions/upload-artifact@v4 with: - name: ccap-windows-vs2025-${{ matrix.config }}-${{ matrix.library_type }} + name: ccap-windows-vs2026-${{ matrix.config }}-${{ matrix.library_type }} path: | build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/ccap*.* build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/0-print_camera.exe @@ -476,5 +477,138 @@ jobs: build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/2-capture_grab.exe build/${{ matrix.config }}-${{ matrix.library_type }}/${{ matrix.config }}/3-capture_callback.exe build/${{ matrix.config }}-${{ matrix.library_type }}/*_results.xml - # Use 'warn' instead of 'error' since VS 2025 build is optional (may not be available on all runners) + # Use 'warn' instead of 'error' since VS 2026 build is optional (may not be available on all runners) + if-no-files-found: warn + + build-mingw: + name: Windows Build MinGW (${{ matrix.config }}-${{ matrix.library_type }}) + runs-on: windows-latest + + strategy: + matrix: + config: [Debug, Release] + library_type: [static, shared] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup MinGW-w64 + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: >- + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + mingw-w64-x86_64-ninja + make + + - name: Configure CMake with MinGW + shell: msys2 {0} + run: | + SHARED_FLAG="" + if [ "${{ matrix.library_type }}" = "shared" ]; then + SHARED_FLAG="-DCCAP_BUILD_SHARED=ON" + echo "Configuring Windows build ${{ matrix.config }} with MinGW - SHARED LIBRARY (DLL)" + else + echo "Configuring Windows build ${{ matrix.config }} with MinGW - STATIC LIBRARY" + fi + + # Check compiler version + gcc --version + cmake --version + + mkdir -p "build/${{ matrix.config }}-${{ matrix.library_type }}" + cd "build/${{ matrix.config }}-${{ matrix.library_type }}" + cmake ../.. -G "Ninja" -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCCAP_BUILD_TESTS=ON $SHARED_FLAG + + - name: Build + shell: msys2 {0} + run: | + cd "build/${{ matrix.config }}-${{ matrix.library_type }}" + cmake --build . --parallel + + - name: Verify library type + shell: msys2 {0} + working-directory: build/${{ matrix.config }}-${{ matrix.library_type }} + run: | + echo "Checking built libraries:" + ls -la | grep -E "ccap" || echo "No ccap libraries found" + + if [ "${{ matrix.library_type }}" = "shared" ]; then + # MinGW shared libraries use .dll extension + if [ -f "libccap.dll" ]; then + echo "✓ Windows shared library libccap.dll successfully built with MinGW" + else + echo "✗ Windows shared library libccap.dll not found" + exit 1 + fi + else + # MinGW static libraries use .a extension + if [ -f "libccap.a" ]; then + echo "✓ Windows static library libccap.a successfully built with MinGW" + else + echo "✗ Windows static library libccap.a not found" + exit 1 + fi + fi + + - name: Test shared library linking (Windows MinGW) + if: matrix.library_type == 'shared' + shell: msys2 {0} + working-directory: build/${{ matrix.config }}-${{ matrix.library_type }} + run: | + echo "Testing Windows shared library linking with MinGW..." + + # Create a simple test program + cat > test_shared.cpp << 'EOF' + #include "ccap_c.h" + #include + int main() { + const char* version = ccap_get_version(); + printf("Library version: %s\n", version ? version : "unknown"); + CcapProvider* provider = ccap_provider_create(); + if (provider) { + printf("Provider created successfully\n"); + ccap_provider_destroy(provider); + return 0; + } + return 1; + } + EOF + + # Compile and run with shared library + g++ -I../../include test_shared.cpp -L. -lccap -o test_shared.exe + ./test_shared.exe + echo "✓ Windows shared library linking test with MinGW passed" + + - name: Run Unit Tests + if: matrix.config == 'Release' + shell: msys2 {0} + run: | + # Create symbolic links to make test script work with new build directory structure + mkdir -p build + if [ ! -L "build/${{ matrix.config }}" ]; then + ln -sf "${{ matrix.config }}-${{ matrix.library_type }}" "build/${{ matrix.config }}" + fi + + cd scripts + # Set library path for shared library tests + if [ "${{ matrix.library_type }}" = "shared" ]; then + export PATH="$PWD/../build/${{ matrix.config }}-${{ matrix.library_type }}:$PATH" + fi + ./run_tests.sh --functional --skip-build + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ccap-windows-mingw-${{ matrix.config }}-${{ matrix.library_type }} + path: | + build/${{ matrix.config }}-${{ matrix.library_type }}/libccap.* + build/${{ matrix.config }}-${{ matrix.library_type }}/0-print_camera.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/1-minimal_example.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/2-capture_grab.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/3-capture_callback.exe + build/${{ matrix.config }}-${{ matrix.library_type }}/*_results.xml if-no-files-found: warn \ No newline at end of file diff --git a/BUILD_AND_INSTALL.md b/BUILD_AND_INSTALL.md index d9bb91e..5b513ba 100644 --- a/BUILD_AND_INSTALL.md +++ b/BUILD_AND_INSTALL.md @@ -5,8 +5,8 @@ This document describes how to build, install, and use the ccap library. ## Prerequisites - **macOS**: Xcode Command Line Tools or full Xcode -- **Windows**: Visual Studio 2019+ or Build Tools for Visual Studio (including VS 2025/MSVC 2026) -- **Common**: CMake 3.14+ (CMake 3.31+ recommended for MSVC 2025/2026 support) +- **Windows**: Visual Studio 2019+ or Build Tools for Visual Studio (including VS 2026), or MinGW-w64 +- **Common**: CMake 3.14+ (CMake 3.31+ recommended for MSVC 2026 support) ## Quick Start diff --git a/README.md b/README.md index 44f9af7..8234194 100644 --- a/README.md +++ b/README.md @@ -206,12 +206,12 @@ int main() { | Platform | Compiler | System Requirements | |----------|----------|---------------------| -| **Windows** | MSVC 2019+ (including 2025/2026) | DirectShow | +| **Windows** | MSVC 2019+ (including 2026) / MinGW-w64 | DirectShow | | **macOS** | Xcode 11+ | macOS 10.13+ | | **iOS** | Xcode 11+ | iOS 13.0+ | | **Linux** | GCC 7+ / Clang 6+ | V4L2 (Linux 2.6+) | -**Build Requirements**: CMake 3.14+ (3.31+ recommended for MSVC 2025/2026), C++17 (C++ interface), C99 (C interface) +**Build Requirements**: CMake 3.14+ (3.31+ recommended for MSVC 2026), C++17 (C++ interface), C99 (C interface) ### Supported Linux Distributions diff --git a/README.zh-CN.md b/README.zh-CN.md index a16943f..f066a78 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -167,12 +167,12 @@ int main() { | 平台 | 编译器 | 系统要求 | |------|--------|----------| -| **Windows** | MSVC 2019+(包括 2025/2026) | DirectShow | +| **Windows** | MSVC 2019+(包括 2026)/ MinGW-w64 | DirectShow | | **macOS** | Xcode 11+ | macOS 10.13+ | | **iOS** | Xcode 11+ | iOS 13.0+ | | **Linux** | GCC 7+ / Clang 6+ | V4L2 (Linux 2.6+) | -**构建要求**:CMake 3.14+(推荐使用 3.31+ 以支持 MSVC 2025/2026),C++17(C++ 接口),C99(C 接口) +**构建要求**:CMake 3.14+(推荐使用 3.31+ 以支持 MSVC 2026),C++17(C++ 接口),C99(C 接口) ### 支持的 Linux 发行版 From ba2341d7c74e9c81fedc81990f97d531414623f4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 16:33:06 +0000 Subject: [PATCH 10/11] Simplify VS2026 job: check availability only, skip gracefully if not available Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 105 +++++++++++----------------- 1 file changed, 39 insertions(+), 66 deletions(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index fa2eaf2..1dacc54 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -2,7 +2,7 @@ name: Windows Build # This workflow builds the project on Windows with multiple compilers: # - build-vs2022: Uses Visual Studio 2022 (stable) -# - build-vs2026: Uses Visual Studio 2026 (preview, auto-installs if needed) +# - build-vs2026: Uses Visual Studio 2026 (when available on GitHub runners, skips gracefully if not) # - build-mingw: Uses MinGW-w64 (latest version) # All jobs test Debug/Release builds with static/shared library configurations. @@ -213,78 +213,57 @@ jobs: library_type: [static, shared] steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup latest CMake - # Use @latest to ensure CMake 3.31+ is available, which is required for VS 2026 support - # VS 2026 is very new and requires the latest CMake version - uses: lukka/get-cmake@latest - - - name: Setup Visual Studio 2026 Preview + - name: Check for Visual Studio 2026 + id: check-vs2026 shell: pwsh run: | - Write-Host "Checking for Visual Studio 2026..." + Write-Host "Checking for Visual Studio 2026 on this runner..." - # Check if VS 2026 is available + # Check if VS 2026 is available (stable or preview) $vs2026Path = "C:\Program Files\Microsoft Visual Studio\2026" $vs2026PreviewPath = "C:\Program Files\Microsoft Visual Studio\2026\Preview" + $vs2026EnterprisePath = "C:\Program Files\Microsoft Visual Studio\2026\Enterprise" + $vs2026ProfessionalPath = "C:\Program Files\Microsoft Visual Studio\2026\Professional" + $vs2026CommunityPath = "C:\Program Files\Microsoft Visual Studio\2026\Community" + $found = $false if (Test-Path $vs2026PreviewPath) { - Write-Host "Visual Studio 2026 Preview found at: $vs2026PreviewPath" - echo "VS_2026_AVAILABLE=true" >> $env:GITHUB_ENV + Write-Host "✓ Visual Studio 2026 Preview found at: $vs2026PreviewPath" + $found = $true + } elseif (Test-Path $vs2026EnterprisePath) { + Write-Host "✓ Visual Studio 2026 Enterprise found at: $vs2026EnterprisePath" + $found = $true + } elseif (Test-Path $vs2026ProfessionalPath) { + Write-Host "✓ Visual Studio 2026 Professional found at: $vs2026ProfessionalPath" + $found = $true + } elseif (Test-Path $vs2026CommunityPath) { + Write-Host "✓ Visual Studio 2026 Community found at: $vs2026CommunityPath" + $found = $true } elseif (Test-Path $vs2026Path) { - Write-Host "Visual Studio 2026 found at: $vs2026Path" + Write-Host "✓ Visual Studio 2026 found at: $vs2026Path" + $found = $true + } + + if ($found) { echo "VS_2026_AVAILABLE=true" >> $env:GITHUB_ENV } else { - Write-Host "Visual Studio 2026 not found on this runner" + Write-Host "ℹ Visual Studio 2026 is not available on this GitHub runner yet." Write-Host "Available Visual Studio installations:" - Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -Directory -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName } + Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -Directory -ErrorAction SilentlyContinue | ForEach-Object { Write-Host " - $($_.FullName)" } Write-Host "" - Write-Host "Installing Visual Studio 2026 Build Tools Preview..." - - # Download VS installer - # Note: Using aka.ms redirect URL per Microsoft's standard distribution method. - # This URL points to the preview version. When VS 2026 is officially released, - # verify and update the URL from Microsoft's official documentation. - # If the URL becomes unavailable, the error handling below will catch it and skip the build. - $installerUrl = "https://aka.ms/vs/18/pre/vs_BuildTools.exe" - $installerPath = "$env:TEMP\vs_buildtools.exe" - - Write-Host "Downloading installer from: $installerUrl" - try { - Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -ErrorAction Stop - Write-Host "Download completed" - - # Install VS 2026 Build Tools with required components - Write-Host "Installing Visual Studio 2026 Build Tools (this may take several minutes)..." - $arguments = @( - "--quiet", - "--wait", - "--norestart", - "--nocache", - "--add", "Microsoft.VisualStudio.Workload.VCTools", - "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", - "--add", "Microsoft.VisualStudio.Component.Windows11SDK.22621" - ) - - $process = Start-Process -FilePath $installerPath -ArgumentList $arguments -Wait -PassThru -NoNewWindow - - # Exit codes: 0 = success, 3010 = success with reboot required (common for VS installers) - if ($process.ExitCode -eq 0 -or $process.ExitCode -eq 3010) { - Write-Host "Visual Studio 2026 Build Tools installed successfully" - echo "VS_2026_AVAILABLE=true" >> $env:GITHUB_ENV - } else { - Write-Host "Installation failed with exit code: $($process.ExitCode)" - Write-Host "Will skip VS2026 builds" - echo "VS_2026_AVAILABLE=false" >> $env:GITHUB_ENV - } - } catch { - Write-Host "Error during installation: $_" - Write-Host "Will skip VS2026 builds" - echo "VS_2026_AVAILABLE=false" >> $env:GITHUB_ENV - } + Write-Host "⏭ Skipping VS2026 build - this job will complete successfully without running the build." + Write-Host "Once GitHub adds VS2026 to their runners, this job will automatically start building." + echo "VS_2026_AVAILABLE=false" >> $env:GITHUB_ENV } + + - name: Checkout repository + if: env.VS_2026_AVAILABLE == 'true' + uses: actions/checkout@v4 + + - name: Setup latest CMake + if: env.VS_2026_AVAILABLE == 'true' + # Use @latest to ensure CMake 3.31+ is available, which is required for VS 2026 support + uses: lukka/get-cmake@latest - name: Configure CMake with VS2026 if: env.VS_2026_AVAILABLE == 'true' @@ -312,12 +291,6 @@ jobs: cmake ../.. -A x64 -DCCAP_BUILD_TESTS=ON $SHARED_FLAG } - - name: Skip message - if: env.VS_2026_AVAILABLE != 'true' - run: | - Write-Host "Visual Studio 2026 is not available on this runner" - Write-Host "Skipping VS2026 build" - - name: Build if: env.VS_2026_AVAILABLE == 'true' run: | From 0ee675930c631b2e7aeaadc9bbb60d787403a314 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 16:34:38 +0000 Subject: [PATCH 11/11] Move checkout step before VS2026 check for proper workflow structure Co-authored-by: wysaid <1430725+wysaid@users.noreply.github.com> --- .github/workflows/windows-build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 1dacc54..25e9354 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -213,6 +213,9 @@ jobs: library_type: [static, shared] steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Check for Visual Studio 2026 id: check-vs2026 shell: pwsh @@ -256,10 +259,6 @@ jobs: echo "VS_2026_AVAILABLE=false" >> $env:GITHUB_ENV } - - name: Checkout repository - if: env.VS_2026_AVAILABLE == 'true' - uses: actions/checkout@v4 - - name: Setup latest CMake if: env.VS_2026_AVAILABLE == 'true' # Use @latest to ensure CMake 3.31+ is available, which is required for VS 2026 support