diff --git a/ports/cpu-features/0001-ndk-compat-export-include-dirs.patch b/ports/cpu-features/0001-ndk-compat-export-include-dirs.patch new file mode 100644 index 0000000000..8b55fa323a --- /dev/null +++ b/ports/cpu-features/0001-ndk-compat-export-include-dirs.patch @@ -0,0 +1,17 @@ +diff --git a/ndk_compat/CMakeLists.txt b/ndk_compat/CMakeLists.txt +index 37b3866..27861b7 100644 +--- a/ndk_compat/CMakeLists.txt ++++ b/ndk_compat/CMakeLists.txt +@@ -15,7 +15,11 @@ set (NDK_COMPAT_SRCS + add_cpu_features_headers_and_sources(NDK_COMPAT_SRCS NDK_COMPAT_SRCS) + add_library(ndk_compat ${NDK_COMPAT_HDRS} ${NDK_COMPAT_SRCS}) + setup_include_and_definitions(ndk_compat) +-target_include_directories(ndk_compat PUBLIC $) ++target_include_directories(ndk_compat ++ PUBLIC ++ $ ++ $ ++) + target_link_libraries(ndk_compat PUBLIC ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}) + set_target_properties(ndk_compat PROPERTIES PUBLIC_HEADER "${NDK_COMPAT_HDRS}") + diff --git a/ports/cpu-features/portfile.cmake b/ports/cpu-features/portfile.cmake index 2d9dfb5587..268e91991a 100644 --- a/ports/cpu-features/portfile.cmake +++ b/ports/cpu-features/portfile.cmake @@ -6,6 +6,8 @@ vcpkg_from_github( REF "v${VERSION}" SHA512 40c314c584fcf109d9a641c055cb75f335fd5425dd336fe831828b956226eaf0ac2fd8ffceeaf10e02afa9cec01cb0ddc6af8ff78f20dd925783e6958d0b9304 HEAD_REF master + PATCHES + 0001-ndk-compat-export-include-dirs.patch ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS diff --git a/ports/cpu-features/vcpkg.json b/ports/cpu-features/vcpkg.json index f56eb9719b..ccf6e415d0 100644 --- a/ports/cpu-features/vcpkg.json +++ b/ports/cpu-features/vcpkg.json @@ -1,6 +1,7 @@ { "name": "cpu-features", "version": "0.10.1", + "port-version": 1, "description": "A cross-platform C library to retrieve CPU features (such as available instructions) at runtime", "homepage": "https://github.com/google/cpu_features", "license": "Apache-2.0", diff --git a/ports/opencv4/0022-android-use-vcpkg-cpu-features.patch b/ports/opencv4/0022-android-use-vcpkg-cpu-features.patch new file mode 100644 index 0000000000..0126fea775 --- /dev/null +++ b/ports/opencv4/0022-android-use-vcpkg-cpu-features.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 79a0c96270..e6b1aefb9b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -789,7 +789,6 @@ endif() + # ---------------------------------------------------------------------------- + + if(ANDROID AND WITH_CPUFEATURES) +- add_subdirectory(3rdparty/cpufeatures) + set(HAVE_CPUFEATURES 1) + endif() + +diff --git a/cmake/OpenCVFindLibsPerf.cmake b/cmake/OpenCVFindLibsPerf.cmake +index fce231e722..309e84341a 100644 +--- a/cmake/OpenCVFindLibsPerf.cmake ++++ b/cmake/OpenCVFindLibsPerf.cmake +@@ -200,3 +200,9 @@ if(WITH_FASTCV) + set(FASTCV_LIBRARY "${FastCV_LIB_PATH}/libfastcvopt.so" CACHE PATH "FastCV library") + endif() + endif(WITH_FASTCV) ++ ++ ++if(ANDROID AND HAVE_CPUFEATURES) ++ find_package(CpuFeaturesNdkCompat CONFIG REQUIRED) ++ list(APPEND OPENCV_LINKER_LIBS CpuFeatures::ndk_compat) ++endif() +diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt +index 95fe8d6a4c..11eae4cd78 100644 +--- a/modules/core/CMakeLists.txt ++++ b/modules/core/CMakeLists.txt +@@ -98,7 +98,6 @@ ocv_glob_module_sources(SOURCES "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version + ocv_module_include_directories(${the_module} ${ZLIB_INCLUDE_DIRS} ${OPENCL_INCLUDE_DIRS}) + if(ANDROID AND HAVE_CPUFEATURES) + ocv_append_source_file_compile_definitions(${CMAKE_CURRENT_SOURCE_DIR}/src/system.cpp "HAVE_CPUFEATURES=1") +- ocv_module_include_directories(${CPUFEATURES_INCLUDE_DIRS}) + endif() + if(ITT_INCLUDE_DIRS) + ocv_module_include_directories(${ITT_INCLUDE_DIRS}) diff --git a/ports/opencv4/portfile.cmake b/ports/opencv4/portfile.cmake index 05ac9e3c37..c342339e95 100644 --- a/ports/opencv4/portfile.cmake +++ b/ports/opencv4/portfile.cmake @@ -24,6 +24,7 @@ vcpkg_from_github( 0019-opencl-kernel.patch 0020-fix-narrow-filesystem.diff 0021-fix-qt-gen-def.patch + 0022-android-use-vcpkg-cpu-features.patch 0022-fix-miss-exception-include.patch ) @@ -55,6 +56,11 @@ string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" BUILD_WITH_STATIC_CRT) set(ADE_DIR ${CURRENT_INSTALLED_DIR}/share/ade CACHE PATH "Path to existing ADE CMake Config file") +set(WITH_CPUFEATURES OFF) +if (VCPKG_TARGET_IS_ANDROID) + set(WITH_CPUFEATURES ON) +endif() + # Cannot use vcpkg_check_features() for "qt" because it requires the QT version number passed, not just a boolean vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES @@ -418,7 +424,7 @@ vcpkg_cmake_configure( ${FEATURE_OPTIONS} -DWITH_QT=${WITH_QT} -DWITH_AVIF=OFF - -DWITH_CPUFEATURES=OFF + -DWITH_CPUFEATURES=${WITH_CPUFEATURES} -DWITH_ITT=OFF -DWITH_JASPER=OFF #Jasper is deprecated and will be removed in a future release, and is mutually exclusive with openjpeg that is preferred -DWITH_LAPACK=OFF diff --git a/ports/opencv4/vcpkg.json b/ports/opencv4/vcpkg.json index e64382c21a..a744f9b69f 100644 --- a/ports/opencv4/vcpkg.json +++ b/ports/opencv4/vcpkg.json @@ -1,11 +1,15 @@ { "name": "opencv4", "version": "4.11.0", - "port-version": 5, + "port-version": 6, "description": "computer vision library", "homepage": "https://github.com/opencv/opencv", "license": "Apache-2.0", "dependencies": [ + { + "name": "cpu-features", + "platform": "android" + }, { "name": "vcpkg-cmake", "host": true diff --git a/versions/baseline.json b/versions/baseline.json index c8770db793..24c04a328f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2134,7 +2134,7 @@ }, "cpu-features": { "baseline": "0.10.1", - "port-version": 0 + "port-version": 1 }, "cpuid": { "baseline": "0.8.1", @@ -7154,7 +7154,7 @@ }, "opencv4": { "baseline": "4.11.0", - "port-version": 5 + "port-version": 6 }, "opendnp3": { "baseline": "3.1.1", diff --git a/versions/c-/cpu-features.json b/versions/c-/cpu-features.json index 32b17ba2c6..62c7d5c580 100644 --- a/versions/c-/cpu-features.json +++ b/versions/c-/cpu-features.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "40c5147fa5fa1c44dbcb3b3e9f9722ad005dab18", + "version": "0.10.1", + "port-version": 1 + }, { "git-tree": "aed5848d2893c921d0ecf239d89bef2eadda3eed", "version": "0.10.1", diff --git a/versions/o-/opencv4.json b/versions/o-/opencv4.json index 3a3fb11cca..334b468425 100644 --- a/versions/o-/opencv4.json +++ b/versions/o-/opencv4.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f196281c4ecd720c4536cd7c7e5a9325fdc8d3f1", + "version": "4.11.0", + "port-version": 6 + }, { "git-tree": "9584ee4055962b4fdf83f4d7fe378fd0e5904eb6", "version": "4.11.0",