| 1 | |
| 2 | if(NCNN_PIXEL) |
| 3 | if(NOT NCNN_SIMPLEOCV) |
| 4 | find_package(OpenCV QUIET COMPONENTS opencv_world) |
| 5 | # for opencv 2.4 on ubuntu 16.04, there is no opencv_world but OpenCV_FOUND will be TRUE |
| 6 | if("${OpenCV_LIBS}" STREQUAL "") |
| 7 | set(OpenCV_FOUND FALSE) |
| 8 | endif() |
| 9 | if(NOT OpenCV_FOUND) |
| 10 | find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs) |
| 11 | endif() |
| 12 | if(NOT OpenCV_FOUND) |
| 13 | find_package(OpenCV QUIET COMPONENTS core highgui imgproc) |
| 14 | endif() |
| 15 | endif() |
| 16 | |
| 17 | set(OpenCV_FOUND FALSE) |
| 18 | |
| 19 | if(OpenCV_FOUND) |
| 20 | add_executable(ncnn2table ncnn2table.cpp) |
| 21 | target_include_directories(ncnn2table PRIVATE ${OpenCV_INCLUDE_DIRS}) |
| 22 | target_link_libraries(ncnn2table PRIVATE ncnn ${OpenCV_LIBS}) |
| 23 | elseif(NCNN_SIMPLEOCV) |
| 24 | add_executable(ncnn2table ncnn2table.cpp) |
| 25 | target_compile_definitions(ncnn2table PUBLIC USE_NCNN_SIMPLEOCV) |
| 26 | target_link_libraries(ncnn2table PRIVATE ncnn) |
| 27 | else() |
| 28 | add_executable(ncnn2table ncnn2table.cpp imreadwrite.cpp) |
| 29 | target_compile_definitions(ncnn2table PUBLIC USE_LOCAL_IMREADWRITE) |
| 30 | target_link_libraries(ncnn2table PRIVATE ncnn) |
| 31 | endif() |
| 32 | |
| 33 | # add ncnn2table tool to a virtual project group |
| 34 | set_property(TARGET ncnn2table PROPERTY FOLDER "tools/optimization") |
| 35 | endif() |
| 36 | |
| 37 | add_executable(ncnn2int8 ncnn2int8.cpp) |
| 38 | target_link_libraries(ncnn2int8 PRIVATE ncnn) |
| 39 | |
| 40 | # add ncnn2int8 tool to a virtual project group |
| 41 | set_property(TARGET ncnn2int8 PROPERTY FOLDER "tools/optimization") |
| 42 | ncnn_install_tool(ncnn2table) |
| 43 | ncnn_install_tool(ncnn2int8) |