summaryrefslogtreecommitdiff
path: root/sci-ml/pytorch/files/pytorch-2.13.0-unbundle_httplib.patch
blob: 25edd9c6f2a8077f6aaf2bdac5d27f474d74014f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Link to system shared httplib instead of using bundled header-only version

Bug: https://bugs.gentoo.org/980398
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -1338,8 +1338,9 @@ if(USE_KINETO)
     ${TORCH_ROOT}/third_party/kineto/libkineto/src)
 endif()
 
-target_include_directories(torch_cpu PRIVATE
-  ${TORCH_ROOT}/third_party/cpp-httplib)
+if(USE_DISTRIBUTED)
+  target_link_libraries(torch_cpu PRIVATE httplib::httplib)
+endif()
 
 target_include_directories(torch_cpu PRIVATE
   ${TORCH_ROOT}/third_party/nlohmann/include)
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -1717,8 +1717,9 @@ endif()
 include(${CMAKE_CURRENT_LIST_DIR}/FlatBuffers.cmake)
 
 # Include cpp-httplib
-add_library(httplib INTERFACE IMPORTED)
-target_include_directories(httplib SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/third_party/cpp-httplib)
+if(USE_DISTRIBUTED)
+  find_package(httplib REQUIRED)
+endif()
 
 # Include nlohmann-json
 add_library(nlohmann INTERFACE IMPORTED)
--- a/torch/CMakeLists.txt
+++ b/torch/CMakeLists.txt
@@ -78,13 +78,16 @@ list(APPEND TORCH_PYTHON_INCLUDE_DIRECTORIES ${LIBSHM_SRCDIR})
 set(TORCH_PYTHON_LINK_LIBRARIES
     Python::Module
     pybind::pybind11
-    httplib
     nlohmann
     moodycamel
     shm
     fmt
     ATEN_CPU_FILES_GEN_LIB)
 
+if(USE_DISTRIBUTED)
+  list(APPEND TORCH_PYTHON_LINK_LIBRARIES httplib::httplib)
+endif()
+
 if(USE_ASAN AND TARGET Sanitizer::address)
   list(APPEND TORCH_PYTHON_LINK_LIBRARIES Sanitizer::address)
 endif()