CMakeLists.txt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # ---[ OpenCV
  2. set(OpenCV_FIND_QUIETLY true)
  3. find_package(OpenCV OPTIONAL_COMPONENTS imgcodecs)
  4. set(imgcodecs_libs ${OpenCV_LIBS})
  5. find_package(OpenCV REQUIRED core imgproc highgui features2d)
  6. if(OpenCV_FOUND)
  7. message(STATUS "OpenCV Found")
  8. else()
  9. message(FATAL_ERROR "Can not find OpenCV libs!")
  10. endif()
  11. if(imgcodecs_FOUND)
  12. list(APPEND OpenCV_LIBS ${imgcodecs_libs})
  13. endif()
  14. list(APPEND LINK_LIBS dl pthread gtest gtest_main ${OpenCV_LIBS} easydk cnis)
  15. # ---[ api tests
  16. file(GLOB apitest_srcs ${CMAKE_CURRENT_SOURCE_DIR}/api/*.cpp)
  17. add_executable(apitest_cnis ${apitest_srcs})
  18. add_sanitizers(apitest_cnis)
  19. if (CNIS_WITH_CONTRIB)
  20. target_compile_definitions(apitest_cnis PRIVATE CNIS_WITH_CONTRIB)
  21. if (CNIS_WITH_CNCV)
  22. target_compile_definitions(apitest_cnis PRIVATE CNIS_HAVE_CNCV)
  23. endif()
  24. endif()
  25. target_include_directories(apitest_cnis PRIVATE
  26. ${NEUWARE_INCLUDE_DIR}
  27. ${CMAKE_CURRENT_SOURCE_DIR}/../../include
  28. ${CMAKE_CURRENT_SOURCE_DIR}/../include
  29. ${CMAKE_CURRENT_SOURCE_DIR}/../src
  30. ${CMAKE_CURRENT_SOURCE_DIR}/common
  31. ${CMAKE_CURRENT_SOURCE_DIR}/api
  32. ${OpenCV_INCLUDE_DIRS})
  33. target_link_libraries(apitest_cnis ${LINK_LIBS})
  34. target_compile_options(apitest_cnis PRIVATE "-Wno-deprecated-declarations")
  35. # ---[ unit tests
  36. file(GLOB unittest_srcs ${CMAKE_CURRENT_SOURCE_DIR}/unit/*.cpp)
  37. add_executable(unittest_cnis ${unittest_srcs})
  38. add_sanitizers(unittest_cnis)
  39. if (CNIS_RECORD_PERF)
  40. target_compile_definitions(unittest_cnis PRIVATE CNIS_RECORD_PERF)
  41. endif()
  42. target_include_directories(unittest_cnis PRIVATE
  43. ${NEUWARE_INCLUDE_DIR}
  44. ${CMAKE_CURRENT_SOURCE_DIR}/../../include
  45. ${CMAKE_CURRENT_SOURCE_DIR}/../include
  46. ${CMAKE_CURRENT_SOURCE_DIR}/../src
  47. ${CMAKE_CURRENT_SOURCE_DIR}/common
  48. ${CMAKE_CURRENT_SOURCE_DIR}/unit
  49. ${OpenCV_INCLUDE_DIRS})
  50. target_link_libraries(unittest_cnis ${LINK_LIBS})
  51. target_compile_options(unittest_cnis PRIVATE "-Wno-deprecated-declarations")