From 4ec2d093e8468100f63c9159c22836a68d6352b7 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Mon, 1 Jun 2026 09:09:16 +0200 Subject: [PATCH] Fix clang-cl ASan preset setup --- CMakeLists.txt | 7 +++++-- CMakePresets.json | 4 ++-- docs/modernization/build-inventory.md | 4 ++++ docs/modernization/debt.md | 1 + docs/modernization/roadmap.md | 10 +++++++++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bbd89f9..e63493f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,11 +9,14 @@ if(POLICY CMP0091) cmake_policy(SET CMP0091 NEW) endif() -set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") - list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(PanoPainterOptions) +if(PP_ENABLE_ASAN AND MSVC AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL") +else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") +endif() include(PanoPainterWarnings) include(PanoPainterSources) include(PanoPainterVersion) diff --git a/CMakePresets.json b/CMakePresets.json index ffd13d5..a39620d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -57,13 +57,13 @@ }, { "name": "windows-clangcl-asan", - "inherits": "base", + "inherits": "platform-headless-base", "displayName": "Windows clang-cl ASan", "generator": "Ninja", - "toolset": "ClangCL", "cacheVariables": { "CMAKE_C_COMPILER": "clang-cl", "CMAKE_CXX_COMPILER": "clang-cl", + "CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreadedDLL", "PP_ENABLE_ASAN": "ON", "PP_ENABLE_UBSAN": "OFF" } diff --git a/docs/modernization/build-inventory.md b/docs/modernization/build-inventory.md index 3ec48bd..0778414 100644 --- a/docs/modernization/build-inventory.md +++ b/docs/modernization/build-inventory.md @@ -72,6 +72,7 @@ ctest --preset desktop-fast-vcpkg --build-config Debug cmake --preset android-arm64 powershell -ExecutionPolicy Bypass -File scripts\automation\platform-build.ps1 -Presets android-arm64 powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug +cmake --fresh --preset windows-clangcl-asan ``` Known local toolchain state: @@ -82,6 +83,9 @@ Known local toolchain state: (`vcpkg version` reports 2025-11-19) - Android SDK: `C:\Users\omara\AppData\Local\Android\Sdk` - Android NDK: `C:\Users\omara\AppData\Local\Android\Sdk\ndk\29.0.14206865` +- clang-cl: `C:\Program Files\LLVM\bin\clang-cl.exe` reports 18.1.8, but the + selected VS 2026-preview STL expects Clang 20 or newer; see DEBT-0014 before + treating `windows-clangcl-asan` as a passing sanitizer gate. - Android arm64 headless configure/build passes through root CMake and the `platform-build` automation wrapper for `pp_foundation`, `pp_assets`, `pp_paint`, `pp_document`, `pp_renderer_api`, `pp_paint_renderer`, diff --git a/docs/modernization/debt.md b/docs/modernization/debt.md index b152cd5..9b0ce1a 100644 --- a/docs/modernization/debt.md +++ b/docs/modernization/debt.md @@ -32,6 +32,7 @@ agent or engineer to remove them without reconstructing context from chat. | DEBT-0011 | Open | Modernization | `package-smoke` validates the Windows CMake app artifact only, not AppX/APK/Apple/WebGL package outputs | Platform package targets are not migrated to root CMake yet | `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Package-smoke covers Windows AppX, Android APK variants, Apple bundles, and WebGL output where local toolchains are present | | DEBT-0012 | Open | Modernization | `pp_ui_core` uses vcpkg tinyxml2 on `windows-msvc-vcpkg-headless`, but retains `pp_vendor_tinyxml2` for default and unproven platform presets | Mobile/AppX/Apple triplets and app packaging still need validation before removing the vendored fallback | `ctest --preset desktop-fast-vcpkg --build-config Debug`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\platform-build.ps1 -Presets android-arm64` | All supported presets consume vcpkg tinyxml2 or document a permanent vendored exception | | DEBT-0013 | Open | Modernization | `pp_assets` and `pano_cli inspect-project` recognize only the fixed PPI header, not thumbnail bytes or the project body | Full PPI parsing requires staged extraction of legacy `Canvas` serialization and image/layer payload handling | `ctest --preset desktop-fast --build-config Debug`; `pp_assets_ppi_header_tests` | Full PPI load/save fixtures cover thumbnail, layers, frames, metadata, corrupt payloads, and round-trip compatibility | +| DEBT-0014 | Open | Modernization | `windows-clangcl-asan` now configures as a headless Ninja/clang-cl preset and uses the release MSVC runtime required by ASan, but local builds still fail because installed clang-cl 18.1.8 is paired with VS 2026-preview STL headers that require Clang 20 or newer | Sanitizer validation should be local and repeatable, but this machine's compiler/header pairing is incompatible | `cmake --fresh --preset windows-clangcl-asan`; `cmake --build --preset windows-clangcl-asan --target pp_foundation` | Install/use Clang 20+ with the VS 2026 STL, or point the preset at a compatible VS 2022 toolchain, then make `platform-build.ps1 -Presets windows-clangcl-asan` pass for the headless matrix | ## Closed Debt diff --git a/docs/modernization/roadmap.md b/docs/modernization/roadmap.md index 539479f..fcd3ee0 100644 --- a/docs/modernization/roadmap.md +++ b/docs/modernization/roadmap.md @@ -191,7 +191,10 @@ Goal: turn the build into an error-finding system before deep refactors. Status: in progress. Initial warning/sanitizer option targets, `vcpkg.json`, a validated Windows headless vcpkg preset, `pp_ui_core` support for vcpkg tinyxml2 on that preset, and a headless `panopainter_validate_shaders` target -exist. Dependency migration is not complete until remaining component +exist. `windows-clangcl-asan` now configures as a headless Ninja/clang-cl ASan +preset and uses the release MSVC runtime required by clang-cl ASan, but local +ASan builds are blocked by DEBT-0014 until Clang and the selected MSVC STL are +compatible. Dependency migration is not complete until remaining component dependencies and mobile/Apple triplets are validated. Implementation tasks: @@ -545,6 +548,7 @@ ctest --preset desktop-fast-vcpkg --build-config Debug cmake --preset android-arm64 powershell -ExecutionPolicy Bypass -File scripts\automation\platform-build.ps1 -Presets android-arm64 powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug +cmake --fresh --preset windows-clangcl-asan ``` Results: @@ -585,6 +589,10 @@ Results: - `pp_ui_core` built and tested against vcpkg tinyxml2 on `windows-msvc-vcpkg-headless` and against the vendored fallback on `windows-msvc-default` and `android-arm64`. +- `windows-clangcl-asan` configures headlessly with clang-cl 18.1.8 and + release MSVC runtime selection; build remains blocked and debt-tracked in + DEBT-0014 because the selected VS 2026-preview STL requires Clang 20 or + newer. - `PanoPainter.exe` built through CMake at `out/build/windows-msvc-default/Debug/PanoPainter.exe`. - PowerShell build/test automation wrappers return JSON summaries and passed