diff --git a/projects/miopen/CMakeLists.txt b/projects/miopen/CMakeLists.txt index af87cd1c7e16..c522831d81f0 100644 --- a/projects/miopen/CMakeLists.txt +++ b/projects/miopen/CMakeLists.txt @@ -93,6 +93,28 @@ if(MIOPEN_ENABLE_SQLITE) endif() find_package(BZip2 REQUIRED) find_package(nlohmann_json 3.9.1 REQUIRED) + +# Workaround: TheRock's prebuilt nlohmann_json artifact may be missing the +# natvis file (a Visual Studio debug visualizer) referenced by +# INTERFACE_SOURCES. Drop it from the imported target only if the file +# doesn't exist on disk. Once the artifact is fixed upstream, the file +# will be present and the property is left untouched. +if(TARGET nlohmann_json::nlohmann_json) + get_target_property(_njson_srcs nlohmann_json::nlohmann_json INTERFACE_SOURCES) + if(_njson_srcs) + set(_njson_filtered "${_njson_srcs}") + foreach(_src IN LISTS _njson_srcs) + string(GENEX_STRIP "${_src}" _src_plain) + if(_src_plain MATCHES "\\.natvis$" AND NOT EXISTS "${_src_plain}") + message(STATUS "nlohmann_json: dropping missing natvis entry: ${_src_plain}") + list(REMOVE_ITEM _njson_filtered "${_src}") + endif() + endforeach() + set_property(TARGET nlohmann_json::nlohmann_json + PROPERTY INTERFACE_SOURCES "${_njson_filtered}") + endif() +endif() + if(MIOPEN_ENABLE_SQLITE_KERN_CACHE AND NOT MIOPEN_ENABLE_SQLITE) message(FATAL_ERROR "MIOPEN_ENABLE_SQLITE_KERN_CACHE requires MIOPEN_ENABLE_SQLITE") endif() diff --git a/projects/miopen/addkernels/CMakeLists.txt b/projects/miopen/addkernels/CMakeLists.txt index 65ed95a61116..9028dd68d1d9 100644 --- a/projects/miopen/addkernels/CMakeLists.txt +++ b/projects/miopen/addkernels/CMakeLists.txt @@ -3,6 +3,10 @@ set(ADD_KERNELS_SOURCE include_inliner.cpp addkernels.cpp) +if(WIN32) + list(APPEND ADD_KERNELS_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/longpath.manifest) +endif() + add_executable(addkernels EXCLUDE_FROM_ALL ${ADD_KERNELS_SOURCE}) target_include_directories(addkernels PRIVATE ${PROJECT_SOURCE_DIR}/src/include) if(HAS_LIB_STD_FILESYSTEM) diff --git a/projects/miopen/addkernels/longpath.manifest b/projects/miopen/addkernels/longpath.manifest new file mode 100644 index 000000000000..1536e544d906 --- /dev/null +++ b/projects/miopen/addkernels/longpath.manifest @@ -0,0 +1,8 @@ + + + + + true + + +