From 626f10873b5b45a330c8365e380e203c6ce00a1a Mon Sep 17 00:00:00 2001 From: Tom Honermann Date: Sat, 13 Sep 2025 07:47:57 -0700 Subject: [PATCH] [UR][XPTI] Fix RelWithDebInfo and MinSizeRel builds on Windows. CMake RelWithDebInfo builds failed on Windows because the Unified Runtime attempted to link with a Debug build of XPTI. Fortunately, the mismatch was detected by lld-link and it failed the build with the following error: error: /failifmismatch: mismatch detected for '_ITERATOR_DEBUG_LEVEL' The mismatch was due to a CMake generator expression in the Unified Runtime CMakeLists.txt that failed to account for RelWithDebInfo and MinSizeRel builds. Investigation of the above also resulted in the identification of an issue in the XPTI CMakeLists.txt file; use of `CMAKE_CXX_FLAGS_MINSIZEREL` for a RelWithDebInfo build and `CMAKE_CXX_FLAGS_RELWITHDEBINFO` for a MinSizeRel build. --- unified-runtime/CMakeLists.txt | 2 +- xpti/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unified-runtime/CMakeLists.txt b/unified-runtime/CMakeLists.txt index ff9e0d2b554c..9115f52617c4 100644 --- a/unified-runtime/CMakeLists.txt +++ b/unified-runtime/CMakeLists.txt @@ -225,7 +225,7 @@ if(UR_ENABLE_TRACING) endif() if (MSVC) - set(TARGET_XPTI $,xpti,xptid>) + set(TARGET_XPTI $,xpti,xptid>) else() set(TARGET_XPTI xpti) endif() diff --git a/xpti/CMakeLists.txt b/xpti/CMakeLists.txt index 1cf74b98a538..50f84fef817e 100644 --- a/xpti/CMakeLists.txt +++ b/xpti/CMakeLists.txt @@ -35,9 +35,9 @@ if (MSVC) if (CMAKE_BUILD_TYPE MATCHES "Release") set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}") elseif (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo") - set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_MINSIZEREL}") - elseif (CMAKE_BUILD_TYPE MATCHES "MinSizeRel") set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + elseif (CMAKE_BUILD_TYPE MATCHES "MinSizeRel") + set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_MINSIZEREL}") endif() string(REPLACE "/MD" "" XPTI_CXX_FLAGS "${XPTI_CXX_FLAGS}") string(REPLACE "/MT" "" XPTI_CXX_FLAGS "${XPTI_CXX_FLAGS}")