Unverified Commit fc6f0b9e authored by nv-dlasalle's avatar nv-dlasalle Committed by GitHub
Browse files

[bugfix] Link against pytorch library by name rather than path (attempting to...


[bugfix] Link against pytorch library by name rather than path (attempting to fix linking issue). (#3246)

* Use library name

* fix for mac builds from source
Co-authored-by: default avatarQuan (Andy) Gan <coin2028@hotmail.com>
parent ea06688e
...@@ -27,12 +27,8 @@ set(TORCH_TARGET_NAME "tensoradapter_pytorch_${TORCH_VER}") ...@@ -27,12 +27,8 @@ set(TORCH_TARGET_NAME "tensoradapter_pytorch_${TORCH_VER}")
file(GLOB TA_TORCH_SRC *.cpp) file(GLOB TA_TORCH_SRC *.cpp)
add_library(${TORCH_TARGET_NAME} SHARED "${TA_TORCH_SRC}") add_library(${TORCH_TARGET_NAME} SHARED "${TA_TORCH_SRC}")
if (MSVC) # use the library name rather than the path
# Linking on windows requires all libraries set(TENSORADAPTER_TORCH_LIBS torch)
set(TENSORADAPTER_TORCH_LIBS ${TORCH_LIBRARIES})
else()
set(TENSORADAPTER_TORCH_LIBS ${TORCH_LIBRARY})
endif(MSVC)
message(STATUS "tensoradapter found PyTorch includes: ${TORCH_INCLUDE_DIRS}") message(STATUS "tensoradapter found PyTorch includes: ${TORCH_INCLUDE_DIRS}")
message(STATUS "tensoradapter found PyTorch lib: ${TENSORADAPTER_TORCH_LIBS}") message(STATUS "tensoradapter found PyTorch lib: ${TENSORADAPTER_TORCH_LIBS}")
......
...@@ -18,7 +18,7 @@ CMAKE_FLAGS="-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_TOOLKIT_ROOT_DIR -DTORCH_CUDA_ARCH_LI ...@@ -18,7 +18,7 @@ CMAKE_FLAGS="-DCUDA_TOOLKIT_ROOT_DIR=$CUDA_TOOLKIT_ROOT_DIR -DTORCH_CUDA_ARCH_LI
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
$CMAKE_COMMAND $CMAKE_FLAGS .. $CMAKE_COMMAND $CMAKE_FLAGS ..
make -j make -j
cp -v *.so $BINDIR/tensoradapter/pytorch cp -v $CPSOURCE $BINDIR/tensoradapter/pytorch
else else
for PYTHON_INTERP in $@; do for PYTHON_INTERP in $@; do
rm -rf * rm -rf *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment