Skip to content

Commit

Permalink
fix(cmake): fix PyTorch_LIBRARY_PATH
Browse files Browse the repository at this point in the history
The previous `PyTorch_LIBRARY_PATH` in deepmodeling#3636 is wrong: `BACKEND_INCLUDE_DIRS` is a list of paths instead of a single path.

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Jun 20, 2024
1 parent 0c472d1 commit 6d150ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ if(ENABLE_PYTORCH AND NOT DEEPMD_C_ROOT)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=${OP_CXX_ABI})
endif()
endif()
# get torch directory
set(PyTorch_LIBRARY_PATH ${TORCH_INCLUDE_DIRS}/../lib)
# get torch directory get the directory of the target "torch"
get_target_property(_TORCH_LOCATION torch LOCATION)
get_filename_component(PyTorch_LIBRARY_PATH ${_TORCH_LOCATION} DIRECTORY)
list(APPEND BACKEND_LIBRARY_PATH ${PyTorch_LIBRARY_PATH})
list(APPEND BACKEND_INCLUDE_DIRS ${TORCH_INCLUDE_DIRS})
endif()
Expand Down

0 comments on commit 6d150ab

Please sign in to comment.