Skip to content

Commit

Permalink
[libtorch] fixing macos build
Browse files Browse the repository at this point in the history
  • Loading branch information
luncliff committed Nov 2, 2024
1 parent 304aec6 commit 8fa61e1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ports/libtorch/fix-cmake.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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()

12 changes: 12 additions & 0 deletions ports/libtorch/fix-sources.patch
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,15 @@ index d0cb374..ba39498 100644

#include <c10/cuda/CUDAGuard.h>
#include <c10/util/ApproximateClock.h>
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 <c10/util/ArrayRef.h>
#include <c10/util/irange.h>
#include <fmt/format.h>
+#include <fmt/ranges.h>

#ifdef USE_KINETO
#include <libkineto.h>

0 comments on commit 8fa61e1

Please sign in to comment.