[cmake] add HAVE_SOVERSION option (default=OFF). (#37502)

Summary:
This is useful for linux distributions when the ABI/API of libtorch has
been changed. The default SOVERSION is set to
"${TORCH_VERSION_MAJOR}.${TORCH_VERSION_MINOR}".

ezyang

But if the release strategy of pytorch/caffe2 involves avoiding breaking API/ABI changes to libtorch for minor/patch releases, then we can set `TORCH_SOVERSION` to simply `TORCH_VERSION_MAJOR`. Please confirm that.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37502

Differential Revision: D21303565

Pulled By: ezyang

fbshipit-source-id: 798f5ec7fc5f0431ff1a7f9e8e5d3a0d3b25bb22
This commit is contained in:
Mo Zhou
2020-04-30 06:50:03 -07:00
committed by Facebook GitHub Bot
parent 4c8636c74c
commit 69e2f1aaff
8 changed files with 38 additions and 0 deletions

View File

@ -23,6 +23,10 @@ else()
endif()
add_library(shm SHARED core.cpp)
if(HAVE_SOVERSION)
set_target_properties(shm PROPERTIES
VERSION ${TORCH_VERSION} SOVERSION ${TORCH_SOVERSION})
endif()
target_include_directories(shm PUBLIC
${CMAKE_BINARY_DIR}/aten/src # provides "ATen/TypeExtendedInterface.h" to ATen.h