1- cmake_minimum_required (VERSION 3.10 )
1+ cmake_minimum_required (VERSION 3.11 )
22
33project (Diligent-GraphicsEngineD3D12 CXX)
44
@@ -212,9 +212,23 @@ source_group("shaders" FILES
212212 shaders/GenerateMips/GenerateMipsCS.hlsli
213213)
214214
215- # User can download WinPixEventRuntime from https://www.nuget.org/packages/WinPixEventRuntime
216- set (DILIGENT_PIX_EVENT_RUNTIME_PATH "" CACHE PATH "Path to WinPixEventRuntime to enable Direct3D12 debug utils" )
217- if (EXISTS "${DILIGENT_PIX_EVENT_RUNTIME_PATH} " )
215+ option (DILIGENT_LOAD_PIX_EVENT_RUNTIME OFF "Download WinPixEventRuntime to enable Direct3D12 debug utils" )
216+ if (${DILIGENT_LOAD_PIX_EVENT_RUNTIME} )
217+ include (FetchContent)
218+ set (DILIGENT_PIX_EVENT_RUNTIME_PATH "${CMAKE_BINARY_DIR} /WinPixEventRuntime" )
219+ FetchContent_Declare(
220+ WinPixEventRuntime
221+ URL "https://www.nuget.org/api/v2/package/WinPixEventRuntime"
222+ DOWNLOAD_DIR ${DILIGENT_PIX_EVENT_RUNTIME_PATH}
223+ LOG_DOWNLOAD 1
224+ SOURCE_DIR ${DILIGENT_PIX_EVENT_RUNTIME_PATH}
225+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E tar -xf "${CMAKE_BINARY_DIR} /WinPixEventRuntime/winpixeventruntime.*.nupkg"
226+ LOG_CONFIGURE 1
227+ )
228+ FetchContent_GetProperties(WinPixEventRuntime)
229+ if (NOT WinPixEventRuntime_POPULATED)
230+ FetchContent_Populate(WinPixEventRuntime)
231+ endif ()
218232 if (EXISTS "${DILIGENT_PIX_EVENT_RUNTIME_PATH} /include/WinPixEventRuntime/pix3.h" )
219233 if (PLATFORM_WIN32 AND ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
220234 set (DILIGENT_PIX_EVENT_RUNTIME_DLL_PATH ${DILIGENT_PIX_EVENT_RUNTIME_PATH} /bin/x64/WinPixEventRuntime.dll)
@@ -241,9 +255,6 @@ if(EXISTS "${DILIGENT_PIX_EVENT_RUNTIME_PATH}")
241255 message (STATUS "'${DILIGENT_PIX_EVENT_RUNTIME_LIB_PATH} ' is not valid. Pix events will be disabled" )
242256 endif ()
243257 endif ()
244- else ()
245- message (STATUS "Path to WinPixEventRuntime '${DILIGENT_PIX_EVENT_RUNTIME_PATH} is not valid, can't find 'pix3.h'" )
246- set (DILIGENT_PIX_EVENT_RUNTIME_PATH_VALID OFF )
247258 endif ()
248259endif ()
249260
0 commit comments