Skip to content

Commit 05ea3e9

Browse files
authored
[UR][XPTI] Fix RelWithDebInfo and MinSizeRel builds on Windows. (#20078)
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.
1 parent dcd4720 commit 05ea3e9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

unified-runtime/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ if(UR_ENABLE_TRACING)
225225
endif()
226226

227227
if (MSVC)
228-
set(TARGET_XPTI $<IF:$<CONFIG:Release>,xpti,xptid>)
228+
set(TARGET_XPTI $<IF:$<CONFIG:Release,RelWithDebInfo,MinSizeRel>,xpti,xptid>)
229229
else()
230230
set(TARGET_XPTI xpti)
231231
endif()

xpti/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ if (MSVC)
3535
if (CMAKE_BUILD_TYPE MATCHES "Release")
3636
set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELEASE}")
3737
elseif (CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
38-
set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_MINSIZEREL}")
39-
elseif (CMAKE_BUILD_TYPE MATCHES "MinSizeRel")
4038
set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
39+
elseif (CMAKE_BUILD_TYPE MATCHES "MinSizeRel")
40+
set(XPTI_CXX_FLAGS "${CMAKE_CXX_FLAGS_MINSIZEREL}")
4141
endif()
4242
string(REPLACE "/MD" "" XPTI_CXX_FLAGS "${XPTI_CXX_FLAGS}")
4343
string(REPLACE "/MT" "" XPTI_CXX_FLAGS "${XPTI_CXX_FLAGS}")

0 commit comments

Comments
 (0)