diff --git a/ports/opencv4/0017-fix-flatbuffers.patch b/ports/opencv4/0017-fix-flatbuffers.patch new file mode 100644 index 0000000000..517c6ea99a --- /dev/null +++ b/ports/opencv4/0017-fix-flatbuffers.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/OpenCVDetectFlatbuffers.cmake b/cmake/OpenCVDetectFlatbuffers.cmake +index 537b738..6dba0fb 100644 +--- a/cmake/OpenCVDetectFlatbuffers.cmake ++++ b/cmake/OpenCVDetectFlatbuffers.cmake +@@ -1,9 +1,11 @@ + if(WITH_FLATBUFFERS) + set(HAVE_FLATBUFFERS 1) +- set(flatbuffers_VERSION "23.5.9") +- ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt") +- ocv_add_external_target(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/include" "" "HAVE_FLATBUFFERS=1") +- set(CUSTOM_STATUS_flatbuffers " Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})") ++ set(flatbuffers_VERSION "23.5.26") ++ #ocv_install_3rdparty_licenses(flatbuffers "${OpenCV_SOURCE_DIR}/3rdparty/flatbuffers/LICENSE.txt") ++ find_path(FLATBUFFERS_INCLUDE_DIR flatbuffers.h PATH_SUFFIXES flatbuffers) ++ get_filename_component(FLATBUFFERS_INCLUDE_DIR "${FLATBUFFERS_INCLUDE_DIR}" PATH) ++ ocv_add_external_target(flatbuffers "${FLATBUFFERS_INCLUDE_DIR}" "" "HAVE_FLATBUFFERS=1") ++ #set(CUSTOM_STATUS_flatbuffers " Flatbuffers:" "builtin/3rdparty (${flatbuffers_VERSION})") + endif() + + if(WITH_FLATBUFFERS OR HAVE_FLATBUFFERS) diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index 974e103160..f951785148 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -26,10 +26,12 @@ vcpkg_from_github( 0011-remove-python2.patch 0012-fix-zlib.patch 0015-fix-freetype.patch + 0017-fix-flatbuffers.patch "${ARM64_WINDOWS_FIX}" ) # Disallow accidental build of vendored copies file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/openexr") +file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/flatbuffers") if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") set(TARGET_IS_AARCH64 1) @@ -86,6 +88,12 @@ if("dnn" IN_LIST FEATURES) else() message(WARNING "The dnn module cannot be enabled on Android") endif() + set(FLATC "${CURRENT_HOST_INSTALLED_DIR}/tools/flatbuffers/flatc${VCPKG_HOST_EXECUTABLE_SUFFIX}") + vcpkg_execute_required_process( + COMMAND "${FLATC}" --cpp -o "${SOURCE_PATH}/modules/dnn/misc/tflite" "${SOURCE_PATH}/modules/dnn/src/tflite/schema.fbs" + WORKING_DIRECTORY "${SOURCE_PATH}/modules/dnn/misc/tflite" + LOGNAME flatc-${TARGET_TRIPLET} + ) endif() set(WITH_QT OFF) diff --git a/ports/opencv4/vcpkg.json b/ports/opencv4/vcpkg.json index 0a925c89c8..0889d5bac5 100644 --- a/ports/opencv4/vcpkg.json +++ b/ports/opencv4/vcpkg.json @@ -1,6 +1,7 @@ { "name": "opencv4", "version": "4.8.0", + "port-version": 1, "description": "computer vision library", "homepage": "https://github.com/opencv/opencv", "license": "Apache-2.0", @@ -102,6 +103,12 @@ "dnn": { "description": "Enable dnn module", "dependencies": [ + "flatbuffers", + { + "name": "flatbuffers", + "host": true, + "default-features": false + }, "protobuf" ] }, diff --git a/versions/baseline.json b/versions/baseline.json index 4ec6ba048a..fc312ae2b5 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6014,7 +6014,7 @@ }, "opencv4": { "baseline": "4.8.0", - "port-version": 0 + "port-version": 1 }, "opendnp3": { "baseline": "3.1.1", diff --git a/versions/o-/opencv4.json b/versions/o-/opencv4.json index 5b61f33676..702cb338ae 100644 --- a/versions/o-/opencv4.json +++ b/versions/o-/opencv4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "78f4556a682ebb41e2ff3f26090ef51cafe5a66c", + "version": "4.8.0", + "port-version": 1 + }, { "git-tree": "0bae188d52a71f441df28b25278e5506502dfd03", "version": "4.8.0",