use system opencv, cleaner way to use ncnn
This commit is contained in:
parent
1d17781ee6
commit
be2eff7360
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
|
||||||
project(deepin-ocr)
|
project(deepin-ocr)
|
||||||
|
|
||||||
#3rdparty
|
#3rdparty
|
||||||
execute_process(COMMAND sh ${CMAKE_CURRENT_LIST_DIR}/build3rdparty.sh WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
#execute_process(COMMAND sh ${CMAKE_CURRENT_LIST_DIR}/build3rdparty.sh WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
|
||||||
option(DOTEST "option for test" OFF)
|
option(DOTEST "option for test" OFF)
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,22 @@ add_definitions(${QT_DEFINITIONS})
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
#for OpenCV-mobile
|
#for OpenCV-mobile
|
||||||
include_directories(../3rdparty/opencv-4.5.4/build/install/include/opencv4)
|
#include_directories(../3rdparty/opencv-4.5.4/build/install/include/opencv4)
|
||||||
add_library(opencv_world STATIC IMPORTED)
|
#add_library(opencv_world STATIC IMPORTED)
|
||||||
set_property(TARGET opencv_world PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/../3rdparty/opencv-4.5.4/build/install/lib/libopencv_world.a)
|
#set_property(TARGET opencv_world PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/../3rdparty/opencv-4.5.4/build/install/lib/libopencv_world.a)
|
||||||
|
# vtk hdf5
|
||||||
|
find_package(OpenCV REQUIRED COMPONENTS opencv_hdf opencv_imgproc opencv_imgcodecs)
|
||||||
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
||||||
|
set(opencv_world ${OpenCV_LIBS})
|
||||||
|
|
||||||
#for ncnn
|
#for ncnn
|
||||||
include_directories(../3rdparty/ncnn/build/install/include/ncnn)
|
#set (ncnn_DIR "../3rdparty/ncnn/src" CACHE PATH "Directory that contains ncnnConfig.cmake")
|
||||||
|
find_package(ncnn PATHS ${CMAKE_CURRENT_LIST_DIR}/../3rdparty/ncnn/build/install/lib/cmake/ncnn)
|
||||||
|
if (NOT ncnn_FOUND)
|
||||||
|
include_directories(${CMAKE_CURRENT_LIST_DIR}/../3rdparty/ncnn/build/install/include/ncnn)
|
||||||
add_library(ncnn STATIC IMPORTED)
|
add_library(ncnn STATIC IMPORTED)
|
||||||
set_property(TARGET ncnn PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/../3rdparty/ncnn/build/install/lib/libncnn.a)
|
set_property(TARGET ncnn PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/../3rdparty/ncnn/build/install/lib/libncnn.a)
|
||||||
|
endif()
|
||||||
|
|
||||||
#for clipper
|
#for clipper
|
||||||
include_directories(../3rdparty/clipper)
|
include_directories(../3rdparty/clipper)
|
||||||
|
@ -146,10 +154,10 @@ if(DOTEST)
|
||||||
qt5_use_modules(${PROJECT_NAME_TEST} ${QtModule})
|
qt5_use_modules(${PROJECT_NAME_TEST} ${QtModule})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} opencv_world ncnn Qt5::Core Qt5::Gui Qt5::Widgets ${dtk_lib_LIBRARIES} pthread dl -fopenmp)
|
target_link_libraries(${PROJECT_NAME} ${opencv_world} ncnn Qt5::Core Qt5::Gui Qt5::Widgets ${dtk_lib_LIBRARIES} pthread dl -fopenmp)
|
||||||
|
|
||||||
if(DOTEST)
|
if(DOTEST)
|
||||||
target_link_libraries(${PROJECT_NAME_TEST} opencv_world ncnn Qt5::Core Qt5::Gui Qt5::Widgets ${dtk_lib_LIBRARIES} pthread dl -fopenmp)
|
target_link_libraries(${PROJECT_NAME_TEST} ${opencv_world} ncnn Qt5::Core Qt5::Gui Qt5::Widgets ${dtk_lib_LIBRARIES} pthread dl -fopenmp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# install
|
# install
|
||||||
|
|
Loading…
Reference in New Issue
Block a user