mirror of
https://github.com/microsoft/vcpkg.git
synced 2026-01-18 01:11:23 +01:00
[cpu-features][opencv4] Re-enable CpuFeatures of OpenCV4 on Android via vcpkg (#48311)
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com> Co-authored-by: Victor Romero <romerosanchezv@gmail.com>
This commit is contained in:
17
ports/cpu-features/0001-ndk-compat-export-include-dirs.patch
Normal file
17
ports/cpu-features/0001-ndk-compat-export-include-dirs.patch
Normal file
@@ -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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||
+target_include_directories(ndk_compat
|
||||
+ PUBLIC
|
||||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ndk_compat>
|
||||
+)
|
||||
target_link_libraries(ndk_compat PUBLIC ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||
set_target_properties(ndk_compat PROPERTIES PUBLIC_HEADER "${NDK_COMPAT_HDRS}")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
38
ports/opencv4/0022-android-use-vcpkg-cpu-features.patch
Normal file
38
ports/opencv4/0022-android-use-vcpkg-cpu-features.patch
Normal file
@@ -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})
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "40c5147fa5fa1c44dbcb3b3e9f9722ad005dab18",
|
||||
"version": "0.10.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "aed5848d2893c921d0ecf239d89bef2eadda3eed",
|
||||
"version": "0.10.1",
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f196281c4ecd720c4536cd7c7e5a9325fdc8d3f1",
|
||||
"version": "4.11.0",
|
||||
"port-version": 6
|
||||
},
|
||||
{
|
||||
"git-tree": "9584ee4055962b4fdf83f4d7fe378fd0e5904eb6",
|
||||
"version": "4.11.0",
|
||||
|
||||
Reference in New Issue
Block a user