From 8fa61e1cf9955ca3f03bb4dded64bf5d47262252 Mon Sep 17 00:00:00 2001 From: luncliff Date: Tue, 29 Oct 2024 17:17:33 +0900 Subject: [PATCH] [libtorch] fixing macos build --- ports/libtorch/fix-cmake.patch | 15 +++++++++++++++ ports/libtorch/fix-sources.patch | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/ports/libtorch/fix-cmake.patch b/ports/libtorch/fix-cmake.patch index 2620457a..d0b56122 100644 --- a/ports/libtorch/fix-cmake.patch +++ b/ports/libtorch/fix-cmake.patch @@ -380,3 +380,18 @@ index 7502685..9c31022 100644 install( FILES ${PROJECT_SOURCE_DIR}/cmake/Modules/FindCUSPARSELT.cmake DESTINATION share/cmake/Caffe2/ +diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt +index 868624c..fa15e6e 100644 +--- a/caffe2/CMakeLists.txt ++++ b/caffe2/CMakeLists.txt +@@ -94,6 +94,10 @@ if(NOT MSVC AND USE_XNNPACK) + add_subdirectory( + "${FXDIV_SOURCE_DIR}" + "${CMAKE_BINARY_DIR}/FXdiv") ++ elseif(NOT TARGET fxdiv AND USE_SYSTEM_FXDIV) ++ find_path(FXDIV_INCLUDE_DIR NAMES fxdiv.h REQUIRED) ++ add_library(fxdiv INTERFACE IMPORTED) ++ set_property(TARGET fxdiv PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${FXDIV_INCLUDE_DIR}") + endif() + endif() + diff --git a/ports/libtorch/fix-sources.patch b/ports/libtorch/fix-sources.patch index f6fce0f2..78bcb212 100644 --- a/ports/libtorch/fix-sources.patch +++ b/ports/libtorch/fix-sources.patch @@ -101,3 +101,15 @@ index d0cb374..ba39498 100644 #include #include +diff --git a/torch/csrc/profiler/util.cpp b/torch/csrc/profiler/util.cpp +index 239d817..c00a828 100644 +--- a/torch/csrc/profiler/util.cpp ++++ b/torch/csrc/profiler/util.cpp +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + + #ifdef USE_KINETO + #include