From f27954202f6ae40c2b1ce6e6ed8035a52a329f74 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Thu, 22 Apr 2021 20:24:37 -0400 Subject: [PATCH 1/3] wechat_qrcode: explicit iconv dependency Iconv isn't automatic on all systems, non-POSIX have a separate libiconv that needs to be found in CMake and linked. --- modules/wechat_qrcode/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/wechat_qrcode/CMakeLists.txt b/modules/wechat_qrcode/CMakeLists.txt index 210f4a0d50a..cf63ef1d5c7 100644 --- a/modules/wechat_qrcode/CMakeLists.txt +++ b/modules/wechat_qrcode/CMakeLists.txt @@ -1,6 +1,14 @@ set(the_description "WeChat QR code Detector") ocv_define_module(wechat_qrcode opencv_core opencv_imgproc opencv_dnn WRAP java objc python js) +# iconv support isn't automatic on some systems +if(CMAKE_VERSION VERSION_GREATER "3.11") + find_package(Iconv QUIET) + if(Iconv_FOUND) + ocv_target_link_libraries(${the_module} Iconv::Iconv) + endif() +endif() + # need to change set(wechat_qrcode_commit_hash "a8b69ccc738421293254aec5ddb38bd523503252") set(hash_detect_caffemodel "238e2b2d6f3c18d6c3a30de0c31e23cf") From 012b0316344c73b6a1939bc5bb43ee84fab7d177 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Fri, 23 Apr 2021 03:33:45 -0400 Subject: [PATCH 2/3] Don't disable iconv on MinGW --- modules/wechat_qrcode/src/zxing/zxing.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wechat_qrcode/src/zxing/zxing.hpp b/modules/wechat_qrcode/src/zxing/zxing.hpp index 11090f74b95..76efae22c87 100644 --- a/modules/wechat_qrcode/src/zxing/zxing.hpp +++ b/modules/wechat_qrcode/src/zxing/zxing.hpp @@ -27,7 +27,7 @@ #define USE_ONED_WRITER 1 #endif -#if defined(__ANDROID_API__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) +#if defined(__ANDROID_API__) || defined(_MSC_VER) #ifndef NO_ICONV #define NO_ICONV From c33419dff5b6e544a9ceffddc3740a6d7ecac24a Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Fri, 23 Apr 2021 19:23:57 -0400 Subject: [PATCH 3/3] wechat_qrcode: Disable iconv if not found --- modules/wechat_qrcode/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/wechat_qrcode/CMakeLists.txt b/modules/wechat_qrcode/CMakeLists.txt index cf63ef1d5c7..d38d9cce755 100644 --- a/modules/wechat_qrcode/CMakeLists.txt +++ b/modules/wechat_qrcode/CMakeLists.txt @@ -6,6 +6,8 @@ if(CMAKE_VERSION VERSION_GREATER "3.11") find_package(Iconv QUIET) if(Iconv_FOUND) ocv_target_link_libraries(${the_module} Iconv::Iconv) + else() + ocv_target_compile_definitions(${the_module} PRIVATE "NO_ICONV=1") endif() endif()