From 14d0a7196993868e5fb5ef18afd03a2bf2ca8014 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 20 Mar 2019 00:43:58 -0400 Subject: [PATCH 1/4] Build with C++11 on Unix. This fixes the opencv wrapper code on Darwin; probably on other platforms too, though maybe they are less strict. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ccb2ba9..738f4e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,8 @@ include(source_files.cmake) if(WIN32) include_directories(core/lib/win32) set(CMAKE_DEBUG_POSTFIX -debug) +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() # OpenCV classes From c1b5a6584f3085c2d49f790a952893d0708d17db Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 20 Mar 2019 00:46:41 -0400 Subject: [PATCH 2/4] Repair mismatched cmake _LIBRAR{Y,IES} variable. This was breaking the build on Darwin. I don't know how it wasn't doing so on Linux too; perhaps Linux triggers HAVE_ICONV_IN_LIBC so it never came up? cmake wants all instances of this sort of variable to be named > Xxx_LIBRARIES > The libraries to link against to use Xxx. These should include full paths. This should not be a cache entry. - https://cmake.org/cmake/help/v3.0/manual/cmake-developer.7.html#find-modules --- cmake/FindModules/FindIconv.cmake | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake/FindModules/FindIconv.cmake b/cmake/FindModules/FindIconv.cmake index bc2bf5a..eaf4133 100644 --- a/cmake/FindModules/FindIconv.cmake +++ b/cmake/FindModules/FindIconv.cmake @@ -20,7 +20,7 @@ function(_iconv_find) DOC "Iconv include directory") set(ICONV_INCLUDE_DIR "${ICONV_INCLUDE_DIR}" PARENT_SCOPE) - find_library(ICONV_LIBRARY + find_library(ICONV_LIBRARIES NAMES iconv libiconv @@ -28,18 +28,18 @@ function(_iconv_find) HINTS ${iconv_roots} PATH_SUFFIXES ${iconv_library_suffixes} DOC "Iconv library") - set(ICONV_LIBRARY "${ICONV_LIBRARY}" PARENT_SCOPE) + set(ICONV_LIBRARIES "${ICONV_LIBRARIES}" PARENT_SCOPE) - if(ICONV_INCLUDE_DIR AND NOT ICONV_LIBRARY) + if(ICONV_INCLUDE_DIR AND NOT ICONV_LIBRARIES) include(CheckFunctionExists) check_function_exists(iconv HAVE_ICONV_IN_LIBC) if(HAVE_ICONV_IN_LIBC) set(HAVE_ICONV_IN_LIBC "${HAVE_ICONV_IN_LIBC}" PARENT_SCOPE) - set(ICONV_LIBRARY "integrated in standard library" PARENT_SCOPE) + set(ICONV_LIBRARIES "integrated in standard library" PARENT_SCOPE) endif() endif() - if(ICONV_INCLUDE_DIR AND ICONV_LIBRARY) + if(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) set(ICONV_FOUND ON PARENT_SCOPE) endif() endfunction() @@ -63,7 +63,7 @@ if(ICONV_FOUND) if(NOT HAVE_ICONV_IN_LIBC) set_target_properties(Iconv::Iconv PROPERTIES - IMPORTED_LOCATION "${ICONV_LIBRARY}") + IMPORTED_LOCATION "${ICONV_LIBRARIES}") endif() unset(_lib_type) @@ -73,4 +73,4 @@ else() endif() endif() -mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR) +mark_as_advanced(ICONV_LIBRARIES ICONV_INCLUDE_DIR) From 420203287f9ecf87f38d6b79814ff8e3fc4d09ff Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 20 Mar 2019 00:47:42 -0400 Subject: [PATCH 3/4] Patches for opencv4 --- opencv-cli/src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opencv-cli/src/main.cpp b/opencv-cli/src/main.cpp index 63b6fd3..1daa7bc 100644 --- a/opencv-cli/src/main.cpp +++ b/opencv-cli/src/main.cpp @@ -135,14 +135,14 @@ int main(int argc, char** argv) { } - if (!videoCapture.set(CV_CAP_PROP_FRAME_WIDTH, captureWidth)) { + if (!videoCapture.set(CAP_PROP_FRAME_WIDTH, captureWidth)) { // Log cerr << "Failed to set frame width: " << captureWidth << " (ignoring)" << endl; } - if (!videoCapture.set(CV_CAP_PROP_FRAME_HEIGHT, captureHeight)) { + if (!videoCapture.set(CAP_PROP_FRAME_HEIGHT, captureHeight)) { // Log cerr << "Failed to set frame height: " << captureHeight << " (ignoring)" << endl; @@ -166,7 +166,7 @@ int main(int argc, char** argv) { if (result) { // Convert to grayscale - cvtColor(image, grey, CV_BGR2GRAY); + cvtColor(image, grey, COLOR_BGR2GRAY); try { From d3ac82287e2d79f341a8f4fbf7afb136bc8d173f Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 20 Mar 2019 00:47:42 -0400 Subject: [PATCH 4/4] Patches for opencv4 --- opencv-cli/src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opencv-cli/src/main.cpp b/opencv-cli/src/main.cpp index 63b6fd3..1daa7bc 100644 --- a/opencv-cli/src/main.cpp +++ b/opencv-cli/src/main.cpp @@ -135,14 +135,14 @@ int main(int argc, char** argv) { } - if (!videoCapture.set(CV_CAP_PROP_FRAME_WIDTH, captureWidth)) { + if (!videoCapture.set(CAP_PROP_FRAME_WIDTH, captureWidth)) { // Log cerr << "Failed to set frame width: " << captureWidth << " (ignoring)" << endl; } - if (!videoCapture.set(CV_CAP_PROP_FRAME_HEIGHT, captureHeight)) { + if (!videoCapture.set(CAP_PROP_FRAME_HEIGHT, captureHeight)) { // Log cerr << "Failed to set frame height: " << captureHeight << " (ignoring)" << endl; @@ -166,7 +166,7 @@ int main(int argc, char** argv) { if (result) { // Convert to grayscale - cvtColor(image, grey, CV_BGR2GRAY); + cvtColor(image, grey, COLOR_BGR2GRAY); try {