@@ -178,17 +178,17 @@ jobs:
178178 fail-fast : false
179179 matrix :
180180 config :
181- - { arch: x64, vsArch: x64, buildType: Debug, os: windows-latest }
182- - { arch: x64, vsArch: x64, buildType: Release, os: windows-latest }
183- - { arch: Win32, vsArch: x86, buildType: Debug, os: windows-latest }
184- - { arch: Win32, vsArch: x86, buildType: Release, os: windows-latest }
185- - { arch: ARM64, vsArch: arm64, buildType: Debug, os: windows-11-arm }
186- - { arch: ARM64, vsArch: arm64, buildType: Release, os: windows-11-arm }
181+ - { arch: x64, vsArch: x64, buildType: Debug, os: windows-latest, msvc: 18 }
182+ - { arch: x64, vsArch: x64, buildType: Release, os: windows-latest, msvc: 18 }
183+ - { arch: Win32, vsArch: x86, buildType: Debug, os: windows-latest, msvc: 18 }
184+ - { arch: Win32, vsArch: x86, buildType: Release, os: windows-latest, msvc: 18 }
185+ - { arch: ARM64, vsArch: arm64, buildType: Debug, os: windows-11-arm, msvc: 17 }
186+ - { arch: ARM64, vsArch: arm64, buildType: Release, os: windows-11-arm, msvc: 17 }
187187 steps :
188188 - uses : actions/checkout@v6
189189 - name : build
190190 run : |
191- cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -G "Visual Studio 17 2022 " -A ${{matrix.config.arch}}
191+ cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -G "Visual Studio ${{matrix.config.msvc}} " -A ${{matrix.config.arch}}
192192 cmake --build build --config ${{matrix.config.buildType}}
193193 - name : stats
194194 run : |
@@ -264,7 +264,7 @@ jobs:
264264 - name : build
265265 run : |
266266 git submodule update --init --checkout --depth 1
267- cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -G "Visual Studio 17 2022 " -T ClangCL
267+ cmake -B build -DQJS_BUILD_WERROR=ON -DQJS_BUILD_EXAMPLES=ON -G "Visual Studio 18 " -T ClangCL
268268 cmake --build build --config ${{matrix.buildType}}
269269 - name : stats
270270 run : |
@@ -717,13 +717,20 @@ jobs:
717717
718718 # default clang on GitHub hosted runners is from MSYS2.
719719 # Use Visual Studio supplied clang-cl instead.
720+ # clang-cl's AddressSanitizer does not support the debug CRT (/MDd),
721+ # so force the release CRT (/MD) for both debug and release builds.
720722 - name : clang-cl+sanitize
721723 args : >-
722724 "-Db_sanitize=address,undefined"
723725 "-Db_lundef=false"
726+ "-Db_vscrt=md"
724727 extra_envs :
725728 CC : clang-cl
726729 CXX : clang-cl
730+ # clang-cl's AddressSanitizer reports false positive
731+ # global-buffer-overflows on pooled string literals on Windows,
732+ # same as MSVC; disable global checks (covered on Linux).
733+ ASAN_OPTIONS : report_globals=0:halt_on_error=1:abort_on_error=1:print_summary=1
727734 platform :
728735 - ubuntu-latest
729736 - windows-latest
@@ -822,7 +829,21 @@ jobs:
822829 if : ${{ matrix.platform == 'windows-latest' }}
823830 env : ${{ matrix.mode.extra_envs }}
824831 run : |
825- meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} ${{ matrix.features.args }} --vsenv
832+ $extraArgs = @()
833+ if ($env:CC -eq 'clang-cl') {
834+ # Newer clang-cl no longer emits the asan runtime /defaultlib directives
835+ # when -fsanitize is passed through /clang:, and meson links with lld-link
836+ # directly (not the clang driver), so the asan/ubsan runtime is never pulled
837+ # in. Link it explicitly and make its directory discoverable at link and run
838+ # time (the dynamic runtime ships as a DLL).
839+ $runtimeDir = (clang -print-runtime-dir).Trim()
840+ $env:LIB = "$runtimeDir;$env:LIB"
841+ "LIB=$env:LIB" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
842+ $runtimeDir | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
843+ $libs = "clang_rt.asan_dynamic-x86_64.lib clang_rt.asan_dynamic_runtime_thunk-x86_64.lib"
844+ $extraArgs = @("-Dc_link_args=$libs", "-Dcpp_link_args=$libs")
845+ }
846+ meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} ${{ matrix.features.args }} --vsenv @extraArgs
826847 - name : Configuring
827848 if : ${{ matrix.platform != 'windows-latest' }}
828849 env : ${{ matrix.mode.extra_envs }}
0 commit comments