-
Notifications
You must be signed in to change notification settings - Fork 34
/
vision-0.20.0-ops-only.patch
45 lines (38 loc) · 1.71 KB
/
vision-0.20.0-ops-only.patch
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
diff -Nuarp vision-0.20.0.orig/cmake/TorchVisionConfig.cmake.in vision-0.20.0/cmake/TorchVisionConfig.cmake.in
--- vision-0.20.0.orig/cmake/TorchVisionConfig.cmake.in 2024-10-04 15:47:50.000000000 +0800
+++ vision-0.20.0/cmake/TorchVisionConfig.cmake.in 2024-10-18 16:05:53.875325456 +0800
@@ -31,7 +31,9 @@ if(@WITH_CUDA@)
target_compile_definitions(${PN}::${PN} INTERFACE WITH_CUDA)
endif()
-find_package(Torch REQUIRED)
+if(NOT TARGET torch)
+ find_package(Torch REQUIRED)
+endif()
target_link_libraries(${PN}::${PN} INTERFACE torch)
if(@WITH_PNG@)
diff -Nuarp vision-0.20.0.orig/CMakeLists.txt vision-0.20.0/CMakeLists.txt
--- vision-0.20.0.orig/CMakeLists.txt 2024-10-04 15:47:50.000000000 +0800
+++ vision-0.20.0/CMakeLists.txt 2024-10-18 16:06:42.720327786 +0800
@@ -27,6 +27,7 @@ if(WITH_MPS)
endif()
find_package(Torch REQUIRED)
+include_directories(${TORCH_INCLUDE_DIRS})
if (WITH_PNG)
add_definitions(-DPNG_FOUND)
@@ -90,8 +91,8 @@ include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(TVCPP torchvision/csrc)
-list(APPEND ALLOW_LISTED ${TVCPP} ${TVCPP}/io/image ${TVCPP}/io/image/cpu ${TVCPP}/io/image/cpu/giflib ${TVCPP}/models ${TVCPP}/ops
- ${TVCPP}/ops/autograd ${TVCPP}/ops/cpu ${TVCPP}/io/image/cuda)
+list(APPEND ALLOW_LISTED ${TVCPP} ${TVCPP}/ops
+ ${TVCPP}/ops/autograd ${TVCPP}/ops/cpu)
if(WITH_CUDA)
list(APPEND ALLOW_LISTED ${TVCPP}/ops/cuda ${TVCPP}/ops/autocast)
endif()
@@ -103,7 +104,7 @@ FOREACH(DIR ${ALLOW_LISTED})
file(GLOB ALL_SOURCES ${ALL_SOURCES} ${DIR}/*.*)
ENDFOREACH()
-add_library(${PROJECT_NAME} SHARED ${ALL_SOURCES})
+add_library(${PROJECT_NAME} STATIC ${ALL_SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${TORCH_LIBRARIES})
if(WITH_MPS)