Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

CMakeLists.txt 1.2 KB

You have to be logged in to leave a comment. Sign In
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
  1. cmake_minimum_required(VERSION 3.4.1)
  2. set(TARGET torchvision_ops)
  3. project(${TARGET} CXX)
  4. set(CMAKE_CXX_STANDARD 17)
  5. string(APPEND CMAKE_CXX_FLAGS " -DMOBILE")
  6. set(build_DIR ${CMAKE_SOURCE_DIR}/build)
  7. set(root_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
  8. file(GLOB VISION_SRCS
  9. ../../torchvision/csrc/ops/cpu/*.h
  10. ../../torchvision/csrc/ops/cpu/*.cpp
  11. ../../torchvision/csrc/ops/*.h
  12. ../../torchvision/csrc/ops/*.cpp)
  13. add_library(${TARGET} SHARED
  14. ${VISION_SRCS}
  15. )
  16. file(GLOB PYTORCH_INCLUDE_DIRS "${build_DIR}/pytorch_android*.aar/headers")
  17. file(GLOB PYTORCH_INCLUDE_DIRS_CSRC "${build_DIR}/pytorch_android*.aar/headers/torch/csrc/api/include")
  18. file(GLOB PYTORCH_LINK_DIRS "${build_DIR}/pytorch_android*.aar/jni/${ANDROID_ABI}")
  19. target_compile_options(${TARGET} PRIVATE
  20. -fexceptions
  21. )
  22. set(BUILD_SUBDIR ${ANDROID_ABI})
  23. find_library(PYTORCH_LIBRARY pytorch_jni
  24. PATHS ${PYTORCH_LINK_DIRS}
  25. NO_CMAKE_FIND_ROOT_PATH)
  26. find_library(FBJNI_LIBRARY fbjni
  27. PATHS ${PYTORCH_LINK_DIRS}
  28. NO_CMAKE_FIND_ROOT_PATH)
  29. target_include_directories(${TARGET} PRIVATE
  30. ${PYTORCH_INCLUDE_DIRS}
  31. ${PYTORCH_INCLUDE_DIRS_CSRC}
  32. )
  33. target_link_libraries(${TARGET} PRIVATE
  34. ${PYTORCH_LIBRARY}
  35. ${FBJNI_LIBRARY}
  36. )
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...