Skip to content

Commit

Permalink
fix cmake can't find pti_view on Windows. (#1012)
Browse files Browse the repository at this point in the history
Summary:
On Windows, we need to add version number to find pti_view:
<img width="297" alt="Image" src="https://github.com/user-attachments/assets/a6ee4a6a-3e06-4557-9a15-4020178428a6">

Local validate passed:
<img width="1118" alt="image" src="https://github.com/user-attachments/assets/befb8388-dd27-46d7-a386-2601411daad3">

Pull Request resolved: #1012

Reviewed By: aaronenyeshi, sanrise

Differential Revision: D67301182

Pulled By: sraikund16

fbshipit-source-id: f2c644ee5308c3263e9a7dbdbe1e104c19cee8e6
  • Loading branch information
xuhancn authored and facebook-github-bot committed Dec 17, 2024
1 parent 1721e96 commit bc1616a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libkineto/src/plugin/xpupti/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

Expand Down

0 comments on commit bc1616a

Please sign in to comment.