Bläddra i källkod

Merge pull request #6227 from kambala-decapitator/msvc-v142

[windows] use msvc v142 toolset for Intel builds
Andrey Filipenkov 1 dag sedan
förälder
incheckning
6407d9cac3
5 ändrade filer med 18 tillägg och 23 borttagningar
  1. 11 14
      .github/workflows/github.yml
  2. 4 6
      CI/emit_partial.py
  3. 1 1
      CI/install_conan_dependencies.sh
  4. 1 1
      dependencies
  5. 1 1
      docs/developers/Conan.md

+ 11 - 14
.github/workflows/github.yml

@@ -56,6 +56,7 @@ jobs:
 
           - platform: msvc-x64
             arch: x64
+            toolset: '14.29'
             os: windows-2025
             pack: 1
             upload: 0
@@ -66,10 +67,10 @@ jobs:
             conan_prebuilts: dependencies-windows-x64
             conan_options: -s "&:build_type=RelWithDebInfo" -c tools.env.virtualenv:powershell=pwsh -o "&:target_pre_windows10=True"
             artifact_platform: x64
-            cl: Hostx64/x64/cl.exe
 
           - platform: msvc-x86
-            arch: x86
+            arch: amd64_x86
+            toolset: '14.29'
             os: windows-2025
             pack: 1
             upload: 0
@@ -80,7 +81,6 @@ jobs:
             conan_prebuilts: dependencies-windows-x86
             conan_options: -s "&:build_type=RelWithDebInfo" -c tools.env.virtualenv:powershell=pwsh -o "&:target_pre_windows10=True"
             artifact_platform: x86
-            cl: Hostx64/x86/cl.exe
 
           - platform: msvc-arm64
             arch: arm64
@@ -94,7 +94,6 @@ jobs:
             conan_prebuilts: dependencies-windows-arm64
             conan_options: -s "&:build_type=RelWithDebInfo" -c tools.env.virtualenv:powershell=pwsh -o "&:lua_lib=lua"
             artifact_platform: arm64
-            cl: HostARM64/ARM64/cl.exe
 
           - platform: android-32
             os: ubuntu-latest
@@ -178,6 +177,7 @@ jobs:
       uses: ilammy/msvc-dev-cmd@v1
       with:
         arch: ${{ matrix.arch }}
+        toolset: ${{ matrix.toolset }}
 
     # ensure the cache for each PR is separate so they don't interfere with each other
     # fall back to cache of the vcmi/vcmi repo if no PR-specific cache is found
@@ -224,11 +224,13 @@ jobs:
       if: "${{ matrix.conan_profile != '' }}"
       run: |
         conan profile detect
+        outFolder=conan-generated
         conan install . \
-          --output-folder=conan-generated \
+          --output-folder="$outFolder" \
           --build=never \
           --profile=dependencies/conan_profiles/${{ matrix.conan_profile }} \
           ${{ matrix.conan_options }}
+        ${{ startsWith(matrix.platform, 'msvc') && 'echo CONANRUN_PWSH_SCRIPT="$outFolder/conanrun.ps1" >> $GITHUB_ENV' || '' }}
 
     # Can't be set in Gradle project
     - name: Configure enableUncompressedNativeLibs
@@ -290,18 +292,14 @@ jobs:
     - name: Configure (MSVC)
       if: ${{ startsWith(matrix.platform, 'msvc') }}
       run: |
-        & conan-generated\conanrun.ps1
+        & $env:CONANRUN_PWSH_SCRIPT
 
