deepin-ocr/3rdparty/ncnn/examples/CMakeLists.txt
wangzhengyang 718c41634f feat: 切换后端至PaddleOCR-NCNN,切换工程为CMake
1.项目后端整体迁移至PaddleOCR-NCNN算法,已通过基本的兼容性测试
2.工程改为使用CMake组织,后续为了更好地兼容第三方库,不再提供QMake工程
3.重整权利声明文件,重整代码工程,确保最小化侵权风险

Log: 切换后端至PaddleOCR-NCNN,切换工程为CMake
Change-Id: I4d5d2c5d37505a4a24b389b1a4c5d12f17bfa38c
2022-05-10 10:22:11 +08:00

77 lines
2.7 KiB
CMake

macro(ncnn_add_example name)
add_executable(${name} ${name}.cpp)
if(OpenCV_FOUND)
target_include_directories(${name} PRIVATE ${OpenCV_INCLUDE_DIRS})
target_link_libraries(${name} PRIVATE ncnn ${OpenCV_LIBS})
elseif(NCNN_SIMPLEOCV)
target_compile_definitions(${name} PUBLIC USE_NCNN_SIMPLEOCV)
target_link_libraries(${name} PRIVATE ncnn)
endif()
# add test to a virtual project group
set_property(TARGET ${name} PROPERTY FOLDER "examples")
endmacro()
if(NCNN_PIXEL)
if(NOT NCNN_SIMPLEOCV)
find_package(OpenCV QUIET COMPONENTS opencv_world)
# for opencv 2.4 on ubuntu 16.04, there is no opencv_world but OpenCV_FOUND will be TRUE
if("${OpenCV_LIBS}" STREQUAL "")
set(OpenCV_FOUND FALSE)
endif()
if(NOT OpenCV_FOUND)
find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs videoio)
endif()
if(NOT OpenCV_FOUND)
find_package(OpenCV QUIET COMPONENTS core highgui imgproc)
endif()
endif()
if(OpenCV_FOUND OR NCNN_SIMPLEOCV)
if(OpenCV_FOUND)
message(STATUS "OpenCV library: ${OpenCV_INSTALL_PATH}")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}")
if(${OpenCV_VERSION_MAJOR} GREATER 3)
set(CMAKE_CXX_STANDARD 11)
endif()
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
ncnn_add_example(squeezenet)
ncnn_add_example(squeezenet_c_api)
ncnn_add_example(fasterrcnn)
ncnn_add_example(rfcn)
ncnn_add_example(yolov2)
ncnn_add_example(yolov3)
ncnn_add_example(yolov5)
ncnn_add_example(yolov5_pnnx)
ncnn_add_example(yolox)
ncnn_add_example(mobilenetv2ssdlite)
ncnn_add_example(mobilenetssd)
ncnn_add_example(squeezenetssd)
ncnn_add_example(shufflenetv2)
ncnn_add_example(peleenetssd_seg)
ncnn_add_example(simplepose)
ncnn_add_example(retinaface)
ncnn_add_example(yolact)
ncnn_add_example(nanodet)
ncnn_add_example(nanodetplus_pnnx)
ncnn_add_example(scrfd)
ncnn_add_example(scrfd_crowdhuman)
if(OpenCV_FOUND)
ncnn_add_example(yolov4)
ncnn_add_example(rvm)
ncnn_add_example(p2pnet)
endif()
else()
message(WARNING "OpenCV not found and NCNN_SIMPLEOCV disabled, examples won't be built")
endif()
else()
message(WARNING "NCNN_PIXEL not enabled, examples won't be built")
endif()