From 403ffc7703422983aa1bc90f9f3af77eae5ef94f Mon Sep 17 00:00:00 2001 From: Joachim Date: Tue, 7 Apr 2020 23:16:01 +0200 Subject: [PATCH] enhanced the CMakeList --- .../examples/esp_opencv_basic/main/CMakeLists.txt | 15 ++++++++------- .../examples/esp_opencv_tests/main/CMakeLists.txt | 14 ++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/esp32/examples/esp_opencv_basic/main/CMakeLists.txt b/esp32/examples/esp_opencv_basic/main/CMakeLists.txt index 8beef1f..abe3dd1 100644 --- a/esp32/examples/esp_opencv_basic/main/CMakeLists.txt +++ b/esp32/examples/esp_opencv_basic/main/CMakeLists.txt @@ -2,7 +2,6 @@ set(COMPONENT_SRCS "hello_opencv.cpp") set(COMPONENT_ADD_INCLUDEDIRS "." "./opencv/") register_component() -# Be aware that the order of the librairies is important add_prebuilt_library(opencv_imgcodecs "opencv/libopencv_imgcodecs.a") add_prebuilt_library(libpng "opencv/3rdparty/liblibpng.a") add_prebuilt_library(libzlib "opencv/3rdparty/libzlib.a") @@ -10,9 +9,11 @@ add_prebuilt_library(opencv_imgproc "opencv/libopencv_imgproc.a") add_prebuilt_library(opencv_core "opencv/libopencv_core.a") add_prebuilt_library(ade "opencv/libade.a") -target_link_libraries(${COMPONENT_LIB} PRIVATE opencv_imgcodecs) -target_link_libraries(${COMPONENT_LIB} PRIVATE libpng) -target_link_libraries(${COMPONENT_LIB} PRIVATE libzlib) -target_link_libraries(${COMPONENT_LIB} PRIVATE opencv_imgproc) -target_link_libraries(${COMPONENT_LIB} PRIVATE opencv_core) -target_link_libraries(${COMPONENT_LIB} PRIVATE ade) +set(IMGCODEC_DEP libpng libzlib) +target_link_libraries(opencv_imgcodecs INTERFACE ${IMGCODEC_DEP}) + +set(CORE_DEP libzlib) +target_link_libraries(opencv_core INTERFACE ${CORE_DEP}) + +set(OPENCV_DEP opencv_imgcodecs opencv_imgproc opencv_core) +target_link_libraries(${COMPONENT_LIB} ${OPENCV_DEP}) \ No newline at end of file diff --git a/esp32/examples/esp_opencv_tests/main/CMakeLists.txt b/esp32/examples/esp_opencv_tests/main/CMakeLists.txt index 7c5c82b..08f5fd9 100644 --- a/esp32/examples/esp_opencv_tests/main/CMakeLists.txt +++ b/esp32/examples/esp_opencv_tests/main/CMakeLists.txt @@ -16,12 +16,14 @@ add_prebuilt_library(opencv_imgproc "opencv/libopencv_imgproc.a") add_prebuilt_library(opencv_core "opencv/libopencv_core.a") add_prebuilt_library(ade "opencv/libade.a") -target_link_libraries(${COMPONENT_LIB} PRIVATE opencv_imgcodecs) -target_link_libraries(${COMPONENT_LIB} PRIVATE libpng) -target_link_libraries(${COMPONENT_LIB} PRIVATE libzlib) -target_link_libraries(${COMPONENT_LIB} PRIVATE opencv_imgproc) -target_link_libraries(${COMPONENT_LIB} PRIVATE opencv_core) -target_link_libraries(${COMPONENT_LIB} PRIVATE ade) +set(IMGCODEC_DEP libpng libzlib) +target_link_libraries(opencv_imgcodecs INTERFACE ${IMGCODEC_DEP}) + +set(CORE_DEP libzlib) +target_link_libraries(opencv_core INTERFACE ${CORE_DEP}) + +set(OPENCV_DEP opencv_imgcodecs opencv_imgproc opencv_core) +target_link_libraries(${COMPONENT_LIB} ${OPENCV_DEP}) # create spiffs partition (named 'storage') from the ../spiffs_image directory spiffs_create_partition_image(storage ../spiffs_images FLASH_IN_PROJECT)