-        $CL = "$($env:VCToolsInstallDir)/bin/${{ matrix.cl }}"
-        cmake `
-          -D "CMAKE_C_COMPILER:FILEPATH=$CL" `
-          -D "CMAKE_CXX_COMPILER:FILEPATH=$CL" `
-          --preset ${{ matrix.preset }}
+        cmake --preset ${{ matrix.preset }}
       shell: pwsh
 
     - name: Build
       run: |
-        ${{ startsWith(matrix.platform, 'msvc') && '& conan-generated\conanrun.ps1' }}
+        ${{ startsWith(matrix.platform, 'msvc') && '& $env:CONANRUN_PWSH_SCRIPT' }}
         cmake --build --preset ${{matrix.preset}}
       shell: pwsh
       env:
@@ -320,7 +318,7 @@ jobs:
       id: cpack
       if: ${{ matrix.pack == 1 }}
       run: |
-        ${{ startsWith(matrix.platform, 'msvc') && '& conan-generated\conanrun.ps1' }}
+        ${{ startsWith(matrix.platform, 'msvc') && '& $env:CONANRUN_PWSH_SCRIPT' }}
         cd "${{github.workspace}}/out/build/${{matrix.preset}}"
         cpack -C ${{matrix.pack_type}}
       shell: pwsh
@@ -376,7 +374,6 @@ jobs:
       id: make_partial_json
       env:
         PLATFORM: ${{ matrix.platform }}
-        ARCH: ${{ matrix.arch }}
         ARTIFACT_URL: ${{ steps.upload_artifact.outputs.artifact-url }}
         DEBUG_SYMBOLS_URL: ${{ steps.upload_symbols.outputs.artifact-url }}
         AAB_URL: ${{ steps.upload_aab.outputs.artifact-url }}

+ 4 - 6
CI/emit_partial.py

@@ -77,10 +77,8 @@ def parse_sccache(text: str) -> Tuple[int, int]:
     return hits, misses
 
 
-def arch_label(platform: str, arch_env: Optional[str]) -> str:
-    """Produce a nice arch label; prefer ARCH env when present."""
-    if arch_env:
-        return arch_env
+def arch_label(platform: str) -> str:
+    """Produce a nice arch label."""
     mapping = {
         "mac-intel": "Intel",
         "mac-arm": "Apple Silicon",
@@ -100,7 +98,7 @@ def arch_label(platform: str, arch_env: Optional[str]) -> str:
 def main() -> int:
     # Prefer our explicit PLATFORM env; fall back to VS's "Platform" on Windows if needed.
     platform = os.getenv("PLATFORM") or os.getenv("Platform") or "unknown"
-    arch = arch_label(platform, os.getenv("ARCH"))
+    arch = arch_label(platform)
     tool, cmd, family = detect(platform)
 
     stats_raw = run(cmd)
@@ -137,4 +135,4 @@ def main() -> int:
 
 
 if __name__ == "__main__":
-    sys.exit(main())
+    sys.exit(main())

+ 1 - 1
CI/install_conan_dependencies.sh

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-RELEASE_TAG="2025-08-24"
+RELEASE_TAG="2025-10-12"
 FILENAME="$1.tgz"
 DOWNLOAD_URL="https://github.com/vcmi/vcmi-dependencies/releases/download/$RELEASE_TAG/$FILENAME"
 

+ 1 - 1
dependencies

@@ -1 +1 @@
-Subproject commit b6f03bd541f19ad441ffb930a2cbd000222a50bf
+Subproject commit c0e4b540e926c732621a0938e31cf3c181247c6c

+ 1 - 1
docs/developers/Conan.md

@@ -31,7 +31,7 @@ The following platforms are supported and known to work, others might require ch
 1. Check if your build environment can use the prebuilt binaries: basically, that your compiler version (or Xcode major version) matches the information below. If you're unsure, simply advance to the next step.
     - *macOS*: libraries are built with Apple clang 16 (Xcode 16.2), should be consumable by Xcode / Xcode CLT 16.x and later
     - *iOS*: libraries are built with Apple clang 16 (Xcode 16.2), should be consumable by Xcode 16.x and later
-    - *Windows*: libraries are built with MSVC 19.4x (v143 toolset)
+    - *Windows*: libraries are built with MSVC 19.29 (v142 toolset, but can be consumed by v143) for Intel and with MSVC 19.4x (v143 toolset) for ARM64
     - *Android*: libraries are built with NDK r25c (25.2.9519653)
 
 2. Download the binaries archive from <https://github.com/vcmi/vcmi-dependencies/releases> (pre-release is for development version and the latest release is for respective VCMI release) and use `conan cache restore <path to archive>` command to unpack them.