diff --git a/CMakeLists.txt b/CMakeLists.txt index 72a271b..4993b78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) project(deepin-ocr) #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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1f0198c..b0beede 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -32,14 +32,22 @@ add_definitions(${QT_DEFINITIONS}) include(CMakePackageConfigHelpers) #for OpenCV-mobile -include_directories(../3rdparty/opencv-4.5.4/build/install/include/opencv4) -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) +#include_directories(../3rdparty/opencv-4.5.4/build/install/include/opencv4) +#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) +# 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 -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) set_property(TARGET ncnn PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/../3rdparty/ncnn/build/install/lib/libncnn.a) +endif() #for clipper include_directories(../3rdparty/clipper) @@ -146,10 +154,10 @@ if(DOTEST) qt5_use_modules(${PROJECT_NAME_TEST} ${QtModule}) 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) - 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() # install