Export XPU libs to be public (#136974)

# Motivation
Export XPU-related libs to be public. Now they are included in `TORCH_LIBRARIES`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/136974
Approved by: https://github.com/EikanWang, https://github.com/malfet
This commit is contained in:
Yu, Guangye
2024-10-15 16:48:13 +00:00
committed by PyTorch MergeBot
parent 80f3ee41dc
commit 2c94c54f10

View File

@ -75,6 +75,9 @@ else()
if(@USE_CUDA@)
append_wholearchive_lib_if_found(torch_cuda c10_cuda)
endif()
if(@USE_XPU@)
append_wholearchive_lib_if_found(torch_xpu c10_xpu)
endif()
# We need manually add dependent libraries when they are not linked into the
# shared library.
@ -138,6 +141,10 @@ if(@USE_CUDA@)
list(APPEND TORCH_LIBRARIES ${TORCH_CUDA_LIBRARIES})
endif()
if(@USE_XPU@ AND @BUILD_SHARED_LIBS@)
append_torchlib_if_found(c10_xpu torch_xpu)
endif()
# When we build libtorch with the old libstdc++ ABI, dependent libraries must too.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TORCH_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=@GLIBCXX_USE_CXX11_ABI@")