SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cmake_minimum_required(VERSION 2.8)
  2. project(VisionCOre)
  3.  
  4. add_compile_options(-std=c++14)
  5. add_compile_options(-g)
  6.  
  7. # setup OpenCV
  8. find_package(OpenCV REQUIRED)
  9.  
  10. # setup ZED
  11. option(LINK_SHARED_ZED "Link with the ZED SDK shared executable" ON)
  12. if (NOT LINK_SHARED_ZED AND MSVC)
  13.     message(FATAL_ERROR "LINK_SHARED_ZED OFF : ZED SDK static libraries not available on Windows")
  14. endif()
  15.  
  16. find_package(ZED 2 REQUIRED)
  17.  
  18. # setup tensorRT flags
  19. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  20. set(BUILD_DEPS "YES" CACHE BOOL "If YES, will install dependencies into sandbox.  Automatically reset to NO after dependencies are installed.")
  21.  
  22. # setup CUDA
  23. find_package(CUDA)
  24. message("-- CUDA version: ${CUDA_VERSION}")
  25.  
  26. set(
  27.     CUDA_NVCC_FLAGS
  28.     ${CUDA_NVCC_FLAGS};
  29.     -O3
  30.     -gencode arch=compute_53,code=sm_53
  31.     -gencode arch=compute_62,code=sm_62
  32. )
  33.  
  34. if(CUDA_VERSION_MAJOR GREATER 9)
  35.     message("-- CUDA ${CUDA_VERSION_MAJOR} detected, enabling SM_72")
  36.  
  37.     set(
  38.         CUDA_NVCC_FLAGS
  39.         ${CUDA_NVCC_FLAGS};
  40.         -gencode arch=compute_72,code=sm_72
  41.     )
  42. endif()
  43.  
  44. include_directories(
  45.     src
  46.     /usr/local/cuda/include
  47.     ${ZED_INCLUDE_DIRS}
  48. )
  49.  
  50. link_directories(${ZED_LIBRARY_DIR})
  51. link_directories(${CUDA_LIBRARY_DIRS})
  52.  
  53. set(SOURCES
  54.     src/Main.cpp
  55. )
  56.  
  57. if (LINK_SHARED_ZED)
  58.     SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY} ${CUDA_NPP_LIBRARIES_ZED})
  59. else()
  60.     SET(ZED_LIBS ${ZED_STATIC_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_LIBRARY})
  61. endif()
  62.  
  63. add_executable(Main ${SOURCES})
  64. target_link_libraries(Main nvinfer nvinfer_plugin nvonnxparser
  65.     pthread ${ZED_LIBS} ${OpenCV_LIBS})
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top