From fd6a33622786d0e55b11c6318279ced006450151 Mon Sep 17 00:00:00 2001 From: hh10k Date: Fri, 6 May 2022 01:58:07 +0800 Subject: [PATCH] [opencv] Fix import paths for debug Android builds (#24394) * [opencv4] Fix import paths for debug Android builds * [opencv3] Fix import paths for debug Android builds in the same way as v4 * Only apply changes to OpenCVModules-debug.cmake when it is expected to exist --- ports/opencv3/portfile.cmake | 8 ++++++++ ports/opencv3/vcpkg.json | 2 +- ports/opencv4/portfile.cmake | 8 ++++++++ ports/opencv4/vcpkg.json | 2 +- versions/baseline.json | 4 ++-- versions/o-/opencv3.json | 5 +++++ versions/o-/opencv4.json | 5 +++++ 7 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ports/opencv3/portfile.cmake b/ports/opencv3/portfile.cmake index e3e2a37a209..d5cdf0bbdff 100644 --- a/ports/opencv3/portfile.cmake +++ b/ports/opencv3/portfile.cmake @@ -377,6 +377,14 @@ vcpkg_cmake_install() vcpkg_cmake_config_fixup(PACKAGE_NAME opencv CONFIG_PATH "share/opencv") vcpkg_copy_pdbs() +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + # Update debug paths for libs in Android builds (e.g. sdk/native/staticlibs/armeabi-v7a) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake" + "\${_IMPORT_PREFIX}/sdk" + "\${_IMPORT_PREFIX}/debug/sdk" + ) +endif() + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(READ "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" OPENCV_MODULES) set(DEPS_STRING "include(CMakeFindDependencyMacro) diff --git a/ports/opencv3/vcpkg.json b/ports/opencv3/vcpkg.json index da0b06c0498..445ff3c4798 100644 --- a/ports/opencv3/vcpkg.json +++ b/ports/opencv3/vcpkg.json @@ -1,7 +1,7 @@ { "name": "opencv3", "version": "3.4.16", - "port-version": 7, + "port-version": 8, "description": "Open Source Computer Vision Library", "homepage": "https://github.com/opencv/opencv", "license": "BSD-3-Clause", diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index c3ef67463da..ee65afa66ef 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -457,6 +457,14 @@ vcpkg_cmake_install() vcpkg_cmake_config_fixup(PACKAGE_NAME opencv CONFIG_PATH "share/opencv") vcpkg_copy_pdbs() +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + # Update debug paths for libs in Android builds (e.g. sdk/native/staticlibs/armeabi-v7a) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake" + "\${_IMPORT_PREFIX}/sdk" + "\${_IMPORT_PREFIX}/debug/sdk" + ) +endif() + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(READ "${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake" OPENCV_MODULES) set(DEPS_STRING "include(CMakeFindDependencyMacro) diff --git a/ports/opencv4/vcpkg.json b/ports/opencv4/vcpkg.json index fef9910c84c..c055ed2c2e4 100644 --- a/ports/opencv4/vcpkg.json +++ b/ports/opencv4/vcpkg.json @@ -1,7 +1,7 @@ { "name": "opencv4", "version": "4.5.5", - "port-version": 3, + "port-version": 4, "description": "computer vision library", "homepage": "https://github.com/opencv/opencv", "license": "Apache-2.0", diff --git a/versions/baseline.json b/versions/baseline.json index 5b621212ce1..0aa965b6c7e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5098,11 +5098,11 @@ }, "opencv3": { "baseline": "3.4.16", - "port-version": 7 + "port-version": 8 }, "opencv4": { "baseline": "4.5.5", - "port-version": 3 + "port-version": 4 }, "opendnp3": { "baseline": "3.1.1", diff --git a/versions/o-/opencv3.json b/versions/o-/opencv3.json index 636f629fc09..02d0949b182 100644 --- a/versions/o-/opencv3.json +++ b/versions/o-/opencv3.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "d8a8b60a98ada175921aadcd09ed66509c9be2a4", + "version": "3.4.16", + "port-version": 8 + }, { "git-tree": "d3c28cb4da2e7da9d31cc72415aff26f0b4d8442", "version": "3.4.16", diff --git a/versions/o-/opencv4.json b/versions/o-/opencv4.json index 82178c48b28..a3175691e23 100644 --- a/versions/o-/opencv4.json +++ b/versions/o-/opencv4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "86073388865f7730e42d02768f8963156f2be82f", + "version": "4.5.5", + "port-version": 4 + }, { "git-tree": "0771f6243ddde63a9b212efeb5ad51a74b640a62", "version": "4.5.5",