From bc1616a65cfe552516ce62f81ead48e45c85e18c Mon Sep 17 00:00:00 2001 From: Xu Han Date: Tue, 17 Dec 2024 11:03:09 -0800 Subject: [PATCH] fix cmake can't find pti_view on Windows. (#1012) Summary: On Windows, we need to add version number to find pti_view: Image Local validate passed: image Pull Request resolved: https://github.com/pytorch/kineto/pull/1012 Reviewed By: aaronenyeshi, sanrise Differential Revision: D67301182 Pulled By: sraikund16 fbshipit-source-id: f2c644ee5308c3263e9a7dbdbe1e104c19cee8e6 --- libkineto/src/plugin/xpupti/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libkineto/src/plugin/xpupti/CMakeLists.txt b/libkineto/src/plugin/xpupti/CMakeLists.txt index aabb93663..45dae60db 100644 --- a/libkineto/src/plugin/xpupti/CMakeLists.txt +++ b/libkineto/src/plugin/xpupti/CMakeLists.txt @@ -24,8 +24,18 @@ find_package(Pti REQUIRED) if(TARGET Pti::pti_view) message(INFO " Found XPUPTI") + set(pti_view_names) + # For Linux, due to it has soft link original file name is fine. + list(APPEND pti_view_names pti_view) + # For Windows, file name to be appended with version number. + foreach(ver_major RANGE 0 1) + foreach(ver_minor RANGE 0 19) + list(APPEND pti_view_names pti_view-${ver_major}-${ver_minor}) + endforeach() + endforeach() + get_target_property(PTI_INCLUDE_DIR Pti::pti_view INTERFACE_INCLUDE_DIRECTORIES) - find_library(PTI_VIEW_LIBRARY NAMES pti_view PATHS "${PTI_INCLUDE_DIR}/../lib") + find_library(PTI_VIEW_LIBRARY NAMES ${pti_view_names} PATHS "${PTI_INCLUDE_DIR}/../lib") set(PTI_LIBRARY ${PTI_VIEW_LIBRARY} CACHE STRING "Imported PTI library.") set(PTI_INCLUDE_DIR ${PTI_INCLUDE_DIR} CACHE STRING "PTI include directory.")