diff --git a/cmake/SetupLibTorch.cmake b/cmake/SetupLibTorch.cmake index 08fa362..e3203bf 100644 --- a/cmake/SetupLibTorch.cmake +++ b/cmake/SetupLibTorch.cmake @@ -1,4 +1,21 @@ -set(LIBTORCH_VERSION 2.4.1) +if(APPLE) + if (CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") + set(LIBTORCH_VERSION 2.2.2) + # torch stopped uploading the binaries for x86_64, so we use an older version + elseif (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") + set(LIBTORCH_VERSION 2.4.1) + else() + if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(LIBTORCH_VERSION 2.2.2) + elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64") + set(LIBTORCH_VERSION 2.4.1) + else() + message(FATAL_ERROR "CMAKE_OSX_ARCHITECTURES and CMAKE_HOST_SYSTEM_PROCESSOR not defined.") + endif() + endif() +else() + set(LIBTORCH_VERSION 2.4.1) +endif() if (NOT WIN32) set(TORCH_BUILD_TYPE "")