update CPU detection on ANDROID patch

This commit is contained in:
Alexander Alekhin
2017-06-09 15:24:14 +00:00
parent bb3a416320
commit 3dee87b697
7 changed files with 44 additions and 20 deletions
+13 -11
View File
@@ -1,15 +1,18 @@
if(NOT ANDROID)
message("cpufeatures is ANDROID project")
endif()
ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB cpuf_s *.c)
file(GLOB cpuf_h *.h)
set(CPUFEATURES_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "Android cpufeatures project sources (for example, <android-ndk>/sources/android/cpufeatures)")
set(lib_srcs ${cpuf_s})
set(lib_hdrs ${cpuf_h})
set(CPUFEATURES_INCLUDE_DIRS ${CPUFEATURES_ROOT} CACHE INTERNAL "")
set(CPUFEATURES_LIBRARIES cpufeatures CACHE INTERNAL "")
set(CPUFEATURES_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "")
set(CPUFEATURES_LIBRARIES cpufeatures CACHE INTERNAL "")
if(NOT DEFINED CPUFEATURES_SOURCES)
set(CPUFEATURES_SOURCES ${CPUFEATURES_ROOT}/cpu-features.c ${CPUFEATURES_ROOT}/cpu-features.h)
endif()
add_library(cpufeatures STATIC ${lib_srcs} ${lib_hdrs})
include_directories(${CPUFEATURES_INCLUDE_DIRS})
add_library(cpufeatures STATIC ${CPUFEATURES_SOURCES})
set_target_properties(cpufeatures
PROPERTIES OUTPUT_NAME cpufeatures
@@ -17,8 +20,8 @@ set_target_properties(cpufeatures
COMPILE_PDB_NAME cpufeatures
COMPILE_PDB_NAME_DEBUG "cpufeatures${OPENCV_DEBUG_POSTFIX}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
)
)
if(ENABLE_SOLUTION_FOLDERS)
set_target_properties(cpufeatures PROPERTIES FOLDER "3rdparty")
endif()
@@ -26,4 +29,3 @@ endif()
if(NOT BUILD_SHARED_LIBS)
ocv_install_target(cpufeatures EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
endif()
+13
View File
@@ -0,0 +1,13 @@
Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+4
View File
@@ -0,0 +1,4 @@
The Android NDK provides a small library named cpufeatures that your app can use at runtime to detect the target device's CPU family and the optional features it supports.
It is designed to work as-is on all official Android platform versions.
https://developer.android.com/ndk/guides/cpu-features.html
+1 -1
View File
@@ -5,7 +5,7 @@
project(${WEBP_LIBRARY})
ocv_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
ocv_include_directories("${CPUFEATURES_INCLUDE_DIR}")
ocv_include_directories(${CPUFEATURES_INCLUDE_DIRS})
file(GLOB lib_srcs dec/*.c demux/*.c dsp/*.c enc/*.c mux/*.c utils/*.c webp/*.c)
file(GLOB lib_hdrs dec/*.h demux/*.h dsp/*.h enc/*.h mux/*.h utils/*.h webp/*.h)