mirror of
https://github.com/opencv/opencv.git
synced 2026-07-22 20:03:03 +04:00
Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 04f3c19b9a | |||
| b78811112f | |||
| 2e2972cef3 | |||
| 16687a2655 | |||
| e21f106159 | |||
| dd8e648d78 | |||
| def1745132 | |||
| 6bc795308e | |||
| 1e5b533d01 | |||
| 02d1e68c64 | |||
| 1af55b4bcb | |||
| efecf3b8fd | |||
| 8cf6bcb20a | |||
| 99299b3605 | |||
| 7e52a8d1b6 | |||
| 064bf167ad | |||
| 9ca65ceef8 | |||
| f57d692cd7 | |||
| e1331b44f5 | |||
| 014a500f79 | |||
| 524bde2aeb | |||
| 20838b6f6e | |||
| 02c7e221a3 | |||
| 0c3bdbf23a | |||
| d6d1d20816 | |||
| b870b246e1 | |||
| f87987ed72 | |||
| 9944282b09 | |||
| ffdbddd6b1 | |||
| f22ee7f0df | |||
| e9e46d3086 | |||
| b6efec5f8b | |||
| 512f0091db | |||
| 9526907cba | |||
| aaf779a3a2 | |||
| 0d00109f05 | |||
| 7bee55b84e | |||
| ee144852f2 | |||
| 7c37f5d7de | |||
| 64f821908e | |||
| 875294aa92 | |||
| 71e7d444d8 | |||
| ca7abe1239 | |||
| f4433ff9c4 | |||
| 77df8730ef | |||
| c8b658fdb6 | |||
| 48f19fba76 | |||
| 1555922228 | |||
| 8763ad6c99 | |||
| 35ac95930f | |||
| b35fa6c4ff | |||
| d7c89fc649 | |||
| a75e5ac277 | |||
| 2c56a09bee | |||
| 98d7d99244 | |||
| 3c09b075fc | |||
| dfa4b2fefa | |||
| cd501d947c | |||
| 7d94236c14 | |||
| 09be997ed8 | |||
| 5c88577138 | |||
| 80a1d569ca | |||
| 3de6846d12 | |||
| 0bbba847a4 | |||
| 7701fa7a63 | |||
| 9b09f09b9a | |||
| 3f417f1ec3 | |||
| 5a407153bd | |||
| 817a4c0c30 | |||
| 932204d197 | |||
| e1afb1409f | |||
| 64cf113d23 | |||
| 770a466dd2 | |||
| b876308d77 | |||
| 5cc0abffa5 | |||
| 6e244c83cd | |||
| e5468008aa | |||
| f29c727ada | |||
| 60ad505a63 | |||
| 2bf56961c0 | |||
| f7dc98f67b | |||
| 9c6eed0ba3 | |||
| 7660fe03a6 | |||
| e21884f4c4 | |||
| cdbbfc98e1 | |||
| 7c6191ec11 | |||
| d550f95347 | |||
| 709a1cc083 | |||
| 1821d21f5b | |||
| 257d8df1d4 | |||
| d2ed8e5f30 | |||
| 4ebcf2b224 | |||
| b0d3830399 | |||
| 7852b68c20 | |||
| 0f64f847b2 | |||
| 9823b7cd08 | |||
| a0c504aabc | |||
| 6e0db3f527 | |||
| 22484872fa | |||
| f6ca38a579 | |||
| f12d945712 | |||
| 49c35fafc0 | |||
| 60a98aa5f7 | |||
| 677443f3ef | |||
| ea83d384c1 | |||
| bbfccb61f3 | |||
| d36f8b9eb3 | |||
| f6ff2b87fa | |||
| 64bed2060a | |||
| 7e8fab0747 | |||
| c646bd4b7a | |||
| 362655b02a | |||
| b57e801c04 | |||
| bb3d14e1a0 | |||
| 5047b3fba2 | |||
| e1a4d22da6 | |||
| 4e21f42714 | |||
| 8877066846 | |||
| 157cdeb443 | |||
| ae149adb29 | |||
| cbe22fb5d1 | |||
| 86f7a357ae | |||
| 24c920a33a | |||
| 03f402892d | |||
| 930b580e0d | |||
| 383e04d9e4 | |||
| 0711e65972 | |||
| 2e5a7284d2 | |||
| e95fc27490 | |||
| 0efc32fc21 | |||
| 8266eab8b4 | |||
| 214629b220 | |||
| dc3aa27be4 | |||
| 8286e1a5f7 | |||
| c36dcbcada | |||
| db965353f4 | |||
| 39da17a02a | |||
| a22edb037f | |||
| b19f672843 | |||
| 7df45c0dcc | |||
| 91913364d6 | |||
| 5460cee9e9 | |||
| 23011ffd81 | |||
| 6eed90e5e8 | |||
| 901c0d80c3 | |||
| 97e36b9375 | |||
| 68d04d28b6 | |||
| 8daebeac8a | |||
| 9db1d9ba13 | |||
| be0c20b758 | |||
| fceb62386d | |||
| 285d6320be | |||
| f45b5b13f1 | |||
| 081887ee16 | |||
| 2c67731a7b | |||
| 3282e08f55 | |||
| 845e52b676 | |||
| 8579666b03 | |||
| 24af691843 | |||
| 8ecd22ba48 | |||
| c31f106012 | |||
| aa4e6a8a83 | |||
| d559c18ee5 | |||
| cfd634ca3e | |||
| 4fce5a5e83 | |||
| 934b623fa9 | |||
| d3397a1d6d | |||
| 5b148083fe | |||
| f172947ed5 | |||
| 5527fc62f4 | |||
| 04481d9ef4 | |||
| ab9311947a | |||
| 66a1ea7604 | |||
| 4abf0b3193 | |||
| 1f1d43fc88 | |||
| 9ca1162be8 | |||
| 6cd70c83fb | |||
| f6f1861a2f | |||
| 590d1d8118 | |||
| 759863d95c | |||
| 1e0bff3268 | |||
| 9cfa51a483 | |||
| 72a63922d2 | |||
| e4fb680566 | |||
| 5bc66ec8e4 | |||
| a218507586 | |||
| 8ba9289a2c | |||
| 4d6bdc1533 | |||
| c803cbb93b | |||
| 7e301c5c0e | |||
| b5e009eb87 | |||
| a9919e01d0 | |||
| 606c23b9aa | |||
| a126532cb7 | |||
| dad56e202f | |||
| b131dfeecd | |||
| 8c9c2b3a03 | |||
| e5ffbf9498 | |||
| 91a9923dcf | |||
| 2e54e2a586 | |||
| 9163471987 | |||
| a0be7b57f5 |
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+1
@@ -24,6 +24,7 @@ if(WIN32 AND NOT MINGW)
|
||||
endif(WIN32 AND NOT MINGW)
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-implicit-function-declaration -Wno-uninitialized -Wmissing-prototypes -Wmissing-declarations -Wunused -Wshadow -Wsign-compare)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 /wd4018 /wd4101 /wd4244 /wd4267 /wd4715) # vs2005
|
||||
|
||||
if(UNIX)
|
||||
|
||||
Vendored
+1
@@ -26,6 +26,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
endif()
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow -Wunused)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
|
||||
|
||||
set_target_properties(${JPEG_LIBRARY}
|
||||
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
|
||||
|
||||
Vendored
+1
@@ -89,6 +89,7 @@ endif(WIN32)
|
||||
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-prototypes -Wmissing-declarations -Wundef -Wunused -Wsign-compare
|
||||
-Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast)
|
||||
ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4018 /wd4100 /wd4127 /wd4311 /wd4701 /wd4706) # vs2005
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4244) # vs2008
|
||||
|
||||
Vendored
+20
-9
@@ -5,40 +5,46 @@ endif()
|
||||
|
||||
project(tbb)
|
||||
|
||||
# 4.1 - works fine
|
||||
set(tbb_ver "tbb41_20120718oss")
|
||||
set(tbb_url "http://threadingbuildingblocks.org/uploads/77/188/4.1/tbb41_20120718oss_src.tgz")
|
||||
set(tbb_md5 "31b9ec300f3d09da2504d5d882788dd4")
|
||||
# 4.1 update 1 - works fine
|
||||
set(tbb_ver "tbb41_20121003oss")
|
||||
set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20121003oss_src.tgz")
|
||||
set(tbb_md5 "2a684fefb855d2d0318d1ef09afa75ff")
|
||||
set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.1 - works fine
|
||||
#set(tbb_ver "tbb41_20120718oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb41_20120718oss_src.tgz")
|
||||
#set(tbb_md5 "31b9ec300f3d09da2504d5d882788dd4")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.0 update 5 - works fine
|
||||
#set(tbb_ver "tbb40_20120613oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/uploads/77/187/4.0%20update%205/tbb40_20120613oss_src.tgz")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20120613oss_src.tgz")
|
||||
#set(tbb_md5 "da01ed74944ec5950cfae3476901a172")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.0 update 4 - works fine
|
||||
#set(tbb_ver "tbb40_20120408oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/uploads/77/185/4.0%20update%204/tbb40_20120408oss_src.tgz")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20120408oss_src.tgz")
|
||||
#set(tbb_md5 "734b356da7fe0ed308741f3e6018251e")
|
||||
#set(tbb_version_file "version_string.ver")
|
||||
|
||||
# 4.0 update 3 - build broken
|
||||
#set(tbb_ver "tbb40_20120201oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/uploads/77/182/4.0%20update%203/tbb40_20120201oss_src.tgz")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20120201oss_src.tgz")
|
||||
#set(tbb_md5 "4669e7d4adee018de7a7b8b972987218")
|
||||
#set(tbb_version_file "version_string.tmp")
|
||||
|
||||
# 4.0 update 2 - works fine
|
||||
#set(tbb_ver "tbb40_20111130oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/uploads/77/180/4.0%20update%202/tbb40_20111130oss_src.tgz")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20111130oss_src.tgz")
|
||||
#set(tbb_md5 "1e6926b21e865e79772119cd44fc3ad8")
|
||||
#set(tbb_version_file "version_string.tmp")
|
||||
#set(tbb_need_GENERIC_DWORD_LOAD_STORE TRUE)
|
||||
|
||||
# 4.0 update 1 - works fine
|
||||
#set(tbb_ver "tbb40_20111003oss")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/uploads/77/177/4.0%20update%201/tbb40_20111003oss_src.tgz")
|
||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20111003oss_src.tgz")
|
||||
#set(tbb_md5 "7b5d94eb35a563b29ef402e0fd8f15c9")
|
||||
#set(tbb_version_file "version_string.tmp")
|
||||
#set(tbb_need_GENERIC_DWORD_LOAD_STORE TRUE)
|
||||
@@ -123,6 +129,11 @@ add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required
|
||||
-DDO_ITT_NOTIFY=0 #it seems that we don't need these notifications
|
||||
)
|
||||
|
||||
if(ANDROID_COMPILER_IS_CLANG)
|
||||
add_definitions(-D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-prototypes)
|
||||
endif()
|
||||
|
||||
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
||||
#needed by TBB 4.0 update 1,2; fixed in TBB 4.0 update 3 but it has 2 new problems
|
||||
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
||||
|
||||
+3
-2
@@ -459,7 +459,7 @@ if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
|
||||
add_subdirectory(samples)
|
||||
endif()
|
||||
|
||||
if(BUILD_ANDROID_SERVICE)
|
||||
if(ANDROID)
|
||||
add_subdirectory(android/service)
|
||||
endif()
|
||||
|
||||
@@ -467,7 +467,7 @@ if(BUILD_ANDROID_PACKAGE)
|
||||
add_subdirectory(android/package)
|
||||
endif()
|
||||
|
||||
if (ANDROID AND NOT BUILD_ANDROID_SERVICE AND NOT BUILD_ANDROID_PACKAGE AND NOT BUILD_CAMERA_WRAPER)
|
||||
if (ANDROID)
|
||||
add_subdirectory(android/libinfo)
|
||||
endif()
|
||||
|
||||
@@ -565,6 +565,7 @@ if(ANDROID)
|
||||
status("")
|
||||
status(" Android: ")
|
||||
status(" Android ABI:" ${ANDROID_ABI})
|
||||
status(" STL type:" ${ANDROID_STL})
|
||||
status(" Native API level:" android-${ANDROID_NATIVE_API_LEVEL})
|
||||
status(" SDK target:" "${ANDROID_SDK_TARGET}")
|
||||
if(BUILD_WITH_ANDROID_NDK)
|
||||
|
||||
+351
-186
@@ -1,7 +1,37 @@
|
||||
# Copyright (c) 2010-2011, Ethan Rublee
|
||||
# Copyright (c) 2011-2012, Andrey Kamaev
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. The name of the copyright holders may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Android CMake toolchain file, for use with the Android NDK r5-r8
|
||||
# Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
|
||||
# See home page: http://code.google.com/p/android-cmake/
|
||||
# See home page: https://github.com/taka-no-me/android-cmake
|
||||
#
|
||||
# The file is mantained by the OpenCV project. The latest version can be get at
|
||||
# http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
|
||||
@@ -64,6 +94,20 @@
|
||||
# ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
|
||||
# Option is read-only when standalone toolchain is used.
|
||||
#
|
||||
# ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 - the name of compiler
|
||||
# toolchain to be used. The list of possible values depends on the NDK
|
||||
# version. For NDK r8c the possible values are:
|
||||
#
|
||||
# * arm-linux-androideabi-4.4.3
|
||||
# * arm-linux-androideabi-4.6
|
||||
# * arm-linux-androideabi-clang3.1
|
||||
# * mipsel-linux-android-4.4.3
|
||||
# * mipsel-linux-android-4.6
|
||||
# * mipsel-linux-android-clang3.1
|
||||
# * x86-4.4.3
|
||||
# * x86-4.6
|
||||
# * x86-clang3.1
|
||||
#
|
||||
# ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions
|
||||
# instead of Thumb. Is not available for "x86" (inapplicable) and
|
||||
# "armeabi-v6 with VFP" (is forced to be ON) ABIs.
|
||||
@@ -147,13 +191,9 @@
|
||||
# under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
|
||||
# (depending on the target ABI). This is convenient for Android packaging.
|
||||
#
|
||||
# Authors:
|
||||
# Ethan Rublee ethan.ruble@gmail.com
|
||||
# Andrey Kamaev andrey.kamaev@itseez.com
|
||||
#
|
||||
# Change Log:
|
||||
# - initial version December 2010
|
||||
# - modified April 2011
|
||||
# - April 2011
|
||||
# [+] added possibility to build with NDK (without standalone toolchain)
|
||||
# [+] support cross-compilation on Windows (native, no cygwin support)
|
||||
# [+] added compiler option to force "char" type to be signed
|
||||
@@ -164,13 +204,13 @@
|
||||
# [+] EXECUTABLE_OUTPUT_PATH is set by toolchain (required on Windows)
|
||||
# [~] Fixed bug with ANDROID_API_LEVEL variable
|
||||
# [~] turn off SWIG search if it is not found first time
|
||||
# - modified May 2011
|
||||
# - May 2011
|
||||
# [~] ANDROID_LEVEL is renamed to ANDROID_API_LEVEL
|
||||
# [+] ANDROID_API_LEVEL is detected by toolchain if not specified
|
||||
# [~] added guard to prevent changing of output directories on the first
|
||||
# cmake pass
|
||||
# [~] toolchain exits with error if ARM_TARGET is not recognized
|
||||
# - modified June 2011
|
||||
# - June 2011
|
||||
# [~] default NDK path is updated for version r5c
|
||||
# [+] variable CMAKE_SYSTEM_PROCESSOR is set based on ARM_TARGET
|
||||
# [~] toolchain install directory is added to linker paths
|
||||
@@ -178,13 +218,13 @@
|
||||
# [+] added macro find_host_package, find_host_program to search
|
||||
# packages/programs on the host system
|
||||
# [~] fixed path to STL library
|
||||
# - modified July 2011
|
||||
# - July 2011
|
||||
# [~] fixed options caching
|
||||
# [~] search for all supported NDK versions
|
||||
# [~] allowed spaces in NDK path
|
||||
# - modified September 2011
|
||||
# - September 2011
|
||||
# [~] updated for NDK r6b
|
||||
# - modified November 2011
|
||||
# - November 2011
|
||||
# [*] rewritten for NDK r7
|
||||
# [+] x86 toolchain support (experimental)
|
||||
# [+] added "armeabi-v6 with VFP" ABI for ARMv6 processors.
|
||||
@@ -197,37 +237,37 @@
|
||||
# [~] ARM_TARGET is renamed to ANDROID_ABI
|
||||
# [~] ARMEABI_NDK_NAME is renamed to ANDROID_NDK_ABI_NAME
|
||||
# [~] ANDROID_API_LEVEL is renamed to ANDROID_NATIVE_API_LEVEL
|
||||
# - modified January 2012
|
||||
# - January 2012
|
||||
# [+] added stlport_static support (experimental)
|
||||
# [+] added special check for cygwin
|
||||
# [+] filtered out hidden files (starting with .) while globbing inside NDK
|
||||
# [+] automatically applied GLESv2 linkage fix for NDK revisions 5-6
|
||||
# [+] added ANDROID_GET_ABI_RAWNAME to get NDK ABI names by CMake flags
|
||||
# - modified February 2012
|
||||
# - February 2012
|
||||
# [+] updated for NDK r7b
|
||||
# [~] fixed cmake try_compile() command
|
||||
# [~] Fix for missing install_name_tool on OS X
|
||||
# - modified March 2012
|
||||
# - March 2012
|
||||
# [~] fixed incorrect C compiler flags
|
||||
# [~] fixed CMAKE_SYSTEM_PROCESSOR change on ANDROID_ABI change
|
||||
# [+] improved toolchain loading speed
|
||||
# [+] added assembler language support (.S)
|
||||
# [+] allowed preset search paths and extra search suffixes
|
||||
# - modified April 2012
|
||||
# - April 2012
|
||||
# [+] updated for NDK r7c
|
||||
# [~] fixed most of problems with compiler/linker flags and caching
|
||||
# [+] added option ANDROID_FUNCTION_LEVEL_LINKING
|
||||
# - modified May 2012
|
||||
# - May 2012
|
||||
# [+] updated for NDK r8
|
||||
# [+] added mips architecture support
|
||||
# - modified August 2012
|
||||
# - August 2012
|
||||
# [+] updated for NDK r8b
|
||||
# [~] all intermediate files generated by toolchain are moved to CMakeFiles
|
||||
# [~] libstdc++ and libsupc are removed from explicit link libraries
|
||||
# [+] added CCache support (via NDK_CCACHE environment or cmake variable)
|
||||
# [+] added gold linker support for NDK r8b
|
||||
# [~] fixed mips linker flags for NDK r8b
|
||||
# - modified September 2012
|
||||
# - September 2012
|
||||
# [+] added NDK release name detection (see ANDROID_NDK_RELEASE)
|
||||
# [+] added support for all C++ runtimes from NDK
|
||||
# (system, gabi++, stlport, gnustl)
|
||||
@@ -235,8 +275,14 @@
|
||||
# [~] use gold linker as default if available (NDK r8b)
|
||||
# [~] globally turned off rpath
|
||||
# [~] compiler options are aligned with NDK r8b
|
||||
# - modified October 2012
|
||||
# - October 2012
|
||||
# [~] fixed C++ linking: explicitly link with math library (OpenCV #2426)
|
||||
# - November 2012
|
||||
# [+] updated for NDK r8c
|
||||
# [+] added support for clang compiler
|
||||
# - December 2012
|
||||
# [~] fixed ccache full path search
|
||||
# [+] updated for NDK r8d
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
cmake_minimum_required( VERSION 2.6.3 )
|
||||
@@ -259,7 +305,7 @@ set( CMAKE_SYSTEM_VERSION 1 )
|
||||
# rpath makes low sence for Android
|
||||
set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )
|
||||
|
||||
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
|
||||
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
|
||||
if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
|
||||
if( CMAKE_HOST_WIN32 )
|
||||
file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
|
||||
@@ -367,8 +413,8 @@ endmacro()
|
||||
|
||||
macro( __DETECT_TOOLCHAIN_MACHINE_NAME _var _root )
|
||||
if( EXISTS "${_root}" )
|
||||
file( GLOB __gccExePath "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
|
||||
__LIST_FILTER( __gccExePath "bin/[.].*-gcc${TOOL_OS_SUFFIX}$" )
|
||||
file( GLOB __gccExePath RELATIVE "${_root}/bin/" "${_root}/bin/*-gcc${TOOL_OS_SUFFIX}" )
|
||||
__LIST_FILTER( __gccExePath "^[.].*" )
|
||||
list( LENGTH __gccExePath __gccExePathsCount )
|
||||
if( NOT __gccExePathsCount EQUAL 1 AND NOT _CMAKE_IN_TRY_COMPILE )
|
||||
message( WARNING "Could not determine machine name for compiler from ${_root}" )
|
||||
@@ -506,55 +552,76 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
|
||||
elseif( __availableToolchainMachines MATCHES mipsel )
|
||||
set( __availableToolchainArchs "mipsel" )
|
||||
endif()
|
||||
if( ANDROID_COMPILER_VERSION )
|
||||
# do not run gcc every time because it is relatevely expencive
|
||||
set( __availableToolchainCompilerVersions "${ANDROID_COMPILER_VERSION}" )
|
||||
else()
|
||||
execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" --version
|
||||
OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9]+)?" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" )
|
||||
execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" -dumpversion
|
||||
OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9]+)?" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" )
|
||||
if( EXISTS "${ANDROID_STANDALONE_TOOLCHAIN}/bin/clang${TOOL_OS_SUFFIX}" )
|
||||
list( APPEND __availableToolchains "standalone-clang" )
|
||||
list( APPEND __availableToolchainMachines ${__availableToolchainMachines} )
|
||||
list( APPEND __availableToolchainArchs ${__availableToolchainArchs} )
|
||||
list( APPEND __availableToolchainCompilerVersions ${__availableToolchainCompilerVersions} )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar )
|
||||
foreach( __toolchain ${${__availableToolchainsVar}} )
|
||||
if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK}/toolchains/${__toolchain}/prebuilt/" )
|
||||
string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
|
||||
else()
|
||||
set( __gcc_toolchain "${__toolchain}" )
|
||||
endif()
|
||||
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK}/toolchains/${__gcc_toolchain}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
|
||||
if( __machine )
|
||||
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9]+)?$" __version "${__gcc_toolchain}" )
|
||||
string( REGEX MATCH "^[^-]+" __arch "${__gcc_toolchain}" )
|
||||
list( APPEND __availableToolchainMachines "${__machine}" )
|
||||
list( APPEND __availableToolchainArchs "${__arch}" )
|
||||
list( APPEND __availableToolchainCompilerVersions "${__version}" )
|
||||
else()
|
||||
list( REMOVE_ITEM ${__availableToolchainsVar} "${__toolchain}" )
|
||||
endif()
|
||||
unset( __gcc_toolchain )
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
# get all the details about NDK
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
file( GLOB ANDROID_SUPPORTED_NATIVE_API_LEVELS RELATIVE "${ANDROID_NDK}/platforms" "${ANDROID_NDK}/platforms/android-*" )
|
||||
string( REPLACE "android-" "" ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_SUPPORTED_NATIVE_API_LEVELS}" )
|
||||
file( GLOB __availableToolchains RELATIVE "${ANDROID_NDK}/toolchains" "${ANDROID_NDK}/toolchains/*" )
|
||||
__LIST_FILTER( __availableToolchains "^[.]" )
|
||||
set( __availableToolchains "" )
|
||||
set( __availableToolchainMachines "" )
|
||||
set( __availableToolchainArchs "" )
|
||||
set( __availableToolchainCompilerVersions "" )
|
||||
foreach( __toolchain ${__availableToolchains} )
|
||||
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK}/toolchains/${__toolchain}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
|
||||
if( __machine )
|
||||
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9]+)?$" __version "${__toolchain}" )
|
||||
string( REGEX MATCH "^[^-]+" __arch "${__toolchain}" )
|
||||
list( APPEND __availableToolchainMachines "${__machine}" )
|
||||
list( APPEND __availableToolchainArchs "${__arch}" )
|
||||
list( APPEND __availableToolchainCompilerVersions "${__version}" )
|
||||
else()
|
||||
list( REMOVE_ITEM __availableToolchains "${__toolchain}" )
|
||||
endif()
|
||||
endforeach()
|
||||
if( ANDROID_TOOLCHAIN_NAME AND EXISTS "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/" )
|
||||
# do not go through all toolchains if we know the name
|
||||
set( __availableToolchains "${ANDROID_TOOLCHAIN_NAME}" )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains )
|
||||
endif()
|
||||
if( NOT __availableToolchains )
|
||||
message( FATAL_ERROR "Could not any working toolchain in the NDK. Probably your Android NDK is broken." )
|
||||
file( GLOB __availableToolchains RELATIVE "${ANDROID_NDK}/toolchains" "${ANDROID_NDK}/toolchains/*" )
|
||||
if( __availableToolchains )
|
||||
list(SORT __availableToolchains) # we need clang to go after gcc
|
||||
endif()
|
||||
__LIST_FILTER( __availableToolchains "^[.]" )
|
||||
__LIST_FILTER( __availableToolchains "llvm" )
|
||||
__GLOB_NDK_TOOLCHAINS( __availableToolchains )
|
||||
endif()
|
||||
if( NOT __availableToolchains )
|
||||
message( FATAL_ERROR "Could not find any working toolchain in the NDK. Probably your Android NDK is broken." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# build list of available ABIs
|
||||
set( ANDROID_SUPPORTED_ABIS "" )
|
||||
set( __uniqToolchainArchNames ${__availableToolchainArchs} )
|
||||
list( REMOVE_DUPLICATES __uniqToolchainArchNames )
|
||||
list( SORT __uniqToolchainArchNames )
|
||||
foreach( __arch ${__uniqToolchainArchNames} )
|
||||
list( APPEND ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${__arch}} )
|
||||
endforeach()
|
||||
unset( __uniqToolchainArchNames )
|
||||
if( NOT ANDROID_SUPPORTED_ABIS )
|
||||
set( ANDROID_SUPPORTED_ABIS "" )
|
||||
set( __uniqToolchainArchNames ${__availableToolchainArchs} )
|
||||
list( REMOVE_DUPLICATES __uniqToolchainArchNames )
|
||||
list( SORT __uniqToolchainArchNames )
|
||||
foreach( __arch ${__uniqToolchainArchNames} )
|
||||
list( APPEND ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${__arch}} )
|
||||
endforeach()
|
||||
unset( __uniqToolchainArchNames )
|
||||
if( NOT ANDROID_SUPPORTED_ABIS )
|
||||
message( FATAL_ERROR "No one of known Android ABIs is supported by this cmake toolchain." )
|
||||
endif()
|
||||
message( FATAL_ERROR "No one of known Android ABIs is supported by this cmake toolchain." )
|
||||
endif()
|
||||
|
||||
# choose target ABI
|
||||
@@ -569,33 +636,34 @@ if( __androidAbiIdx EQUAL -1 )
|
||||
endif()
|
||||
unset( __androidAbiIdx )
|
||||
|
||||
# remember target ABI
|
||||
set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
|
||||
|
||||
# set target ABI options
|
||||
if( ANDROID_ABI STREQUAL "x86" )
|
||||
set( X86 true )
|
||||
set( ANDROID_NDK_ABI_NAME "x86" )
|
||||
set( ANDROID_ARCH_NAME "x86" )
|
||||
set( ANDROID_ARCH_FULLNAME "x86" )
|
||||
set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
|
||||
set( CMAKE_SYSTEM_PROCESSOR "i686" )
|
||||
elseif( ANDROID_ABI STREQUAL "mips" )
|
||||
set( MIPS true )
|
||||
set( ANDROID_NDK_ABI_NAME "mips" )
|
||||
set( ANDROID_ARCH_NAME "mips" )
|
||||
set( ANDROID_ARCH_FULLNAME "mipsel" )
|
||||
set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
|
||||
set( CMAKE_SYSTEM_PROCESSOR "mips" )
|
||||
elseif( ANDROID_ABI STREQUAL "armeabi" )
|
||||
set( ARMEABI true )
|
||||
set( ANDROID_NDK_ABI_NAME "armeabi" )
|
||||
set( ANDROID_ARCH_NAME "arm" )
|
||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
||||
set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
|
||||
set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
|
||||
elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
|
||||
set( ARMEABI_V6 true )
|
||||
set( ANDROID_NDK_ABI_NAME "armeabi" )
|
||||
set( ANDROID_ARCH_NAME "arm" )
|
||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
||||
set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
|
||||
set( CMAKE_SYSTEM_PROCESSOR "armv6" )
|
||||
# need always fallback to older platform
|
||||
set( ARMEABI true )
|
||||
@@ -604,12 +672,14 @@ elseif( ANDROID_ABI STREQUAL "armeabi-v7a")
|
||||
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
||||
set( ANDROID_ARCH_NAME "arm" )
|
||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
||||
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
||||
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
||||
elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
|
||||
set( ARMEABI_V7A true )
|
||||
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
||||
set( ANDROID_ARCH_NAME "arm" )
|
||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
||||
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
||||
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
||||
set( VFPV3 true )
|
||||
elseif( ANDROID_ABI STREQUAL "armeabi-v7a with NEON" )
|
||||
@@ -617,6 +687,7 @@ elseif( ANDROID_ABI STREQUAL "armeabi-v7a with NEON" )
|
||||
set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
|
||||
set( ANDROID_ARCH_NAME "arm" )
|
||||
set( ANDROID_ARCH_FULLNAME "arm" )
|
||||
set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
|
||||
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
|
||||
set( VFPV3 true )
|
||||
set( NEON true )
|
||||
@@ -630,12 +701,6 @@ if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMa
|
||||
file( APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" "SET(CMAKE_SYSTEM_PROCESSOR \"${CMAKE_SYSTEM_PROCESSOR}\")\n" )
|
||||
endif()
|
||||
|
||||
set( ANDROID_SUPPORTED_ABIS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} CACHE INTERNAL "ANDROID_ABI can be changed only to one of these ABIs. Changing to any other ABI requires to reset cmake cache." FORCE )
|
||||
if( CMAKE_VERSION VERSION_GREATER "2.8" )
|
||||
list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME} )
|
||||
set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} )
|
||||
endif()
|
||||
|
||||
if( ANDROID_ARCH_NAME STREQUAL "arm" AND NOT ARMEABI_V6 )
|
||||
__INIT_VARIABLE( ANDROID_FORCE_ARM_BUILD OBSOLETE_FORCE_ARM VALUES OFF )
|
||||
set( ANDROID_FORCE_ARM_BUILD ${ANDROID_FORCE_ARM_BUILD} CACHE BOOL "Use 32-bit ARM instructions instead of Thumb-1" FORCE )
|
||||
@@ -648,11 +713,15 @@ endif()
|
||||
if( ANDROID_TOOLCHAIN_NAME )
|
||||
list( FIND __availableToolchains "${ANDROID_TOOLCHAIN_NAME}" __toolchainIdx )
|
||||
if( __toolchainIdx EQUAL -1 )
|
||||
message( FATAL_ERROR "Previously selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is missing. You need to remove CMakeCache.txt and rerun cmake manually to change the toolchain" )
|
||||
list( SORT __availableToolchains )
|
||||
string( REPLACE ";" "\n * " toolchains_list "${__availableToolchains}" )
|
||||
set( toolchains_list " * ${toolchains_list}")
|
||||
message( FATAL_ERROR "Specified toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is missing in your NDK or broken. Please verify that your NDK is working or select another compiler toolchain.
|
||||
To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one of the following values:\n${toolchains_list}\n" )
|
||||
endif()
|
||||
list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
|
||||
if( NOT __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
|
||||
message( SEND_ERROR "Previously selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
|
||||
message( SEND_ERROR "Selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
|
||||
endif()
|
||||
else()
|
||||
set( __toolchainIdx -1 )
|
||||
@@ -681,8 +750,7 @@ endif()
|
||||
list( GET __availableToolchains ${__toolchainIdx} ANDROID_TOOLCHAIN_NAME )
|
||||
list( GET __availableToolchainMachines ${__toolchainIdx} ANDROID_TOOLCHAIN_MACHINE_NAME )
|
||||
list( GET __availableToolchainCompilerVersions ${__toolchainIdx} ANDROID_COMPILER_VERSION )
|
||||
set( ANDROID_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" CACHE INTERNAL "Name of toolchain used" FORCE )
|
||||
set( ANDROID_COMPILER_VERSION "${ANDROID_COMPILER_VERSION}" CACHE INTERNAL "compiler version from selected toolchain" FORCE )
|
||||
|
||||
unset( __toolchainIdx )
|
||||
unset( __availableToolchains )
|
||||
unset( __availableToolchainMachines )
|
||||
@@ -692,37 +760,35 @@ unset( __availableToolchainCompilerVersions )
|
||||
# choose native API level
|
||||
__INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
|
||||
string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
|
||||
# TODO: filter out unsupported levels
|
||||
# validate
|
||||
list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
|
||||
if( __levelIdx EQUAL -1 )
|
||||
message( SEND_ERROR "Specified Android native API level (${ANDROID_NATIVE_API_LEVEL}) is not supported by your NDK/toolchain." )
|
||||
else()
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
__DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
|
||||
if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
|
||||
message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
|
||||
endif()
|
||||
unset( __realApiLevel )
|
||||
endif()
|
||||
set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
|
||||
if( CMAKE_VERSION VERSION_GREATER "2.8" )
|
||||
list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
|
||||
set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
|
||||
endif()
|
||||
endif()
|
||||
unset( __levelIdx )
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
__DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
|
||||
if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
|
||||
message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
|
||||
endif()
|
||||
unset( __realApiLevel )
|
||||
endif()
|
||||
set( ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" CACHE STRING "Android API level for native code" FORCE )
|
||||
|
||||
|
||||
# remember target ABI
|
||||
set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
|
||||
if( CMAKE_VERSION VERSION_GREATER "2.8" )
|
||||
list( SORT ANDROID_SUPPORTED_NATIVE_API_LEVELS )
|
||||
set_property( CACHE ANDROID_NATIVE_API_LEVEL PROPERTY STRINGS ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
|
||||
list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME} )
|
||||
set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} )
|
||||
endif()
|
||||
|
||||
# setup output directories
|
||||
set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
|
||||
set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path for installing" )
|
||||
|
||||
if(NOT _CMAKE_IN_TRY_COMPILE)
|
||||
if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
|
||||
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
|
||||
else()
|
||||
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
|
||||
endif()
|
||||
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
|
||||
endif()
|
||||
|
||||
# runtime choice (STL, rtti, exceptions)
|
||||
if( NOT ANDROID_STL )
|
||||
@@ -800,83 +866,11 @@ See https://android.googlesource.com/platform/development.git f907f4f9d4e56ccc80
|
||||
" )
|
||||
endif()
|
||||
|
||||
# setup paths and STL for NDK
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
|
||||
set( ANDROID_SYSROOT "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}" )
|
||||
|
||||
if( ANDROID_STL STREQUAL "none" )
|
||||
# do nothing
|
||||
elseif( ANDROID_STL STREQUAL "system" )
|
||||
set( ANDROID_RTTI OFF )
|
||||
set( ANDROID_EXCEPTIONS OFF )
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
|
||||
elseif( ANDROID_STL STREQUAL "system_re" )
|
||||
set( ANDROID_RTTI ON )
|
||||
set( ANDROID_EXCEPTIONS ON )
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
|
||||
elseif( ANDROID_STL MATCHES "gabi" )
|
||||
if( ANDROID_NDK_RELEASE STRLESS "r7" )
|
||||
message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
|
||||
endif()
|
||||
set( ANDROID_RTTI ON )
|
||||
set( ANDROID_EXCEPTIONS OFF )
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
|
||||
elseif( ANDROID_STL MATCHES "stlport" )
|
||||
set( ANDROID_EXCEPTIONS OFF )
|
||||
if( ANDROID_NDK_RELEASE STRLESS "r7" )
|
||||
set( ANDROID_RTTI OFF )
|
||||
else()
|
||||
set( ANDROID_RTTI ON )
|
||||
endif()
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/stlport/stlport" )
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/stlport/libs/${ANDROID_NDK_ABI_NAME}/libstlport_static.a" )
|
||||
elseif( ANDROID_STL MATCHES "gnustl" )
|
||||
set( ANDROID_EXCEPTIONS ON )
|
||||
set( ANDROID_RTTI ON )
|
||||
if( EXISTS "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}" )
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}" )
|
||||
else()
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
|
||||
endif()
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" )
|
||||
if( EXISTS "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
|
||||
set( __libstl "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
|
||||
else()
|
||||
set( __libstl "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" )
|
||||
endif()
|
||||
else()
|
||||
message( FATAL_ERROR "Unknown runtime: ${ANDROID_STL}" )
|
||||
endif()
|
||||
# find libsupc++.a - rtti & exceptions
|
||||
if( ANDROID_STL STREQUAL "system_re" OR ANDROID_STL MATCHES "gnustl" )
|
||||
if( ANDROID_NDK_RELEASE STRGREATER "r8" ) # r8b
|
||||
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" )
|
||||
elseif( NOT ANDROID_NDK_RELEASE STRLESS "r7" AND ANDROID_NDK_RELEASE STRLESS "r8b")
|
||||
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" )
|
||||
else( ANDROID_NDK_RELEASE STRLESS "r7" )
|
||||
if( ARMEABI_V7A )
|
||||
if( ANDROID_FORCE_ARM_BUILD )
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" )
|
||||
else()
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" )
|
||||
endif()
|
||||
elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD )
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" )
|
||||
else()
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" )
|
||||
endif()
|
||||
endif()
|
||||
if( NOT EXISTS "${__libsupcxx}")
|
||||
message( ERROR "Could not find libsupc++.a for a chosen platform. Either your NDK is not supported or is broken.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# setup paths and STL for standalone toolchain
|
||||
if( BUILD_WITH_STANDALONE_TOOLCHAIN )
|
||||
set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" )
|
||||
set( ANDROID_CLANG_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" )
|
||||
set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )
|
||||
|
||||
if( NOT ANDROID_STL STREQUAL "none" )
|
||||
@@ -923,6 +917,115 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# clang
|
||||
if( "${ANDROID_TOOLCHAIN_NAME}" STREQUAL "standalone-clang" )
|
||||
set( ANDROID_COMPILER_IS_CLANG 1 )
|
||||
execute_process( COMMAND "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/clang${TOOL_OS_SUFFIX}" --version OUTPUT_VARIABLE ANDROID_CLANG_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
string( REGEX MATCH "[0-9]+[.][0-9]+" ANDROID_CLANG_VERSION "${ANDROID_CLANG_VERSION}")
|
||||
elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
|
||||
string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
|
||||
string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-4.6" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
|
||||
if( NOT EXISTS "${ANDROID_NDK}/toolchains/llvm-${ANDROID_CLANG_VERSION}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}/bin/clang${TOOL_OS_SUFFIX}" )
|
||||
message( FATAL_ERROR "Could not find the " )
|
||||
endif()
|
||||
set( ANDROID_COMPILER_IS_CLANG 1 )
|
||||
set( ANDROID_CLANG_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/llvm-${ANDROID_CLANG_VERSION}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
|
||||
else()
|
||||
set( ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
|
||||
unset( ANDROID_COMPILER_IS_CLANG CACHE )
|
||||
endif()
|
||||
|
||||
string( REPLACE "." "" _clang_name "clang${ANDROID_CLANG_VERSION}" )
|
||||
if( NOT EXISTS "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}${TOOL_OS_SUFFIX}" )
|
||||
set( _clang_name "clang" )
|
||||
endif()
|
||||
|
||||
|
||||
# setup paths and STL for NDK
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
|
||||
set( ANDROID_SYSROOT "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}" )
|
||||
|
||||
if( ANDROID_STL STREQUAL "none" )
|
||||
# do nothing
|
||||
elseif( ANDROID_STL STREQUAL "system" )
|
||||
set( ANDROID_RTTI OFF )
|
||||
set( ANDROID_EXCEPTIONS OFF )
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
|
||||
elseif( ANDROID_STL STREQUAL "system_re" )
|
||||
set( ANDROID_RTTI ON )
|
||||
set( ANDROID_EXCEPTIONS ON )
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
|
||||
elseif( ANDROID_STL MATCHES "gabi" )
|
||||
if( ANDROID_NDK_RELEASE STRLESS "r7" )
|
||||
message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
|
||||
endif()
|
||||
set( ANDROID_RTTI ON )
|
||||
set( ANDROID_EXCEPTIONS OFF )
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
|
||||
elseif( ANDROID_STL MATCHES "stlport" )
|
||||
if( NOT ANDROID_NDK_RELEASE STRLESS "r8d" )
|
||||
set( ANDROID_EXCEPTIONS ON )
|
||||
else()
|
||||
set( ANDROID_EXCEPTIONS OFF )
|
||||
endif()
|
||||
if( ANDROID_NDK_RELEASE STRLESS "r7" )
|
||||
set( ANDROID_RTTI OFF )
|
||||
else()
|
||||
set( ANDROID_RTTI ON )
|
||||
endif()
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/stlport/stlport" )
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/stlport/libs/${ANDROID_NDK_ABI_NAME}/libstlport_static.a" )
|
||||
elseif( ANDROID_STL MATCHES "gnustl" )
|
||||
set( ANDROID_EXCEPTIONS ON )
|
||||
set( ANDROID_RTTI ON )
|
||||
if( EXISTS "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}" )
|
||||
if( ARMEABI_V7A AND ANDROID_COMPILER_VERSION VERSION_EQUAL "4.7" AND ANDROID_NDK_RELEASE STREQUAL "r8d" )
|
||||
# gnustl binary for 4.7 compiler is buggy :(
|
||||
# TODO: look for right fix
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/4.6" )
|
||||
else()
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}" )
|
||||
endif()
|
||||
else()
|
||||
set( __libstl "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
|
||||
endif()
|
||||
set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" )
|
||||
if( EXISTS "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
|
||||
set( __libstl "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
|
||||
else()
|
||||
set( __libstl "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libstdc++.a" )
|
||||
endif()
|
||||
else()
|
||||
message( FATAL_ERROR "Unknown runtime: ${ANDROID_STL}" )
|
||||
endif()
|
||||
# find libsupc++.a - rtti & exceptions
|
||||
if( ANDROID_STL STREQUAL "system_re" OR ANDROID_STL MATCHES "gnustl" )
|
||||
if( ANDROID_NDK_RELEASE STRGREATER "r8" ) # r8b
|
||||
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" )
|
||||
elseif( NOT ANDROID_NDK_RELEASE STRLESS "r7" AND ANDROID_NDK_RELEASE STRLESS "r8b")
|
||||
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" )
|
||||
else( ANDROID_NDK_RELEASE STRLESS "r7" )
|
||||
if( ARMEABI_V7A )
|
||||
if( ANDROID_FORCE_ARM_BUILD )
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" )
|
||||
else()
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/thumb/libsupc++.a" )
|
||||
endif()
|
||||
elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD )
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/thumb/libsupc++.a" )
|
||||
else()
|
||||
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/libsupc++.a" )
|
||||
endif()
|
||||
endif()
|
||||
if( NOT EXISTS "${__libsupcxx}")
|
||||
message( ERROR "Could not find libsupc++.a for a chosen platform. Either your NDK is not supported or is broken.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# case of shared STL linkage
|
||||
if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
|
||||
string( REPLACE "_static.a" "_shared.so" __libstl "${__libstl}" )
|
||||
@@ -937,25 +1040,40 @@ if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# ccache support
|
||||
__INIT_VARIABLE( _ndk_ccache NDK_CCACHE ENV_NDK_CCACHE )
|
||||
if( _ndk_ccache )
|
||||
if( DEFINED NDK_CCACHE AND NOT EXISTS NDK_CCACHE )
|
||||
unset( NDK_CCACHE CACHE )
|
||||
endif()
|
||||
find_program( NDK_CCACHE "${_ndk_ccache}" DOC "The path to ccache binary")
|
||||
else()
|
||||
unset( NDK_CCACHE CACHE )
|
||||
endif()
|
||||
unset( _ndk_ccache )
|
||||
|
||||
|
||||
# setup the cross-compiler
|
||||
if( NOT CMAKE_C_COMPILER )
|
||||
if( NDK_CCACHE )
|
||||
set( CMAKE_C_COMPILER "${NDK_CCACHE}" CACHE PATH "ccache as C compiler" )
|
||||
set( CMAKE_CXX_COMPILER "${NDK_CCACHE}" CACHE PATH "ccache as C++ compiler" )
|
||||
set( CMAKE_C_COMPILER_ARG1 "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "gcc")
|
||||
set( CMAKE_CXX_COMPILER_ARG1 "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++${TOOL_OS_SUFFIX}" CACHE PATH "g++")
|
||||
if( ANDROID_COMPILER_IS_CLANG )
|
||||
set( CMAKE_C_COMPILER_ARG1 "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}${TOOL_OS_SUFFIX}" CACHE PATH "C compiler")
|
||||
set( CMAKE_CXX_COMPILER_ARG1 "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}++${TOOL_OS_SUFFIX}" CACHE PATH "C++ compiler")
|
||||
else()
|
||||
set( CMAKE_C_COMPILER_ARG1 "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "C compiler")
|
||||
set( CMAKE_CXX_COMPILER_ARG1 "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++${TOOL_OS_SUFFIX}" CACHE PATH "C++ compiler")
|
||||
endif()
|
||||
else()
|
||||
set( CMAKE_C_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "gcc" )
|
||||
set( CMAKE_CXX_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++${TOOL_OS_SUFFIX}" CACHE PATH "g++" )
|
||||
if( ANDROID_COMPILER_IS_CLANG )
|
||||
set( CMAKE_C_COMPILER "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}${TOOL_OS_SUFFIX}" CACHE PATH "C compiler")
|
||||
set( CMAKE_CXX_COMPILER "${ANDROID_CLANG_TOOLCHAIN_ROOT}/bin/${_clang_name}++${TOOL_OS_SUFFIX}" CACHE PATH "C++ compiler")
|
||||
else()
|
||||
set( CMAKE_C_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "C compiler" )
|
||||
set( CMAKE_CXX_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-g++${TOOL_OS_SUFFIX}" CACHE PATH "C++ compiler" )
|
||||
endif()
|
||||
endif()
|
||||
set( CMAKE_ASM_COMPILER "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-gcc${TOOL_OS_SUFFIX}" CACHE PATH "assembler" )
|
||||
set( CMAKE_STRIP "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TOOLCHAIN_MACHINE_NAME}-strip${TOOL_OS_SUFFIX}" CACHE PATH "strip" )
|
||||
@@ -982,15 +1100,22 @@ endif()
|
||||
# Force set compilers because standard identification works badly for us
|
||||
include( CMakeForceCompiler )
|
||||
CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU )
|
||||
if( ANDROID_COMPILER_IS_CLANG )
|
||||
set( CMAKE_C_COMPILER_ID Clang)
|
||||
endif()
|
||||
set( CMAKE_C_PLATFORM_ID Linux )
|
||||
set( CMAKE_C_SIZEOF_DATA_PTR 4 )
|
||||
set( CMAKE_C_HAS_ISYSROOT 1 )
|
||||
set( CMAKE_C_COMPILER_ABI ELF )
|
||||
CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
|
||||
if( ANDROID_COMPILER_IS_CLANG )
|
||||
set( CMAKE_CXX_COMPILER_ID Clang)
|
||||
endif()
|
||||
set( CMAKE_CXX_PLATFORM_ID Linux )
|
||||
set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
|
||||
set( CMAKE_CXX_HAS_ISYSROOT 1 )
|
||||
set( CMAKE_CXX_COMPILER_ABI ELF )
|
||||
set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
|
||||
# force ASM compiler (required for CMake < 2.8.5)
|
||||
set( CMAKE_ASM_COMPILER_ID_RUN TRUE )
|
||||
set( CMAKE_ASM_COMPILER_ID GNU )
|
||||
@@ -1056,10 +1181,10 @@ if( ARMEABI_V7A )
|
||||
elseif( VFPV3 )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=vfpv3" )
|
||||
else()
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=vfp" )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -mfpu=vfpv3-d16" )
|
||||
endif()
|
||||
elseif( ARMEABI_V6 )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" ) # vfp == vfpv2
|
||||
elseif( ARMEABI )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" )
|
||||
endif()
|
||||
@@ -1148,17 +1273,25 @@ if( ANDROID_FUNCTION_LEVEL_LINKING )
|
||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--gc-sections" )
|
||||
endif()
|
||||
|
||||
if( ANDROID_GOLD_LINKER AND CMAKE_HOST_UNIX AND (ARMEABI OR ARMEABI_V7A OR X86) AND ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
|
||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
|
||||
elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" AND NOT _CMAKE_IN_TRY_COMPILE )
|
||||
message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
|
||||
if( ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
|
||||
if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE STRGREATER "r8b") AND (ARMEABI OR ARMEABI_V7A OR X86) )
|
||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
|
||||
elseif( ANDROID_NDK_RELEASE STRGREATER "r8b")
|
||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=bfd" )
|
||||
elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND NOT _CMAKE_IN_TRY_COMPILE )
|
||||
message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
|
||||
On Linux and OS X host platform you can workaround this problem using gold linker (default).
|
||||
Rerun cmake with -DANDROID_GOLD_LINKER=ON option.
|
||||
Rerun cmake with -DANDROID_GOLD_LINKER=ON option in case of problems.
|
||||
" )
|
||||
endif()
|
||||
endif()
|
||||
endif() # version 4.6
|
||||
|
||||
if( ANDROID_NOEXECSTACK )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -Wa,--noexecstack" )
|
||||
if( ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -Xclang -mnoexecstack" )
|
||||
else()
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -Wa,--noexecstack" )
|
||||
endif()
|
||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-z,noexecstack" )
|
||||
endif()
|
||||
|
||||
@@ -1166,6 +1299,22 @@ if( ANDROID_RELRO )
|
||||
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-z,relro -Wl,-z,now" )
|
||||
endif()
|
||||
|
||||
if( ANDROID_COMPILER_IS_CLANG )
|
||||
set( ANDROID_CXX_FLAGS "-Qunused-arguments ${ANDROID_CXX_FLAGS}" )
|
||||
if( ARMEABI_V7A AND NOT ANDROID_FORCE_ARM_BUILD )
|
||||
set( ANDROID_CXX_FLAGS_RELEASE "-target thumbv7-none-linux-androideabi ${ANDROID_CXX_FLAGS_RELEASE}" )
|
||||
set( ANDROID_CXX_FLAGS_DEBUG "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS_DEBUG}" )
|
||||
else()
|
||||
set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS}" )
|
||||
endif()
|
||||
if( BUILD_WITH_ANDROID_NDK )
|
||||
if(ANDROID_ARCH_NAME STREQUAL "arm" )
|
||||
set( ANDROID_CXX_FLAGS "-isystem ${ANDROID_CLANG_TOOLCHAIN_ROOT}/lib/clang/${ANDROID_CLANG_VERSION}/include ${ANDROID_CXX_FLAGS}" )
|
||||
endif()
|
||||
set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# cache flags
|
||||
set( CMAKE_CXX_FLAGS "" CACHE STRING "c++ flags" )
|
||||
set( CMAKE_C_FLAGS "" CACHE STRING "c flags" )
|
||||
@@ -1189,9 +1338,9 @@ set( CMAKE_MODULE_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FL
|
||||
set( CMAKE_EXE_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" )
|
||||
|
||||
if( MIPS AND BUILD_WITH_ANDROID_NDK AND ANDROID_NDK_RELEASE STREQUAL "r8" )
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
|
||||
set( CMAKE_EXE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
|
||||
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
|
||||
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
|
||||
set( CMAKE_EXE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
|
||||
endif()
|
||||
|
||||
# configure rtti
|
||||
@@ -1218,6 +1367,19 @@ endif()
|
||||
include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
|
||||
link_directories( "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
|
||||
|
||||
# setup output directories
|
||||
set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
|
||||
set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path for installing" )
|
||||
|
||||
if(NOT _CMAKE_IN_TRY_COMPILE)
|
||||
if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
|
||||
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
|
||||
else()
|
||||
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
|
||||
endif()
|
||||
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
|
||||
endif()
|
||||
|
||||
# set these global flags for cmake client scripts to change behavior
|
||||
set( ANDROID True )
|
||||
set( BUILD_ANDROID True )
|
||||
@@ -1335,7 +1497,7 @@ endif()
|
||||
# Variables controlling behavior or set by cmake toolchain:
|
||||
# ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips"
|
||||
# ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
|
||||
# ANDROID_SET_OBSOLETE_VARIABLES : ON/OFF
|
||||
# ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
|
||||
# ANDROID_FORBID_SYGWIN : ON/OFF
|
||||
# ANDROID_NO_UNDEFINED : ON/OFF
|
||||
# ANDROID_SO_UNDEFINED : OFF/ON (default depends on NDK version)
|
||||
@@ -1343,16 +1505,15 @@ endif()
|
||||
# ANDROID_GOLD_LINKER : ON/OFF
|
||||
# ANDROID_NOEXECSTACK : ON/OFF
|
||||
# ANDROID_RELRO : ON/OFF
|
||||
# Variables that takes effect only at first run:
|
||||
# ANDROID_FORCE_ARM_BUILD : ON/OFF
|
||||
# ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
|
||||
# ANDROID_STL_FORCE_FEATURES : ON/OFF
|
||||
# LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
|
||||
# NDK_CCACHE : <path to your ccache executable>
|
||||
# ANDROID_SET_OBSOLETE_VARIABLES : ON/OFF
|
||||
# Can be set only at the first run:
|
||||
# ANDROID_NDK
|
||||
# ANDROID_STANDALONE_TOOLCHAIN
|
||||
# ANDROID_TOOLCHAIN_NAME : "arm-linux-androideabi-4.4.3" or "arm-linux-androideabi-4.6" or "mipsel-linux-android-4.4.3" or "mipsel-linux-android-4.6" or "x86-4.4.3" or "x86-4.6"
|
||||
# ANDROID_TOOLCHAIN_NAME : the NDK name of compiler toolchain
|
||||
# LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
|
||||
# NDK_CCACHE : <path to your ccache executable>
|
||||
# Obsolete:
|
||||
# ANDROID_API_LEVEL : superseded by ANDROID_NATIVE_API_LEVEL
|
||||
# ARM_TARGET : superseded by ANDROID_ABI
|
||||
@@ -1375,10 +1536,11 @@ endif()
|
||||
# BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
|
||||
# ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
|
||||
# ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
|
||||
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b; set only for NDK
|
||||
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d; set only for NDK
|
||||
# ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
|
||||
# ANDROID_SYSROOT : path to the compiler sysroot
|
||||
# TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
|
||||
# ANDROID_COMPILER_IS_CLANG : TRUE if clang compiler is used
|
||||
# Obsolete:
|
||||
# ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
|
||||
#
|
||||
@@ -1388,10 +1550,13 @@ endif()
|
||||
# ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
|
||||
# ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
|
||||
# ANDROID_TOOLCHAIN_ROOT : path to the top level of toolchain (standalone or placed inside NDK)
|
||||
# ANDROID_CLANG_TOOLCHAIN_ROOT : path to clang tools
|
||||
# ANDROID_SUPPORTED_NATIVE_API_LEVELS : list of native API levels found inside NDK
|
||||
# ANDROID_STL_INCLUDE_DIRS : stl include paths
|
||||
# ANDROID_RTTI : if rtti is enabled by the runtime
|
||||
# ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
|
||||
# ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
|
||||
# ANDROID_CLANG_VERSION : version of clang compiler if clang is used
|
||||
#
|
||||
# Defaults:
|
||||
# ANDROID_DEFAULT_NDK_API_LEVEL
|
||||
|
||||
+1
-1
@@ -3,4 +3,4 @@ Java API
|
||||
********
|
||||
|
||||
|
||||
`Java API reference external link (JavaDoc) <http://docs.opencv.org/java/>`_
|
||||
Java API reference (JavaDoc): external `link <http://docs.opencv.org/java/>`_.
|
||||
|
||||
@@ -35,5 +35,5 @@ set_target_properties(${the_module} PROPERTIES
|
||||
INSTALL_NAME_DIR lib
|
||||
)
|
||||
|
||||
get_filename_component(lib_name "opencv_info" NAME)
|
||||
install(FILES "${LIBRARY_OUTPUT_PATH}/${lib_name}" DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||
get_filename_component(lib_name "libopencv_info.so" NAME)
|
||||
install(FILES "${LIBRARY_OUTPUT_PATH}/${lib_name}" DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT main)
|
||||
|
||||
@@ -7,7 +7,7 @@ const char* GetLibraryList(void);
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_android_StaticHelper_getLibraryList(JNIEnv *, jclass);
|
||||
|
||||
#define PACKAGE_NAME "org.opencv.lib_v" CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) "_" ANDROID_PACKAGE_PLATFORM
|
||||
#define PACKAGE_REVISION CVAUX_STR(CV_SUBMINOR_VERSION) CVAUX_STR(ANDROID_PACKAGE_RELEASE)
|
||||
#define PACKAGE_REVISION CVAUX_STR(CV_SUBMINOR_VERSION) "." CVAUX_STR(ANDROID_PACKAGE_RELEASE)
|
||||
|
||||
const char* GetPackageName(void)
|
||||
{
|
||||
|
||||
@@ -16,3 +16,8 @@ native_camera_r4.0.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.
|
||||
native_camera_r4.1.1; armeabi; 14; /home/alexander/Projects/AndroidSource/4.1.1
|
||||
native_camera_r4.1.1; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.1.1
|
||||
native_camera_r4.1.1; x86; 14; /home/alexander/Projects/AndroidSource/4.1.1
|
||||
native_camera_r4.1.1; mips; 14; /home/alexander/Projects/AndroidSource/4.1.1_mips
|
||||
native_camera_r4.2.0; armeabi-v7a; 14; /home/alexander/Projects/AndroidSource/4.2
|
||||
native_camera_r4.2.0; armeabi; 14; /home/alexander/Projects/AndroidSource/4.2
|
||||
native_camera_r4.2.0; x86; 14; /home/alexander/Projects/AndroidSource/4.2
|
||||
native_camera_r4.2.0; mips; 14; /home/alexander/Projects/AndroidSource/4.2
|
||||
|
||||
@@ -33,20 +33,27 @@ for s in ConfFile.readlines():
|
||||
continue
|
||||
|
||||
shutil.rmtree(os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"), ignore_errors=True)
|
||||
|
||||
LinkerLibs = os.path.join(AndroidTreeRoot, "bin_arm", "system")
|
||||
if (Arch == "x86"):
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_x86", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
LinkerLibs = os.path.join(AndroidTreeRoot, "bin_x86", "system")
|
||||
elif (Arch == "mips"):
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_mips", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
else:
|
||||
shutil.copytree(os.path.join(AndroidTreeRoot, "bin_arm", "system"), os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
LinkerLibs = os.path.join(AndroidTreeRoot, "bin_mips", "system")
|
||||
|
||||
if (not os.path.exists(LinkerLibs)):
|
||||
print("Error: Paltform libs for linker in path \"%s\" not found" % LinkerLibs)
|
||||
print("Building %s for %s\t[\033[91mFAILED\033[0m]" % (MakeTarget, Arch))
|
||||
continue
|
||||
|
||||
shutil.copytree(LinkerLibs, os.path.join(AndroidTreeRoot, "out", "target", "product", "generic", "system"))
|
||||
|
||||
os.chdir(BuildDir)
|
||||
BuildLog = os.path.join(BuildDir, "build.log")
|
||||
CmakeCmdLine = "cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_SOURCE_TREE=\"%s\" -DANDROID_NATIVE_API_LEVEL=\"%s\" -DANDROID_ABI=\"%s\" -DANDROID_STL=stlport_static ../../ > \"%s\" 2>&1" % (AndroidTreeRoot, NativeApiLevel, Arch, BuildLog)
|
||||
MakeCmdLine = "make %s >> \"%s\" 2>&1" % (MakeTarget, BuildLog);
|
||||
print(CmakeCmdLine)
|
||||
#print(CmakeCmdLine)
|
||||
os.system(CmakeCmdLine)
|
||||
print(MakeCmdLine)
|
||||
#print(MakeCmdLine)
|
||||
os.system(MakeCmdLine)
|
||||
os.chdir(HomeDir)
|
||||
CameraLib = os.path.join(BuildDir, "lib", Arch, "lib" + MakeTarget + ".so")
|
||||
|
||||
@@ -4,5 +4,5 @@ cd `dirname $0`/..
|
||||
mkdir -p build_service
|
||||
cd build_service
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_STL=stlport_static -DANDROID_STL_FORCE_FEATURES=OFF -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/ServiceStub/ $@ ../..
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME="arm-linux-androideabi-4.4.3" -DANDROID_STL=stlport_static -DANDROID_STL_FORCE_FEATURES=OFF -DBUILD_ANDROID_SERVICE=ON -DANDROID_SOURCE_TREE=~/Projects/AndroidSource/ServiceStub/ $@ ../..
|
||||
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
add_subdirectory(engine)
|
||||
#add_subdirectory(engine_test)
|
||||
if(BUILD_ANDROID_SERVICE)
|
||||
add_subdirectory(engine)
|
||||
#add_subdirectory(engine_test)
|
||||
endif()
|
||||
|
||||
install(FILES "readme.txt" DESTINATION "apk/" COMPONENT main)
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
***************
|
||||
Package Content
|
||||
***************
|
||||
|
||||
The package provides new OpenCV SDK that uses OpenCV Manager for library initialization. OpenCV Manager provides the following benefits:
|
||||
|
||||
* Less memory usage. All apps use the same binaries from service and do not keep native libs inside them self;
|
||||
* Hardware specific optimizations for all supported platforms;
|
||||
* Trusted OpenCV library source. All packages with OpenCV are published on Google Play service;
|
||||
* Regular updates and bug fixes;
|
||||
|
||||
Package consists from Library Project for Java development with Eclipse, C++ headers and libraries for native application development, javadoc samples and prebuilt binaries for ARM and X86 platforms.
|
||||
To try new SDK on serial device with Google Play just install sample package and follow application messages (Google Play service access will be needed).
|
||||
TO start example on device without Google Play you need to install OpenCV manager package and OpenCV binary pack for your platform from apk folder before.
|
||||
See docs/doc/tutorials/introduction/android_binary_package/android_binary_package.html and docs/android/refmain.html for details about service.
|
||||
On-line documentation will be available at address: http://docs.opencv.org/trunk
|
||||
|
||||
********
|
||||
Contacts
|
||||
********
|
||||
|
||||
Please send all feedback to Alexander Smorkalov mailto: alexander.smorkalov@itseez.com
|
||||
@@ -1,18 +1,20 @@
|
||||
*********************************************
|
||||
Base Loader Callback Interface implementation
|
||||
Base Loader Callback Interface Implementation
|
||||
*********************************************
|
||||
|
||||
.. highlight:: java
|
||||
.. class:: BaseLoaderCallback
|
||||
|
||||
Basic implementation of LoaderCallbackInterface. Logic of this implementation is well-described by the following scheme:
|
||||
Basic implementation of ``LoaderCallbackInterface``. Logic of this implementation is
|
||||
well-described by the following scheme:
|
||||
|
||||
.. image:: img/AndroidAppUsageModel.png
|
||||
|
||||
Using in Java Activity
|
||||
----------------------
|
||||
|
||||
There is a very base code snippet implementing the async initialization with BaseLoaderCallback. See the "15-puzzle" OpenCV sample for details.
|
||||
There is a very base code snippet implementing the async initialization with ``BaseLoaderCallback``.
|
||||
See the "15-puzzle" OpenCV sample for details.
|
||||
|
||||
.. code-block:: java
|
||||
:linenos:
|
||||
@@ -42,7 +44,7 @@ There is a very base code snippet implementing the async initialization with Bas
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
Log.i(TAG, "called onResume");
|
||||
Log.i(TAG, "Called onResume");
|
||||
super.onResume();
|
||||
|
||||
Log.i(TAG, "Trying to load OpenCV library");
|
||||
@@ -55,6 +57,7 @@ There is a very base code snippet implementing the async initialization with Bas
|
||||
Using in Service
|
||||
----------------
|
||||
|
||||
Default BaseLoaderCallback implementation treat application context as Activity and calls Activity.finish() method to exit in case of initialization failure.
|
||||
To override this behavior you need to override finish() method of BaseLoaderCallback class and implement your own finalization method.
|
||||
|
||||
Default ``BaseLoaderCallback`` implementation treats application context as ``Activity`` and calls
|
||||
``Activity.finish()`` method to exit in case of initialization failure.
|
||||
To override this behavior you need to override ``finish()`` method of ``BaseLoaderCallback`` class
|
||||
and implement your own finalization method.
|
||||
|
||||
@@ -28,7 +28,7 @@ void cancel()
|
||||
|
||||
.. method:: void cancel()
|
||||
|
||||
Installation if package has been canceled.
|
||||
Installation of package has been cancelled.
|
||||
|
||||
void wait_install()
|
||||
-------------------
|
||||
|
||||
@@ -7,34 +7,38 @@ Introduction
|
||||
|
||||
.. highlight:: java
|
||||
|
||||
OpenCV Manager is an Android service targeted to manage OpenCV library binaries on end users devices. It allows sharing the OpenCV dynamic libraries of different versions between applications on the same device. The Manager provides the following benefits\:
|
||||
OpenCV Manager is an Android service targeted to manage OpenCV library binaries on end users devices.
|
||||
It allows sharing the OpenCV dynamic libraries between applications on the same device. The Manager
|
||||
provides the following benefits\:
|
||||
|
||||
#. Less memory usage. All apps use the same binaries from service and do not keep native libs inside themselves;
|
||||
#. Hardware specific optimizations for all supported platforms;
|
||||
#. Trusted OpenCV library source. All packages with OpenCV are published on Google Play service;
|
||||
#. Trusted OpenCV library source. All packages with OpenCV are published on Google Play market;
|
||||
#. Regular updates and bug fixes;
|
||||
|
||||
Usage model for target user
|
||||
---------------------------
|
||||
Usage model for end user
|
||||
------------------------
|
||||
|
||||
.. image:: img/AndroidAppUsageModel.png
|
||||
|
||||
First OpenCV app\:
|
||||
|
||||
#. Any OpenCV-dependent app is installed from Google Play marketplace or manually;
|
||||
#. At the first launch, it suggests installing OpenCV Manager;
|
||||
#. Then OpenCV Manager is downloaded and installed, using Google Play marketplace service.
|
||||
#. When Manager has ben started, the application suggests installing OpenCV library for the target device trough Google Play marketplace if it is necessary;
|
||||
#. After installation is finished, the app may be launched to perform common tasks.
|
||||
#. At the first launch, it suggests installation of OpenCV Manager;
|
||||
#. Then OpenCV Manager is downloaded and installed, using the Google Play application.
|
||||
#. When Manager has been started, the application suggests installation of OpenCV library for the
|
||||
target device architecture if it is necessary;
|
||||
#. After the installation is finished, the app may be launched.
|
||||
|
||||
Next OpenCV app\:
|
||||
Subsequent launches of OpenCV apps\:
|
||||
|
||||
#. Any OpenCV-dependent app is installed from Google Play marketplace or manually;
|
||||
#. Any OpenCV-dependent app is installed from Google Play market or manually;
|
||||
#. At the first launch, the app starts as usually;
|
||||
#. If the selected version is not installed, OpenCV Manager suggests installing OpenCV library for the target device trough Google Play marketplace;
|
||||
#. After installation is finished, the app may be launched to perform common tasks.
|
||||
#. If the selected OpenCV version is not installed, OpenCV Manager suggests installing OpenCV
|
||||
library for the target device through Google Play marketplace;
|
||||
#. After the installation is finished, the app may be launched.
|
||||
|
||||
OpenCV Manager structure
|
||||
------------------------
|
||||
Architecture of OpenCV Manager
|
||||
------------------------------
|
||||
|
||||
.. image:: img/Structure.png
|
||||
@@ -12,23 +12,27 @@ boolean initDebug()
|
||||
|
||||
.. method:: static boolean initDebug()
|
||||
|
||||
Loads and initializes OpenCV library from within current application package. Roughly it is analog of ``system.loadLibrary("opencv_java")``.
|
||||
Loads and initializes OpenCV library from within current application package. Roughly it is
|
||||
analog of ``system.loadLibrary("opencv_java")``.
|
||||
|
||||
:rtype: boolean;
|
||||
:return: returns true if initialization of OpenCV was successful.
|
||||
|
||||
.. note:: This method is deprecated for production code. It is designed for experimantal and local development purposes only. If you want to publish your app use approach with async initialization.
|
||||
.. note:: This method is deprecated for production code. It is designed for experimental and local
|
||||
development purposes only. If you want to publish your app use approach with async
|
||||
initialization.
|
||||
|
||||
boolean initAsync()
|
||||
-------------------
|
||||
|
||||
.. method:: static boolean initAsync(String Version, Context AppContext, LoaderCallbackInterface Callback)
|
||||
|
||||
Loads and initializes OpenCV library using OpenCV Manager service.
|
||||
Loads and initializes OpenCV library using OpenCV Manager.
|
||||
|
||||
:param Version: OpenCV Library version.
|
||||
:param AppContext: application context for connecting to the service.
|
||||
:param Callback: object, that implements LoaderCallbackInterface for handling connection status (see BaseLoaderCallback).
|
||||
:param Callback: object, that implements ``LoaderCallbackInterface`` for handling connection
|
||||
status (see ``BaseLoaderCallback``).
|
||||
|
||||
:rtype: boolean;
|
||||
:return: returns true if initialization of OpenCV starts successfully.
|
||||
@@ -43,10 +47,3 @@ OpenCV version constants
|
||||
.. data:: OPENCV_VERSION_2_4_3
|
||||
|
||||
OpenCV Library version 2.4.3
|
||||
|
||||
Other constatnts
|
||||
----------------
|
||||
|
||||
.. data:: OPEN_CV_SERVICE_URL
|
||||
|
||||
Url for OpenCV Manager on Google Play (Android Market)
|
||||
@@ -12,9 +12,9 @@ void onManagerConnected()
|
||||
|
||||
.. method:: void onManagerConnected(int status)
|
||||
|
||||
Callback method that is called after OpenCV Library initialization.
|
||||
Callback method that is called after OpenCV library initialization.
|
||||
|
||||
:param status: status of initialization (see Initialization Status Constants).
|
||||
:param status: status of initialization (see "Initialization Status Constants" section below).
|
||||
|
||||
void onPackageInstall()
|
||||
-----------------------
|
||||
@@ -23,7 +23,7 @@ void onPackageInstall()
|
||||
|
||||
Callback method that is called in case when package installation is needed.
|
||||
|
||||
:param callback: answer object with approve and cancel methods and package description.
|
||||
:param callback: answer object with ``install`` and ``cancel`` methods and package description.
|
||||
|
||||
Initialization status constants
|
||||
-------------------------------
|
||||
@@ -34,15 +34,15 @@ Initialization status constants
|
||||
|
||||
.. data:: MARKET_ERROR
|
||||
|
||||
Google Play (Android Market) cannot be invoked
|
||||
Google Play (Android Market) application cannot be invoked
|
||||
|
||||
.. data:: INSTALL_CANCELED
|
||||
|
||||
OpenCV library installation was canceled by user
|
||||
OpenCV library installation was cancelled by user
|
||||
|
||||
.. data:: INCOMPATIBLE_MANAGER_VERSION
|
||||
|
||||
Version of OpenCV Manager Service is incompatible with this app. Service update is needed
|
||||
Version of OpenCV Manager is incompatible with this app. Manager update is needed.
|
||||
|
||||
.. data:: INIT_FAILED
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
*******************************************
|
||||
Manager Workflow
|
||||
*******************************************
|
||||
****************
|
||||
|
||||
.. _manager_selection:
|
||||
|
||||
.. include:: ../readme.txt
|
||||
|
||||
First application start
|
||||
-----------------------
|
||||
@@ -9,15 +12,15 @@ There is no OpenCV Manager or OpenCV libraries:
|
||||
|
||||
.. image:: img/NoService.png
|
||||
|
||||
Aditional library package installation
|
||||
--------------------------------------
|
||||
Additional library package installation
|
||||
---------------------------------------
|
||||
|
||||
There is an OpenCV Manager service, but there is no apropriate OpenCV library.
|
||||
There is an OpenCV Manager service, but it does not contain appropriate OpenCV library.
|
||||
If OpenCV library installation has been approved\:
|
||||
|
||||
.. image:: img/LibInstallAproved.png
|
||||
|
||||
If OpenCV library installation has been canceled\:
|
||||
If OpenCV library installation has been cancelled\:
|
||||
|
||||
.. image:: img/LibInstallCanceled.png
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.opencv.engine"
|
||||
android:versionCode="20"
|
||||
android:versionName="2.0" >
|
||||
android:versionCode="24@ANDROID_PLATFORM_VERSION_CODE@"
|
||||
android:versionName="2.4" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" />
|
||||
<uses-sdk android:minSdkVersion="@ANDROID_NATIVE_API_LEVEL@" />
|
||||
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
|
||||
|
||||
<application
|
||||
|
||||
@@ -2,7 +2,29 @@ set(engine OpenCVEngine)
|
||||
set(JNI_LIB_NAME ${engine} ${engine}_jni)
|
||||
|
||||
unset(__android_project_chain CACHE)
|
||||
add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 8 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON)
|
||||
add_android_project(opencv_engine "${CMAKE_CURRENT_SOURCE_DIR}" SDK_TARGET 9 ${ANDROID_SDK_TARGET} IGNORE_JAVA ON IGNORE_MANIFEST ON )
|
||||
|
||||
set(ANDROID_PLATFORM_VERSION_CODE "0")
|
||||
|
||||
if(ARMEABI_V7A)
|
||||
if (ANDROID_NATIVE_API_LEVEL LESS 9)
|
||||
set(ANDROID_PLATFORM_VERSION_CODE "2")
|
||||
else()
|
||||
set(ANDROID_PLATFORM_VERSION_CODE "3")
|
||||
endif()
|
||||
elseif(ARMEABI_V6)
|
||||
set(ANDROID_PLATFORM_VERSION_CODE "1")
|
||||
elseif(ARMEABI)
|
||||
set(ANDROID_PLATFORM_VERSION_CODE "1")
|
||||
elseif(X86)
|
||||
set(ANDROID_PLATFORM_VERSION_CODE "4")
|
||||
elseif(MIPS)
|
||||
set(ANDROID_PLATFORM_VERSION_CODE "5")
|
||||
else()
|
||||
message(WARNING "Can not automatically determine the value for ANDROID_PLATFORM_VERSION_CODE")
|
||||
endif()
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/${ANDROID_MANIFEST_FILE}" "${OpenCV_BINARY_DIR}/android/service/engine/.build/${ANDROID_MANIFEST_FILE}" @ONLY)
|
||||
|
||||
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib" "${ANDROID_SOURCE_TREE}/out/target/product/${ANDROID_PRODUCT}/system/lib" "${ANDROID_SOURCE_TREE}/bin/${ANDROID_ARCH_NAME}")
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="ManagerActivity" default="help">
|
||||
<project name="OpenCV Manager" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
|
||||
@@ -35,7 +35,7 @@ LOCAL_MODULE := libOpenCVEngine
|
||||
|
||||
LOCAL_LDLIBS += -lz -lbinder -llog -lutils
|
||||
|
||||
LOCAL_LDFLAGS += -Wl,-allow-shlib-undefine
|
||||
LOCAL_LDFLAGS += -Wl,-allow-shlib-undefined
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -52,7 +52,8 @@ LOCAL_SRC_FILES := \
|
||||
NativeService/CommonPackageManager.cpp \
|
||||
JNIWrapper/JavaBasedPackageManager.cpp \
|
||||
NativeService/PackageInfo.cpp \
|
||||
JNIWrapper/HardwareDetector_jni.cpp
|
||||
JNIWrapper/HardwareDetector_jni.cpp \
|
||||
JNIWrapper/OpenCVLibraryInfo.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/include \
|
||||
@@ -74,7 +75,6 @@ LOCAL_CFLAGS += -D__SUPPORT_MIPS
|
||||
LOCAL_MODULE := libOpenCVEngine_jni
|
||||
|
||||
LOCAL_LDLIBS += -lz -lbinder -llog -lutils -landroid_runtime
|
||||
|
||||
LOCAL_SHARED_LIBRARIES = libOpenCVEngine
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@@ -83,4 +83,4 @@ include $(BUILD_SHARED_LIBRARY)
|
||||
# Native test application
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
include $(LOCAL_PATH)/Tests/Tests.mk
|
||||
#include $(LOCAL_PATH)/Tests/Tests.mk
|
||||
@@ -2,4 +2,5 @@ APP_ABI := armeabi x86 mips
|
||||
APP_PLATFORM := android-8
|
||||
APP_STL := stlport_static
|
||||
APP_CPPFLAGS := -fno-rtti -fno-exceptions
|
||||
NDK_TOOLCHAIN_VERSION=4.4.3
|
||||
#APP_OPTIM := debug
|
||||
@@ -130,7 +130,7 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
|
||||
LOGD("Trying to load info library \"%s\"", tmp.c_str());
|
||||
|
||||
void* handle;
|
||||
const char* (*info_func)();
|
||||
InfoFunctionType info_func;
|
||||
|
||||
handle = dlopen(tmp.c_str(), RTLD_LAZY);
|
||||
if (handle)
|
||||
@@ -138,7 +138,7 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
|
||||
const char* error;
|
||||
|
||||
dlerror();
|
||||
*(void **) (&info_func) = dlsym(handle, "GetLibraryList");
|
||||
info_func = (InfoFunctionType)dlsym(handle, "GetLibraryList");
|
||||
if ((error = dlerror()) == NULL)
|
||||
{
|
||||
result = String16((*info_func)());
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "OpenCVLibraryInfo.h"
|
||||
#include "EngineCommon.h"
|
||||
#include <utils/Log.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_open
|
||||
(JNIEnv * env, jobject, jstring str)
|
||||
{
|
||||
const char* infoLibPath = env->GetStringUTFChars(str, NULL);
|
||||
if (infoLibPath == NULL)
|
||||
return 0;
|
||||
|
||||
LOGD("Trying to load info library \"%s\"", infoLibPath);
|
||||
|
||||
void* handle;
|
||||
|
||||
handle = dlopen(infoLibPath, RTLD_LAZY);
|
||||
if (handle == NULL)
|
||||
LOGI("Info library not found by path \"%s\"", infoLibPath);
|
||||
|
||||
return (jlong)handle;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
|
||||
(JNIEnv* env, jobject, jlong handle)
|
||||
{
|
||||
InfoFunctionType info_func;
|
||||
const char* result;
|
||||
const char* error;
|
||||
|
||||
dlerror();
|
||||
info_func = (InfoFunctionType)dlsym((void*)handle, "GetPackageName");
|
||||
if ((error = dlerror()) == NULL)
|
||||
result = (*info_func)();
|
||||
else
|
||||
{
|
||||
LOGE("dlsym error: \"%s\"", error);
|
||||
result = "unknown";
|
||||
}
|
||||
|
||||
return env->NewStringUTF(result);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
|
||||
(JNIEnv* env, jobject, jlong handle)
|
||||
{
|
||||
InfoFunctionType info_func;
|
||||
const char* result;
|
||||
const char* error;
|
||||
|
||||
dlerror();
|
||||
info_func = (InfoFunctionType)dlsym((void*)handle, "GetLibraryList");
|
||||
if ((error = dlerror()) == NULL)
|
||||
result = (*info_func)();
|
||||
else
|
||||
{
|
||||
LOGE("dlsym error: \"%s\"", error);
|
||||
result = "unknown";
|
||||
}
|
||||
|
||||
return env->NewStringUTF(result);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
|
||||
(JNIEnv* env, jobject, jlong handle)
|
||||
{
|
||||
InfoFunctionType info_func;
|
||||
const char* result;
|
||||
const char* error;
|
||||
|
||||
dlerror();
|
||||
info_func = (InfoFunctionType)dlsym((void*)handle, "GetRevision");
|
||||
if ((error = dlerror()) == NULL)
|
||||
result = (*info_func)();
|
||||
else
|
||||
{
|
||||
LOGE("dlsym error: \"%s\"", error);
|
||||
result = "unknown";
|
||||
}
|
||||
|
||||
return env->NewStringUTF(result);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_close
|
||||
(JNIEnv*, jobject, jlong handle)
|
||||
{
|
||||
dlclose((void*)handle);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#include <jni.h>
|
||||
|
||||
#ifndef _Included_org_opencv_engine_OpenCVLibraryInfo
|
||||
#define _Included_org_opencv_engine_OpenCVLibraryInfo
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_open
|
||||
(JNIEnv *, jobject, jstring);
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_close
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -78,49 +78,45 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
|
||||
|
||||
if (!packages.empty())
|
||||
{
|
||||
vector<PackageInfo>::iterator found = find(packages.begin(), packages.end(), target_package);
|
||||
if (packages.end() != found)
|
||||
int OptRating = -1;
|
||||
std::string OptVersion = "";
|
||||
std::vector<std::pair<int, int> >& group = CommonPackageManager::ArmRating;
|
||||
|
||||
if ((cpu_id & ARCH_X86) || (cpu_id & ARCH_X64))
|
||||
group = CommonPackageManager::IntelRating;
|
||||
|
||||
int HardwareRating = GetHardwareRating(platform, cpu_id, group);
|
||||
LOGD("Current hardware platform rating %d for (%d,%d)", HardwareRating, platform, cpu_id);
|
||||
|
||||
if (-1 == HardwareRating)
|
||||
{
|
||||
result = found->GetInstalationPath();
|
||||
LOGE("Cannot calculate rating for current hardware platform!");
|
||||
}
|
||||
else
|
||||
{
|
||||
int OptRating = -1;
|
||||
std::vector<std::pair<int, int> >& group = CommonPackageManager::ArmRating;
|
||||
|
||||
if ((cpu_id & ARCH_X86) || (cpu_id & ARCH_X64))
|
||||
group = CommonPackageManager::IntelRating;
|
||||
|
||||
int HardwareRating = GetHardwareRating(platform, cpu_id, group);
|
||||
LOGD("Current hardware platform %d, %d", platform, cpu_id);
|
||||
|
||||
if (-1 == HardwareRating)
|
||||
vector<PackageInfo>::iterator found = packages.end();
|
||||
for (vector<PackageInfo>::iterator it = packages.begin(); it != packages.end(); ++it)
|
||||
{
|
||||
LOGE("Cannot calculate rating for current hardware platform!");
|
||||
int PackageRating = GetHardwareRating(it->GetPlatform(), it->GetCpuID(), group);
|
||||
LOGD("Package \"%s\" rating %d for (%d,%d)", it->GetFullName().c_str(), PackageRating, it->GetPlatform(), it->GetCpuID());
|
||||
if ((PackageRating >= 0) && (PackageRating <= HardwareRating))
|
||||
{
|
||||
if (((it->GetVersion() >= OptVersion) && (PackageRating >= OptRating)) || (it->GetVersion() > OptVersion))
|
||||
{
|
||||
OptRating = PackageRating;
|
||||
OptVersion = it->GetVersion();
|
||||
found = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((-1 != OptRating) && (packages.end() != found))
|
||||
{
|
||||
result = found->GetInstalationPath();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (vector<PackageInfo>::iterator it = packages.begin(); it != packages.end(); ++it)
|
||||
{
|
||||
int PackageRating = GetHardwareRating(it->GetPlatform(), it->GetCpuID(), group);
|
||||
if (PackageRating >= 0)
|
||||
{
|
||||
if ((PackageRating <= HardwareRating) && (PackageRating > OptRating))
|
||||
{
|
||||
OptRating = PackageRating;
|
||||
found = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((-1 != OptRating) && (packages.end() != found))
|
||||
{
|
||||
result = found->GetInstalationPath();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGI("Found package is incompatible with current hardware platform");
|
||||
}
|
||||
LOGI("Found package is incompatible with current hardware platform");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,7 +134,7 @@ bool CommonPackageManager::IsVersionCompatible(const std::string& target_version
|
||||
// major version is the same and minor package version is above or the same as target.
|
||||
if ((package_version[0] == target_version[0]) && (package_version[1] == target_version[1]) && (package_version[2] >= target_version[2]))
|
||||
{
|
||||
result = true;
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -148,13 +144,21 @@ int CommonPackageManager::GetHardwareRating(int platform, int cpu_id, const std:
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
for (size_t i = 0; i < group.size(); i++)
|
||||
if ((cpu_id & ARCH_X86) || (cpu_id & ARCH_X64) || (cpu_id & ARCH_MIPS))
|
||||
// Note: No raiting for x86, x64 and MIPS
|
||||
// only one package is used
|
||||
result = 0;
|
||||
else
|
||||
{
|
||||
if (group[i] == std::pair<int, int>(platform, cpu_id))
|
||||
{
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
// Calculate rating for Arm
|
||||
for (size_t i = 0; i < group.size(); i++)
|
||||
{
|
||||
if (group[i] == std::pair<int, int>(platform, cpu_id))
|
||||
{
|
||||
result = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -171,14 +175,14 @@ std::vector<std::pair<int, int> > CommonPackageManager::InitArmRating()
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv6 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3d16));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA2, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_VFPv3));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_UNKNOWN, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_VFPv3d16 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA2, ARCH_ARMv7 | FEATURES_HAS_VFPv3d16));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||
result.push_back(std::pair<int, int>(PLATFORM_TEGRA3, ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ InstallPath("")
|
||||
#ifndef __SUPPORT_TEGRA3
|
||||
Platform = PLATFORM_UNKNOWN;
|
||||
#endif
|
||||
|
||||
FullName = BasePackageName + "_v" + Version.substr(0, Version.size()-1);
|
||||
if (PLATFORM_UNKNOWN != Platform)
|
||||
{
|
||||
@@ -341,8 +342,8 @@ InstallPath(install_path)
|
||||
LOGD("Trying to load info library \"%s\"", tmp.c_str());
|
||||
|
||||
void* handle;
|
||||
const char* (*name_func)();
|
||||
const char* (*revision_func)();
|
||||
InfoFunctionType name_func;
|
||||
InfoFunctionType revision_func;
|
||||
|
||||
handle = dlopen(tmp.c_str(), RTLD_LAZY);
|
||||
if (handle)
|
||||
@@ -350,8 +351,8 @@ InstallPath(install_path)
|
||||
const char* error;
|
||||
|
||||
dlerror();
|
||||
*(void **) (&name_func) = dlsym(handle, "GetPackageName");
|
||||
*(void **) (&revision_func) = dlsym(handle, "GetRevision");
|
||||
name_func = (InfoFunctionType)dlsym(handle, "GetPackageName");
|
||||
revision_func = (InfoFunctionType)dlsym(handle, "GetRevision");
|
||||
error = dlerror();
|
||||
|
||||
if (!error && revision_func && name_func)
|
||||
@@ -392,7 +393,17 @@ InstallPath(install_path)
|
||||
Platform = SplitPlatfrom(features);
|
||||
if (PLATFORM_UNKNOWN != Platform)
|
||||
{
|
||||
CpuID = 0;
|
||||
switch (Platform)
|
||||
{
|
||||
case PLATFORM_TEGRA2:
|
||||
{
|
||||
CpuID = ARCH_ARMv7 | FEATURES_HAS_VFPv3d16;
|
||||
} break;
|
||||
case PLATFORM_TEGRA3:
|
||||
{
|
||||
CpuID = ARCH_ARMv7 | FEATURES_HAS_VFPv3 | FEATURES_HAS_NEON;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ LOCAL_CFLAGS += -D__SUPPORT_TEGRA3
|
||||
LOCAL_CFLAGS += -D__SUPPORT_MIPS
|
||||
#LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES
|
||||
|
||||
LOCAL_LDFLAGS = -Wl,-allow-shlib-undefined
|
||||
#LOCAL_LDFLAGS = -Wl,-allow-shlib-undefined
|
||||
|
||||
LOCAL_MODULE := OpenCVEngineTestApp
|
||||
|
||||
|
||||
@@ -5,10 +5,18 @@
|
||||
#undef LOG_TAG
|
||||
#define LOG_TAG "OpenCVEngine"
|
||||
|
||||
// OpenCV Engine API version
|
||||
#ifndef OPEN_CV_ENGINE_VERSION
|
||||
#define OPEN_CV_ENGINE_VERSION 2
|
||||
#endif
|
||||
|
||||
#define LIB_OPENCV_INFO_NAME "libopencv_info.so"
|
||||
|
||||
// OpenCV Manager package name
|
||||
#define OPENCV_ENGINE_PACKAGE "org.opencv.engine"
|
||||
// Class name of OpenCV engine binder object. Is needned for connection to service
|
||||
#define OPECV_ENGINE_CLASSNAME "org.opencv.engine.OpenCVEngineInterface"
|
||||
|
||||
typedef const char* (*InfoFunctionType)();
|
||||
|
||||
#endif
|
||||
@@ -4,11 +4,7 @@
|
||||
#include <binder/IInterface.h>
|
||||
#include <binder/Parcel.h>
|
||||
#include <utils/String16.h>
|
||||
|
||||
// OpenCV Manager package name
|
||||
#define OPENCV_ENGINE_PACKAGE "org.opencv.engine"
|
||||
// Class name of OpenCV engine binder object. Is needned for connection to service
|
||||
#define OPECV_ENGINE_CLASSNAME "org.opencv.engine.OpenCVEngineInterface"
|
||||
#include "EngineCommon.h"
|
||||
|
||||
enum EngineMethonID
|
||||
{
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-8
|
||||
target=android-9
|
||||
|
||||
@@ -20,8 +20,6 @@ public class MarketConnector
|
||||
private static final String TAG = "OpenCVEngine/MarketConnector";
|
||||
protected Context mContext;
|
||||
|
||||
public boolean mIncludeManager = true;
|
||||
|
||||
public MarketConnector(Context context)
|
||||
{
|
||||
mContext = context;
|
||||
@@ -100,15 +98,13 @@ public class MarketConnector
|
||||
{
|
||||
List<PackageInfo> AllPackages = mContext.getPackageManager().getInstalledPackages(PackageManager.GET_CONFIGURATIONS);
|
||||
List<PackageInfo> OpenCVPackages = new ArrayList<PackageInfo>();
|
||||
if (mIncludeManager)
|
||||
{
|
||||
try {
|
||||
OpenCVPackages.add(mContext.getPackageManager().getPackageInfo("org.opencv.engine", PackageManager.GET_CONFIGURATIONS));
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(TAG, "OpenCV Manager package info was not found!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
OpenCVPackages.add(mContext.getPackageManager().getPackageInfo("org.opencv.engine", PackageManager.GET_CONFIGURATIONS));
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(TAG, "OpenCV Manager package info was not found!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Iterator<PackageInfo> it = AllPackages.iterator();
|
||||
while(it.hasNext())
|
||||
{
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.opencv.engine;
|
||||
|
||||
public class OpenCVLibraryInfo {
|
||||
public OpenCVLibraryInfo(String packagePath) {
|
||||
mNativeObj = open(packagePath + "/libopencv_info.so");
|
||||
if (mNativeObj != 0) {
|
||||
mPackageName = getPackageName(mNativeObj);
|
||||
mLibraryList = getLibraryList(mNativeObj);
|
||||
mVersionName = getVersionName(mNativeObj);
|
||||
close(mNativeObj);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean status() {
|
||||
return (mNativeObj != 0);
|
||||
}
|
||||
|
||||
public String packageName() {
|
||||
return mPackageName;
|
||||
}
|
||||
|
||||
public String libraryList() {
|
||||
return mLibraryList;
|
||||
}
|
||||
|
||||
public String versionName() {
|
||||
return mVersionName;
|
||||
}
|
||||
|
||||
private long mNativeObj;
|
||||
private String mPackageName;
|
||||
private String mLibraryList;
|
||||
private String mVersionName;
|
||||
|
||||
private native long open(String packagePath);
|
||||
private native String getPackageName(long obj);
|
||||
private native String getLibraryList(long obj);
|
||||
private native String getVersionName(long obj);
|
||||
private native void close(long obj);
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import java.util.StringTokenizer;
|
||||
import org.opencv.engine.HardwareDetector;
|
||||
import org.opencv.engine.MarketConnector;
|
||||
import org.opencv.engine.OpenCVEngineInterface;
|
||||
import org.opencv.engine.OpenCVLibraryInfo;
|
||||
import org.opencv.engine.R;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -77,7 +79,7 @@ public class ManagerActivity extends Activity
|
||||
{
|
||||
HardwarePlatformView.setText("Tegra");
|
||||
}
|
||||
else if (HardwareDetector.PLATFORM_TEGRA == Platfrom)
|
||||
else if (HardwareDetector.PLATFORM_TEGRA2 == Platfrom)
|
||||
{
|
||||
HardwarePlatformView.setText("Tegra 2");
|
||||
}
|
||||
@@ -170,9 +172,13 @@ public class ManagerActivity extends Activity
|
||||
|
||||
mInstalledPackageView.setOnItemClickListener(new OnItemClickListener() {
|
||||
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long id) {
|
||||
mInstalledPackageView.setTag(Integer.valueOf((int)id));
|
||||
mActionDialog.show();
|
||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||
//if (!mListViewItems.get((int) id).get("Name").equals("Built-in OpenCV library"));
|
||||
if (!mInstalledPackageInfo[(int) id].packageName.equals("org.opencv.engine"))
|
||||
{
|
||||
mInstalledPackageView.setTag(Integer.valueOf((int)id));
|
||||
mActionDialog.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -232,8 +238,6 @@ public class ManagerActivity extends Activity
|
||||
protected class OpenCVEngineServiceConnection implements ServiceConnection
|
||||
{
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
@@ -266,23 +270,58 @@ public class ManagerActivity extends Activity
|
||||
}
|
||||
};
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
|
||||
synchronized protected void FillPackageList()
|
||||
{
|
||||
synchronized (mListViewItems) {
|
||||
mMarket.mIncludeManager = false;
|
||||
mInstalledPackageInfo = mMarket.GetInstalledOpenCVPackages();
|
||||
mListViewItems.clear();
|
||||
|
||||
for (int i = 0; i < mInstalledPackageInfo.length; i++)
|
||||
int RealPackageCount = mInstalledPackageInfo.length;
|
||||
for (int i = 0; i < RealPackageCount; i++)
|
||||
{
|
||||
if (mInstalledPackageInfo[i] == null)
|
||||
break;
|
||||
|
||||
// Convert to Items for package list view
|
||||
HashMap<String,String> temp = new HashMap<String,String>();
|
||||
|
||||
String HardwareName = "";
|
||||
String NativeLibDir = "";
|
||||
String OpenCVersion = "";
|
||||
|
||||
String PublicName = mMarket.GetApplicationName(mInstalledPackageInfo[i].applicationInfo);
|
||||
String PackageName = mInstalledPackageInfo[i].packageName;
|
||||
String VersionName = mInstalledPackageInfo[i].versionName;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
|
||||
NativeLibDir = mInstalledPackageInfo[i].applicationInfo.nativeLibraryDir;
|
||||
else
|
||||
NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib";
|
||||
|
||||
OpenCVLibraryInfo NativeInfo = new OpenCVLibraryInfo(NativeLibDir);
|
||||
|
||||
if (PackageName.equals("org.opencv.engine"))
|
||||
{
|
||||
if (NativeInfo.status())
|
||||
{
|
||||
PublicName = "Built-in OpenCV library";
|
||||
PackageName = NativeInfo.packageName();
|
||||
VersionName = NativeInfo.versionName();
|
||||
}
|
||||
else
|
||||
{
|
||||
mInstalledPackageInfo[i] = mInstalledPackageInfo[RealPackageCount-1];
|
||||
mInstalledPackageInfo[RealPackageCount-1] = null;
|
||||
RealPackageCount--;
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int idx = 0;
|
||||
String OpenCVersion = "unknown";
|
||||
String HardwareName = "";
|
||||
StringTokenizer tokenizer = new StringTokenizer(mInstalledPackageInfo[i].packageName, "_");
|
||||
Log.d(TAG, PackageName);
|
||||
StringTokenizer tokenizer = new StringTokenizer(PackageName, "_");
|
||||
while (tokenizer.hasMoreTokens())
|
||||
{
|
||||
if (idx == 1)
|
||||
@@ -303,6 +342,7 @@ public class ManagerActivity extends Activity
|
||||
}
|
||||
|
||||
String ActivePackagePath;
|
||||
String Tags = null;
|
||||
ActivePackagePath = mActivePackageMap.get(OpenCVersion);
|
||||
Log.d(TAG, OpenCVersion + " -> " + ActivePackagePath);
|
||||
|
||||
@@ -313,11 +353,13 @@ public class ManagerActivity extends Activity
|
||||
if (start >= 0 && ActivePackagePath.charAt(stop) == '/')
|
||||
{
|
||||
temp.put("Activity", "y");
|
||||
PublicName += " (in use)";
|
||||
Tags = "active";
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.put("Activity", "n");
|
||||
if (!PublicName.equals("Built-in OpenCV library"))
|
||||
Tags = "safe to remove";
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -325,9 +367,32 @@ public class ManagerActivity extends Activity
|
||||
temp.put("Activity", "n");
|
||||
}
|
||||
|
||||
temp.put("Version", NormalizeVersion(OpenCVersion, VersionName));
|
||||
// HACK: OpenCV Manager for Armv7-a Neon already has Tegra3 optimizations
|
||||
// that is enabled on proper hardware
|
||||
if (HardwareDetector.DetectKnownPlatforms() == HardwareDetector.PLATFORM_TEGRA3 &&
|
||||
HardwareName.equals("armv7a neon ") && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
|
||||
{
|
||||
temp.put("Hardware", "Tegra 3");
|
||||
if (Tags == null)
|
||||
{
|
||||
Tags = "optimized";
|
||||
}
|
||||
else
|
||||
{
|
||||
Tags = Tags + ", optimized";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
temp.put("Hardware", HardwareName);
|
||||
}
|
||||
|
||||
if (Tags != null)
|
||||
PublicName = PublicName + " (" + Tags + ")";
|
||||
|
||||
temp.put("Name", PublicName);
|
||||
temp.put("Version", NormalizeVersion(OpenCVersion, mInstalledPackageInfo[i].versionName));
|
||||
temp.put("Hardware", HardwareName);
|
||||
|
||||
mListViewItems.add(temp);
|
||||
}
|
||||
|
||||
@@ -337,10 +402,16 @@ public class ManagerActivity extends Activity
|
||||
|
||||
protected String NormalizeVersion(String OpenCVersion, String PackageVersion)
|
||||
{
|
||||
if (OpenCVersion == null || PackageVersion == null)
|
||||
return "unknown";
|
||||
|
||||
int dot = PackageVersion.indexOf(".");
|
||||
return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
|
||||
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
|
||||
PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1);
|
||||
if (dot == -1 || OpenCVersion.length() == 0)
|
||||
return "unknown";
|
||||
else
|
||||
return OpenCVersion.substring(0, OpenCVersion.length()-1) + "." +
|
||||
OpenCVersion.toCharArray()[OpenCVersion.length()-1] + "." +
|
||||
PackageVersion.substring(0, dot) + " rev " + PackageVersion.substring(dot+1);
|
||||
}
|
||||
|
||||
protected String ConvertPackageName(String Name, String Version)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
How to select the proper version of OpenCV Manager
|
||||
--------------------------------------------------
|
||||
|
||||
Since version 1.7 several packages of OpenCV Manager are built. Every package is targeted for some
|
||||
specific hardware platform and includes corresponding OpenCV binaries. So, in most cases OpenCV
|
||||
Manager uses built-in version of OpenCV. Separate package with OpenCV binaries is currently used in
|
||||
a single rare case, when an ARMv7-A processor without NEON support is detected. In this case an
|
||||
additional binary package is used. The new package selection logic in most cases simplifies OpenCV
|
||||
installation on end user devices. In most cases OpenCV Manager may be installed automatically from
|
||||
Google Play.
|
||||
|
||||
If Google Play is not available (i.e. on emulator, developer board, etc), you can install it
|
||||
manually using adb tool:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
adb install OpenCV-2.4.3-android-sdk/apk/OpenCV_2.4.3.2_Manager_2.4_<platform>.apk
|
||||
|
||||
Use the table below to determine proper OpenCV Manager package for your device:
|
||||
|
||||
+------------------------------+--------------+-----------------------------------------------------+
|
||||
| Hardware Platform | Android ver. | Package name |
|
||||
+==============================+==============+=====================================================+
|
||||
| armeabi-v7a (ARMv7-A + NEON) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armv7a-neon.apk |
|
||||
+------------------------------+--------------+-----------------------------------------------------+
|
||||
| armeabi-v7a (ARMv7-A + NEON) | = 2.2 | OpenCV_2.4.3.2_Manager_2.4_armv7a-neon-android8.apk |
|
||||
+------------------------------+--------------+-----------------------------------------------------+
|
||||
| armeabi (ARMv5, ARMv6) | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_armeabi.apk |
|
||||
+------------------------------+--------------+-----------------------------------------------------+
|
||||
| Intel x86 | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_x86.apk |
|
||||
+------------------------------+--------------+-----------------------------------------------------+
|
||||
| MIPS | >= 2.3 | OpenCV_2.4.3.2_Manager_2.4_mips.apk |
|
||||
+------------------------------+--------------+-----------------------------------------------------+
|
||||
@@ -179,7 +179,7 @@ unset(__android_project_chain CACHE)
|
||||
#add_android_project(target_name ${path} NATIVE_DEPS opencv_core LIBRARY_DEPS ${OpenCV_BINARY_DIR} SDK_TARGET 11)
|
||||
macro(add_android_project target path)
|
||||
# parse arguments
|
||||
set(android_proj_arglist NATIVE_DEPS LIBRARY_DEPS SDK_TARGET IGNORE_JAVA)
|
||||
set(android_proj_arglist NATIVE_DEPS LIBRARY_DEPS SDK_TARGET IGNORE_JAVA IGNORE_MANIFEST)
|
||||
set(__varname "android_proj_")
|
||||
foreach(v ${android_proj_arglist})
|
||||
set(${__varname}${v} "")
|
||||
@@ -220,9 +220,13 @@ macro(add_android_project target path)
|
||||
# get project sources
|
||||
file(GLOB_RECURSE android_proj_files RELATIVE "${path}" "${path}/res/*" "${path}/src/*")
|
||||
|
||||
if(NOT android_proj_IGNORE_MANIFEST)
|
||||
list(APPEND android_proj_files ${ANDROID_MANIFEST_FILE})
|
||||
endif()
|
||||
|
||||
# copy sources out from the build tree
|
||||
set(android_proj_file_deps "")
|
||||
foreach(f ${android_proj_files} ${ANDROID_MANIFEST_FILE})
|
||||
foreach(f ${android_proj_files})
|
||||
add_custom_command(
|
||||
OUTPUT "${android_proj_bin_dir}/${f}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${path}/${f}" "${android_proj_bin_dir}/${f}"
|
||||
@@ -324,6 +328,7 @@ macro(add_android_project target path)
|
||||
install(FILES "${OpenCV_BINARY_DIR}/bin/${target}.apk" DESTINATION "samples" COMPONENT main)
|
||||
get_filename_component(sample_dir "${path}" NAME)
|
||||
#java part
|
||||
list(REMOVE_ITEM android_proj_files ${ANDROID_MANIFEST_FILE})
|
||||
foreach(f ${android_proj_files} ${ANDROID_MANIFEST_FILE})
|
||||
get_filename_component(install_subdir "${f}" PATH)
|
||||
install(FILES "${android_proj_bin_dir}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT main)
|
||||
|
||||
@@ -3,8 +3,13 @@ if(${CMAKE_VERSION} VERSION_LESS "2.8.3")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (NOT MSVC AND NOT CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
message(STATUS "CUDA compilation was disabled (due to unsuppoted host compiler).")
|
||||
if (WIN32 AND NOT MSVC)
|
||||
message(STATUS "CUDA compilation is disabled (due to only Visual Studio compiler suppoted on your platform).")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
message(STATUS "CUDA compilation is disabled (due to Clang unsuppoted on your platform).")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ endif()
|
||||
# Detect GNU version:
|
||||
# ----------------------------------------------------------------------------
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE CMAKE_OPENCV_GCC_VERSION_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ else()
|
||||
else()
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_AMDSTREAMSDKROOT}/lib/x86_64)
|
||||
endif()
|
||||
elseif(ENV_CUDAPATH AND WIN32)
|
||||
elseif(ENV_CUDA_PATH AND WIN32)
|
||||
set(OPENCL_INCLUDE_SEARCH_PATH ${ENV_CUDA_PATH}/include)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(OPENCL_LIB_SEARCH_PATH ${OPENCL_LIB_SEARCH_PATH} ${ENV_CUDA_PATH}/lib/Win32)
|
||||
|
||||
@@ -71,6 +71,12 @@ if(ANDROID)
|
||||
endforeach()
|
||||
string(REPLACE "opencv_" "" OPENCV_MODULES_CONFIGMAKE "${OPENCV_MODULES_CONFIGMAKE}")
|
||||
|
||||
# prepare 3rd-party component list without TBB for armeabi and mips platforms. TBB is useless there.
|
||||
set(OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE})
|
||||
foreach(mod ${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB})
|
||||
string(REPLACE "tbb" "" OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB "${OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB}")
|
||||
endforeach()
|
||||
|
||||
if(BUILD_FAT_JAVA_LIB)
|
||||
set(OPENCV_LIBS_CONFIGMAKE java)
|
||||
else()
|
||||
|
||||
@@ -19,7 +19,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE gcc_compiler_version)
|
||||
#MESSAGE("GCC Version: ${gcc_compiler_version}")
|
||||
IF(gcc_compiler_version MATCHES "4\\.[0,2-9]\\.[0-9x]")
|
||||
IF(gcc_compiler_version VERSION_GREATER "4.2.-1")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF()
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ string(REGEX REPLACE ".+CV_MAJOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MAJ
|
||||
string(REGEX REPLACE ".+CV_MINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_MINOR "${OPENCV_VERSION_PARTS}")
|
||||
string(REGEX REPLACE ".+CV_SUBMINOR_VERSION[ ]+([0-9]+).*" "\\1" OPENCV_VERSION_PATCH "${OPENCV_VERSION_PARTS}")
|
||||
|
||||
set(OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}")
|
||||
set(OPENCV_VERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}.${OPENCV_VERSION_PATCH}.2")
|
||||
set(OPENCV_SOVERSION "${OPENCV_VERSION_MAJOR}.${OPENCV_VERSION_MINOR}")
|
||||
|
||||
# create a dependency on version file
|
||||
|
||||
@@ -29,8 +29,22 @@ ifeq ($(OPENCV_LIB_TYPE),SHARED)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=
|
||||
OPENCV_EXTRA_COMPONENTS:=
|
||||
else
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
ifeq ($(TARGET_ARCH_ABI),mips)
|
||||
OPENCV_3RDPARTY_COMPONENTS:=@OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE_NO_TBB@
|
||||
OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (${OPENCV_CAMERA_MODULES},on)
|
||||
|
||||
+20
-5
@@ -2,8 +2,6 @@
|
||||
# CMake file for OpenCV docs
|
||||
#
|
||||
|
||||
file(GLOB FILES_DOC *.htm *.txt *.jpg *.png *.pdf)
|
||||
file(GLOB FILES_DOC_VS vidsurv/*.doc)
|
||||
file(GLOB FILES_TEX *.tex *.sty *.bib)
|
||||
file(GLOB FILES_TEX_PICS pics/*.png pics/*.jpg)
|
||||
|
||||
@@ -11,6 +9,14 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
|
||||
project(opencv_docs)
|
||||
|
||||
set(DOC_LIST "${OpenCV_SOURCE_DIR}/doc/opencv-logo.png" "${OpenCV_SOURCE_DIR}/doc/opencv-logo2.png"
|
||||
"${OpenCV_SOURCE_DIR}/doc/opencv-logo-white.png" "${OpenCV_SOURCE_DIR}/doc/opencv.ico"
|
||||
"${OpenCV_SOURCE_DIR}/doc/haartraining.htm" "${OpenCV_SOURCE_DIR}/doc/license.txt"
|
||||
"${OpenCV_SOURCE_DIR}/doc/pattern.png" "${OpenCV_SOURCE_DIR}/doc/acircles_pattern.png")
|
||||
|
||||
set(OPTIONAL_DOC_LIST "")
|
||||
|
||||
|
||||
set(OPENCV2_BASE_MODULES core imgproc highgui video calib3d features2d objdetect ml flann gpu photo stitching nonfree contrib legacy)
|
||||
|
||||
# build lists of modules to be documented
|
||||
@@ -81,6 +87,9 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
COMMENT "Generating the PDF Manuals"
|
||||
)
|
||||
|
||||
LIST(APPEND OPTIONAL_DOC_LIST "${CMAKE_BINARY_DIR}/doc/opencv2refman.pdf" "${CMAKE_BINARY_DIR}/doc/opencv2manager.pdf"
|
||||
"${CMAKE_BINARY_DIR}/doc/opencv_user.pdf" "${CMAKE_BINARY_DIR}/doc/opencv_tutorials.pdf" "${CMAKE_BINARY_DIR}/doc/opencv_cheatsheet.pdf")
|
||||
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(docs PROPERTIES FOLDER "documentation")
|
||||
endif()
|
||||
@@ -97,7 +106,13 @@ if(BUILD_DOCS AND HAVE_SPHINX)
|
||||
if(ENABLE_SOLUTION_FOLDERS)
|
||||
set_target_properties(html_docs PROPERTIES FOLDER "documentation")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(FILES ${FILES_DOC} DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
|
||||
install(FILES ${FILES_DOC_VS} DESTINATION "${OPENCV_DOC_INSTALL_PATH}/vidsurv" COMPONENT main)
|
||||
foreach(f ${DOC_LIST})
|
||||
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT main)
|
||||
endforeach()
|
||||
|
||||
foreach(f ${OPTIONAL_DOC_LIST})
|
||||
install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" OPTIONAL)
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
+8
@@ -394,4 +394,12 @@ div.body ul.search li {
|
||||
div.linenodiv {
|
||||
min-width: 1em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.sphinxsidebar #searchbox input[type="text"] {
|
||||
width:auto;
|
||||
}
|
||||
|
||||
div.sphinxsidebar #searchbox input[type="submit"] {
|
||||
width:auto;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import sys, glob
|
||||
|
||||
sys.path.append("../modules/python/src2/")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import os, sys, fnmatch, re
|
||||
|
||||
sys.path.append("../modules/python/src2/")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# opencvstd documentation build configuration file, created by
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
ocv domain, a modified copy of sphinx.domains.cpp + shpinx.domains.python.
|
||||
|
||||
Binary file not shown.
-84565
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
f=open(sys.argv[1], "rt")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
"""gen_pattern.py
|
||||
To run:
|
||||
-c 10 -r 12 -o out.svg
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
# svgfig.py copyright (C) 2008 Jim Pivarski <jpivarski@gmail.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import os, sys, re
|
||||
|
||||
finput=open(sys.argv[1], "rt")
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ This tutorial code's is shown lines below. You can also download it from `here <
|
||||
for( int i = 0; i < contours.size(); i++ )
|
||||
{ approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true );
|
||||
boundRect[i] = boundingRect( Mat(contours_poly[i]) );
|
||||
minEnclosingCircle( contours_poly[i], center[i], radius[i] );
|
||||
minEnclosingCircle( (Mat)contours_poly[i], center[i], radius[i] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ The structure of package contents looks as follows:
|
||||
|
||||
OpenCV-2.4.3-android-sdk
|
||||
|_ apk
|
||||
| |_ OpenCV_2.4.3_binary_pack_XXX.apk
|
||||
| |_ OpenCV_2.4.3_Manager.apk
|
||||
| |_ OpenCV_2.4.3_binary_pack_armv7a.apk
|
||||
| |_ OpenCV_2.4.3_Manager_2.0_XXX.apk
|
||||
|
|
||||
|_ doc
|
||||
|_ samples
|
||||
@@ -85,8 +85,8 @@ The structure of package contents looks as follows:
|
||||
On production devices that have access to Google Play Market (and Internet) these packages will be
|
||||
installed from Market on the first start of an application using OpenCV Manager API.
|
||||
But devkits without Market or Internet connection require this packages to be installed manually.
|
||||
Install the `Manager.apk` and the corresponding `binary_pack.apk` depending on the device CPU,
|
||||
the Manager GUI provides this info. Below you'll see exact commands on how to do this.
|
||||
Install the `Manager.apk` and optional `binary_pack.apk` if it needed.
|
||||
See :ref:`manager_selection` for details.
|
||||
|
||||
.. note:: Installation from Internet is the preferable way since OpenCV team may publish updated
|
||||
versions of this packages on the Market.
|
||||
@@ -159,8 +159,8 @@ Get the OpenCV4Android SDK
|
||||
|
||||
unzip ~/Downloads/OpenCV-2.4.3-android-sdk.zip
|
||||
|
||||
.. |opencv_android_bin_pack| replace:: OpenCV-2.4.3-android-sdk.zip
|
||||
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.3/OpenCV-2.4.3-android-sdk.zip/download
|
||||
.. |opencv_android_bin_pack| replace:: OpenCV-2.4.3.2-android-sdk.zip
|
||||
.. _opencv_android_bin_pack_url: http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.3/OpenCV-2.4.3.2-android-sdk.zip/download
|
||||
.. |opencv_android_bin_pack_url| replace:: |opencv_android_bin_pack|
|
||||
.. |seven_zip| replace:: 7-Zip
|
||||
.. _seven_zip: http://www.7-zip.org/
|
||||
@@ -186,6 +186,8 @@ Import OpenCV library and samples to the Eclipse
|
||||
Each sample included into the |opencv_android_bin_pack| is a regular Android project that already
|
||||
references OpenCV library.Follow the steps below to import OpenCV and samples into the workspace:
|
||||
|
||||
.. note:: OpenCV samples are indeed **dependent** on OpenCV library project so don't forget to import it to your workspace as well.
|
||||
|
||||
* Right click on the :guilabel:`Package Explorer` window and choose :guilabel:`Import...` option
|
||||
from the context menu:
|
||||
|
||||
@@ -213,13 +215,21 @@ Import OpenCV library and samples to the Eclipse
|
||||
and you have to wait some time while it is building OpenCV samples. Just give a minute to
|
||||
Eclipse to complete initialization.
|
||||
|
||||
.. note :: After the initial import, on a non-Windows (Linux and Mac OS) operating system Eclipse
|
||||
.. warning :: After the initial import, on a non-Windows (Linux and Mac OS) operating system Eclipse
|
||||
will still show build errors for applications with native C++ code. To resolve the
|
||||
issues, please do the following:
|
||||
|
||||
Open :guilabel:`Project Properties -> C/C++ Build`, and replace "Build command" text
|
||||
to ``"${NDKROOT}/ndk-build"`` (remove .cmd at the end).
|
||||
|
||||
.. note :: In some cases the build errors don't disappear, then try the following actions:
|
||||
|
||||
* right click on ``OpenCV Library`` project -> :guilabel:`Android Tools -> Fix Project Properties`,
|
||||
then menu :guilabel:`Project -> Clean... -> Clean all`
|
||||
* right click on the project with errors -> :guilabel:`Properties -> Android`, make sure the
|
||||
``Target`` is selected and is ``Android 3.0`` or higher
|
||||
* check the build errors in the :guilabel:`Problems` view window and try to resolve them by yourselves
|
||||
|
||||
.. image:: images/eclipse_cdt_cfg4.png
|
||||
:alt: Configure CDT
|
||||
:align: center
|
||||
@@ -235,14 +245,14 @@ Import OpenCV library and samples to the Eclipse
|
||||
Running OpenCV Samples
|
||||
----------------------
|
||||
|
||||
At this point you should be able to build and run the samples. Keep in mind, that ``face-detection``,
|
||||
``Tutorial 3`` and ``Tutorial 4`` include some native code and require Android NDK and CDT plugin
|
||||
for Eclipse to build working applications. If you haven't installed these tools see the corresponding
|
||||
section of :ref:`Android_Dev_Intro`.
|
||||
At this point you should be able to build and run the samples. Keep in mind, that
|
||||
``face-detection``, ``Tutorial 3` and ``Tutorial 4`` include some native code and
|
||||
require Android NDK and CDT plugin for Eclipse to build working applications. If you haven't
|
||||
installed these tools, see the corresponding section of :ref:`Android_Dev_Intro`.
|
||||
|
||||
Also, please consider that ``Tutorial 0`` and ``Tutorial 1`` samples use Java Camera API that
|
||||
definitelly accessible on emulator from the Android SDK.
|
||||
Other samples use OpenCV Native Camera which may not work with emulator.
|
||||
.. warning:: Please consider that some samples use Android Java Camera API, which is accessible
|
||||
with an AVD. But most of samples use OpenCV Native Camera which **may not work** with
|
||||
an emulator.
|
||||
|
||||
.. note:: Recent *Android SDK tools, revision 19+* can run ARM v7a OS images but they available not
|
||||
for all Android versions.
|
||||
@@ -280,19 +290,39 @@ Well, running samples from Eclipse is very simple:
|
||||
To get rid of the message you will need to install `OpenCV Manager` and the appropriate `OpenCV binary pack`.
|
||||
Simply tap :menuselection:`Yes` if you have *Google Play Market* installed on your device/emulator. It will redirect you to the corresponding page on *Google Play Market*.
|
||||
|
||||
If you have no access to the *Market*, which is often the case with emulators - you will need to install the packages from OpenCV4Android SDK folder manually. Open the console/terminal and type in the following two commands:
|
||||
If you have no access to the *Market*, which is often the case with emulators - you will need to install the packages from OpenCV4Android SDK folder manually. See :ref:`manager_selection` for details.
|
||||
|
||||
.. code-block:: sh
|
||||
:linenos:
|
||||
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.3_Manager.apk
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.3_binary_pack_armv7a.apk
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.3_Manager_armv7a-neon.apk
|
||||
|
||||
If you're running Windows, that will probably look like this:
|
||||
.. note:: ``armeabi``, ``armv7a-neon``, ``arm7a-neon-android8``, ``mips`` and ``x86`` stand for
|
||||
platform targets:
|
||||
|
||||
* ``armeabi`` is for ARM v5 and ARM v6 architectures with Android API 8+,
|
||||
|
||||
* ``armv7a-neon`` is for NEON-optimized ARM v7 with Android API 9+,
|
||||
|
||||
* ``arm7a-neon-android8`` is for NEON-optimized ARM v7 with Android API 8,
|
||||
|
||||
* ``mips`` is for MIPS architecture with Android API 9+,
|
||||
|
||||
* ``x86`` is for Intel x86 CPUs with Android API 9+.
|
||||
|
||||
If using hardware device for testing/debugging, run the following command to learn
|
||||
its CPU architecture:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
adb shell getprop ro.product.cpu.abi
|
||||
|
||||
If you're using an AVD emulator, go :menuselection:`Window > AVD Manager` to see the
|
||||
list of availible devices. Click :menuselection:`Edit` in the context menu of the
|
||||
selected device. In the window, which then pop-ups, find the CPU field.
|
||||
|
||||
You may also see section :ref:`manager_selection` for details.
|
||||
|
||||
.. image:: images/install_opencv_manager_with_adb.png
|
||||
:alt: Run these commands in the console to install OpenCV Manager
|
||||
:align: center
|
||||
|
||||
When done, you will be able to run OpenCV samples on your device/emulator seamlessly.
|
||||
|
||||
@@ -303,6 +333,7 @@ Well, running samples from Eclipse is very simple:
|
||||
:alt: Tutorial 1 Basic - 1. Add OpenCV - running Canny
|
||||
:align: center
|
||||
|
||||
|
||||
What's next
|
||||
===========
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ Development in Java
|
||||
|
||||
You need the following software to be installed in order to develop for Android in Java:
|
||||
|
||||
#. **Sun JDK 6**
|
||||
#. **Sun JDK 6** (Sun JDK 7 is also possible)
|
||||
|
||||
Visit `Java SE Downloads page <http://www.oracle.com/technetwork/java/javase/downloads/>`_
|
||||
and download an installer for your OS.
|
||||
@@ -103,9 +103,10 @@ You need the following software to be installed in order to develop for Android
|
||||
|
||||
Here is Google's `install guide <http://developer.android.com/sdk/installing.html>`_ for the SDK.
|
||||
|
||||
.. note:: If you choose SDK packed into a Windows installer, then you should have 32-bit JRE
|
||||
installed. It is not a prerequisite for Android development, but installer is a x86
|
||||
application and requires 32-bit Java runtime.
|
||||
.. note:: You can choose downloading ``ADT Bundle package`` that in addition to Android SDK Tools includes
|
||||
Eclipse + ADT + CDT plugins, Android Platform-tools, the latest Android platform and the latest
|
||||
Android system image for the emulator - this is the best choice for those who is setting up Android
|
||||
development environment the first time!
|
||||
|
||||
.. note:: If you are running x64 version of Ubuntu Linux, then you need ia32 shared libraries
|
||||
for use on amd64 and ia64 systems to be installed. You can install them with the
|
||||
@@ -215,45 +216,11 @@ You need the following software to be installed in order to develop for Android
|
||||
|
||||
#. **CDT plugin for Eclipse**
|
||||
|
||||
If you selected for installation the ``NDK plugins`` component of Eclipse ADT plugin (see the picture above) your Eclipse IDE
|
||||
should already have ``CDT plugin`` (that means ``C/C++ Development Tooling``).
|
||||
There are several possible ways to integrate compilation of C++ code by Android NDK into Eclipse
|
||||
compilation process. We recommend the approach based on Eclipse
|
||||
:abbr:`CDT(C/C++ Development Tooling)` Builder.
|
||||
Make sure your Eclipse IDE has the :abbr:`CDT(C/C++ Development Tooling)` plugin
|
||||
installed. Menu :guilabel:`Help -> About Eclipse SDK -> Installation Details`.
|
||||
|
||||
.. image:: images/eclipse_about_cdt_0.png
|
||||
:alt: CDT in Eclipse About
|
||||
:align: center
|
||||
|
||||
..
|
||||
|
||||
.. image:: images/eclipse_about_cdt_1.png
|
||||
:alt: CDT in Eclipse About
|
||||
:align: center
|
||||
|
||||
.. note:: If you're using the latest ADT plugin for Eclipse (version 20 and above), most likely
|
||||
you already have the CDT plugin and don't need to install it.
|
||||
|
||||
.. image:: images/eclipse_about_cdt_1.png
|
||||
:alt: CDT in Eclipse About
|
||||
:align: center
|
||||
|
||||
To install the `CDT plugin <http://eclipse.org/cdt/>`_ use menu
|
||||
:guilabel:`Help -> Install New Software...`, then paste the CDT 8.0 repository URL
|
||||
http://download.eclipse.org/tools/cdt/releases/indigo as shown in the picture below and click
|
||||
:guilabel:`Add...`, name it *CDT* and click :guilabel:`OK`.
|
||||
|
||||
.. image:: images/eclipse_inst_cdt.png
|
||||
:alt: Configure builders
|
||||
:align: center
|
||||
|
||||
``CDT Main Features`` should be enough:
|
||||
|
||||
.. image:: images/eclipse_inst_cdt_2.png
|
||||
:alt: Configure builders
|
||||
:align: center
|
||||
|
||||
That's it. Compilation of C++ code is fully integrated into Eclipse building process now.
|
||||
|
||||
|
||||
Android application structure
|
||||
@@ -334,7 +301,11 @@ and exceptions are used in C++, it also should be created. Example of the file :
|
||||
|
||||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -fexceptions
|
||||
APP_ABI := armeabi-v7a
|
||||
APP_ABI := all
|
||||
|
||||
.. note:: We recommend setting ``APP_ABI := all`` for all targets. If you want to specify the
|
||||
target explicitly, use ``armeabi`` for ARMv5/ARMv6, ``armeabi-v7a`` for ARMv7, ``x86``
|
||||
for Intel Atom or ``mips`` for MIPS.
|
||||
|
||||
|
||||
.. _NDK_build_cli:
|
||||
@@ -344,6 +315,11 @@ Building application native part from command line
|
||||
|
||||
Here is the standard way to compile C++ part of an Android application:
|
||||
|
||||
.. warning:: We strongly reccomend using ``cmd.exe`` (standard Windows console) instead of Cygwin on
|
||||
**Windows**. Use the latter if only you're absolutely sure about, what you're doing. Cygwin
|
||||
is not really supported and we are unlikely to help you in case you encounter some
|
||||
problems with it. So, use it only if you're capable of handling the consequences yourself.
|
||||
|
||||
#. Open console and go to the root folder of an Android application
|
||||
|
||||
.. code-block:: bash
|
||||
@@ -357,7 +333,7 @@ Here is the standard way to compile C++ part of an Android application:
|
||||
<path_where_NDK_is_placed>/ndk-build
|
||||
|
||||
.. note:: On Windows we recommend to use ``ndk-build.cmd`` in standard Windows console (``cmd.exe``)
|
||||
rather than the similar ``bash`` script in ``Cygwin`` shell.
|
||||
rather than the similar ``bash`` script in ``Cygwin`` shell.
|
||||
|
||||
.. image:: images/ndk_build.png
|
||||
:alt: NDK build
|
||||
@@ -397,12 +373,19 @@ Eclipse build process. We recommend the approach based on Eclipse
|
||||
(e.g. ``"X:\\Apps\\android-ndk-r8"`` or ``"/opt/android-ndk-r8"``).
|
||||
|
||||
**On Windows** an environment variable can be set via
|
||||
:guilabel:`My Computer -> Properties -> Advanced -> Environment variables` and restarting Eclipse.
|
||||
:guilabel:`My Computer -> Properties -> Advanced -> Environment variables`.
|
||||
On Windows 7 it's also possible to use `setx <http://ss64.com/nt/setx.html>`_ command in a console session.
|
||||
|
||||
**On Linux** and **MacOS** an environment variable can be set via appending a
|
||||
``"export VAR_NAME=VAR_VALUE"`` line to the :file:`"~/.bashrc"` file and logging off and then on.
|
||||
|
||||
.. note:: It's also possible to define the ``NDKROOT`` environment variable within Eclipse IDE,
|
||||
but it should be done for every new workspace you create. If you prefer this option better than setting system
|
||||
environment variable, open Eclipse menu :guilabel:`Window -> Preferences -> C/C++ -> Build -> Environment`,
|
||||
press the :guilabel:`Add...` button and set variable name to ``NDKROOT`` and value to local Android NDK path.
|
||||
|
||||
#. After that you need to **restart Eclipse** to apply the changes.
|
||||
|
||||
#. Open Eclipse and load the Android app project to configure.
|
||||
|
||||
#. Add C/C++ Nature to the project via Eclipse menu :guilabel:`New -> Other -> C/C++ -> Convert to a C/C++ Project`.
|
||||
@@ -459,11 +442,20 @@ Eclipse build process. We recommend the approach based on Eclipse
|
||||
|
||||
::
|
||||
|
||||
# for NDK r8 and prior:
|
||||
${NDKROOT}/platforms/android-9/arch-arm/usr/include
|
||||
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include
|
||||
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include
|
||||
${ProjDirPath}/../../sdk/native/jni/include
|
||||
|
||||
::
|
||||
|
||||
# for NDK r8b and later:
|
||||
${NDKROOT}/platforms/android-9/arch-arm/usr/include
|
||||
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include
|
||||
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include
|
||||
${ProjDirPath}/../../sdk/native/jni/include
|
||||
|
||||
The last path should be changed to the correct absolute or relative path to OpenCV4Android SDK location.
|
||||
|
||||
This should clear the syntax error notifications in Eclipse C++ editor.
|
||||
@@ -472,16 +464,6 @@ Eclipse build process. We recommend the approach based on Eclipse
|
||||
:alt: Configure CDT
|
||||
:align: center
|
||||
|
||||
.. note:: The latest Android NDK **r8b** uses different STL headers path. So if you use this NDK
|
||||
release add the following **Include** paths list instead:
|
||||
|
||||
::
|
||||
|
||||
${NDKROOT}/platforms/android-9/arch-arm/usr/include
|
||||
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include
|
||||
${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include
|
||||
${ProjDirPath}/../../sdk/native/jni/include
|
||||
|
||||
|
||||
Debugging and Testing
|
||||
=====================
|
||||
@@ -662,8 +644,8 @@ execute :command:`adb devices` command. You will see the list of attached device
|
||||
:alt: List of attached devices
|
||||
:align: center
|
||||
|
||||
MacOS host computer
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Mac OS host computer
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
No actions are required, just connect your device via USB and run ``adb devices`` to check connection.
|
||||
|
||||
What's next
|
||||
|
||||
@@ -54,20 +54,8 @@ Using async initialization is a **recommended** way for application development.
|
||||
:alt: Add dependency from OpenCV library
|
||||
:align: center
|
||||
|
||||
To run OpenCV Manager-based application for the first time you need to install package with the `OpenCV Manager` for your platform. Armeabi, Armeabi-v7a with NEON, x86 and MIPS achitectures supported.
|
||||
You can do it using Google Play Market or manually with ``adb`` tool:
|
||||
|
||||
.. code-block:: sh
|
||||
:linenos:
|
||||
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.3_Manager.apk
|
||||
|
||||
For rare cases if NEON instruction set is not supported you need to install aditional OpenCV Library package:
|
||||
|
||||
.. code-block:: sh
|
||||
:linenos:
|
||||
|
||||
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.3_binary_pack_armv7a.apk
|
||||
In most cases OpenCV Manager may be installed automatically from Google Play. For such case, when Google Play is not available, i.e. emulator, developer board, etc, you can
|
||||
install it manually using adb tool. See :ref:`manager_selection` for details.
|
||||
|
||||
There is a very base code snippet implementing the async initialization. It shows basic principles. See the "15-puzzle" OpenCV sample for details.
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 55 KiB |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
@@ -71,7 +71,9 @@ There are functions in OpenCV, especially from calib3d module, such as ``project
|
||||
//... fill the array
|
||||
Mat pointsMat = Mat(points);
|
||||
|
||||
One can access a point in this matrix using the same method \texttt{Mat::at}: ::
|
||||
One can access a point in this matrix using the same method ``Mat::at`` :
|
||||
|
||||
::
|
||||
|
||||
Point2f point = pointsMat.at<Point2f>(i, 0);
|
||||
|
||||
@@ -109,7 +111,7 @@ Selecting a region of interest: ::
|
||||
Rect r(10, 10, 100, 100);
|
||||
Mat smallImg = img(r);
|
||||
|
||||
A convertion from \texttt{Mat} to C API data structures: ::
|
||||
A convertion from ``Mat`` to C API data structures: ::
|
||||
|
||||
Mat img = imread("image.jpg");
|
||||
IplImage img1 = img;
|
||||
@@ -150,7 +152,7 @@ A call to ``waitKey()`` starts a message passing cycle that waits for a key stro
|
||||
double minVal, maxVal;
|
||||
minMaxLoc(sobelx, &minVal, &maxVal); //find minimum and maximum intensities
|
||||
Mat draw;
|
||||
sobelx.convertTo(draw, CV_8U, 255.0/(maxVal - minVal), -minVal);
|
||||
sobelx.convertTo(draw, CV_8U, 255.0/(maxVal - minVal), -minVal * 255.0/(maxVal - minVal));
|
||||
|
||||
namedWindow("image", CV_WINDOW_AUTOSIZE);
|
||||
imshow("image", draw);
|
||||
|
||||
@@ -6,7 +6,7 @@ set(the_description "Auxiliary module for Android native camera support")
|
||||
set(OPENCV_MODULE_TYPE STATIC)
|
||||
|
||||
ocv_define_module(androidcamera INTERNAL opencv_core log dl)
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/camera_wrapper")
|
||||
ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/camera_wrapper" "${OpenCV_SOURCE_DIR}/android/service/engine/jni/include")
|
||||
|
||||
# Android source tree for native camera
|
||||
SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1)
|
||||
#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) && !defined(ANDROID_r4_2_0)
|
||||
# error Building camera wrapper for your version of Android is not supported by OpenCV. You need to modify OpenCV sources in order to compile camera wrapper for your version of Android.
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# define MAGIC_OPENCV_TEXTURE_ID (0x10)
|
||||
#else // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
|
||||
//TODO: This is either 2.2 or 2.3. Include the headers for ISurface.h access
|
||||
#if defined(ANDROID_r4_1_1)
|
||||
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
#include <gui/ISurface.h>
|
||||
#include <gui/BufferQueue.h>
|
||||
#else
|
||||
@@ -60,7 +60,7 @@ using namespace android;
|
||||
|
||||
void debugShowFPS();
|
||||
|
||||
#if defined(ANDROID_r4_1_1)
|
||||
#if defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
class ConsumerListenerStub: public BufferQueue::ConsumerListener
|
||||
{
|
||||
public:
|
||||
@@ -280,7 +280,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr
|
||||
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1)
|
||||
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
,camera_frame_metadata_t*
|
||||
#endif
|
||||
)
|
||||
@@ -526,7 +526,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
|
||||
pdstatus = camera->setPreviewTexture(surfaceTexture);
|
||||
if (pdstatus != 0)
|
||||
LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly");
|
||||
#elif defined(ANDROID_r4_1_1)
|
||||
#elif defined(ANDROID_r4_1_1) || defined(ANDROID_r4_2_0)
|
||||
sp<BufferQueue> bufferQueue = new BufferQueue();
|
||||
sp<BufferQueue::ConsumerListener> queueListener = new ConsumerListenerStub();
|
||||
bufferQueue->consumerConnect(queueListener);
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <android/log.h>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <opencv2/core/version.hpp>
|
||||
#include "camera_activity.hpp"
|
||||
#include "camera_wrapper.h"
|
||||
#include "EngineCommon.h"
|
||||
|
||||
#undef LOG_TAG
|
||||
#undef LOGE
|
||||
@@ -267,12 +269,13 @@ void CameraWrapperConnector::fillListWrapperLibs(const string& folderPath, vecto
|
||||
|
||||
std::string CameraWrapperConnector::getDefaultPathLibFolder()
|
||||
{
|
||||
const string packageList[] = {"tegra3", "armv7a_neon", "armv7a", "armv5", "x86"};
|
||||
for (size_t i = 0; i < 5; i++)
|
||||
#define BIN_PACKAGE_NAME(x) "org.opencv.lib_v" CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) "_" x
|
||||
const char* const packageList[] = {BIN_PACKAGE_NAME("armv7a"), OPENCV_ENGINE_PACKAGE};
|
||||
for (size_t i = 0; i < sizeof(packageList)/sizeof(packageList[0]); i++)
|
||||
{
|
||||
char path[128];
|
||||
sprintf(path, "/data/data/org.opencv.lib_v%d%d_%s/lib/", CV_MAJOR_VERSION, CV_MINOR_VERSION, packageList[i].c_str());
|
||||
LOGD("Trying package \"%s\" (\"%s\")", packageList[i].c_str(), path);
|
||||
sprintf(path, "/data/data/%s/lib/", packageList[i]);
|
||||
LOGD("Trying package \"%s\" (\"%s\")", packageList[i], path);
|
||||
|
||||
DIR* dir = opendir(path);
|
||||
if (!dir)
|
||||
@@ -301,8 +304,8 @@ std::string CameraWrapperConnector::getPathLibFolder()
|
||||
LOGD("Library name: %s", dl_info.dli_fname);
|
||||
LOGD("Library base address: %p", dl_info.dli_fbase);
|
||||
|
||||
const char* libName=dl_info.dli_fname;
|
||||
while( ((*libName)=='/') || ((*libName)=='.') )
|
||||
const char* libName=dl_info.dli_fname;
|
||||
while( ((*libName)=='/') || ((*libName)=='.') )
|
||||
libName++;
|
||||
|
||||
char lineBuf[2048];
|
||||
@@ -310,9 +313,9 @@ std::string CameraWrapperConnector::getPathLibFolder()
|
||||
|
||||
if(file)
|
||||
{
|
||||
while (fgets(lineBuf, sizeof lineBuf, file) != NULL)
|
||||
{
|
||||
//verify that line ends with library name
|
||||
while (fgets(lineBuf, sizeof lineBuf, file) != NULL)
|
||||
{
|
||||
//verify that line ends with library name
|
||||
int lineLength = strlen(lineBuf);
|
||||
int libNameLength = strlen(libName);
|
||||
|
||||
@@ -325,7 +328,7 @@ std::string CameraWrapperConnector::getPathLibFolder()
|
||||
|
||||
if (0 != strncmp(lineBuf + lineLength - libNameLength, libName, libNameLength))
|
||||
{
|
||||
//the line does not contain the library name
|
||||
//the line does not contain the library name
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -344,18 +347,18 @@ std::string CameraWrapperConnector::getPathLibFolder()
|
||||
|
||||
fclose(file);
|
||||
return pathBegin;
|
||||
}
|
||||
fclose(file);
|
||||
LOGE("Could not find library path");
|
||||
}
|
||||
fclose(file);
|
||||
LOGE("Could not find library path");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGE("Could not read /proc/self/smaps");
|
||||
LOGE("Could not read /proc/self/smaps");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGE("Could not get library name and base address");
|
||||
LOGE("Could not get library name and base address");
|
||||
}
|
||||
|
||||
return string();
|
||||
@@ -427,7 +430,6 @@ void CameraActivity::applyProperties()
|
||||
|
||||
int CameraActivity::getFrameWidth()
|
||||
{
|
||||
LOGD("CameraActivity::getFrameWidth()");
|
||||
if (frameWidth <= 0)
|
||||
frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
|
||||
return frameWidth;
|
||||
@@ -435,7 +437,6 @@ int CameraActivity::getFrameWidth()
|
||||
|
||||
int CameraActivity::getFrameHeight()
|
||||
{
|
||||
LOGD("CameraActivity::getFrameHeight()");
|
||||
if (frameHeight <= 0)
|
||||
frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
|
||||
return frameHeight;
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef perf::TestBaseWithParam<int> PointsNum;
|
||||
|
||||
PERF_TEST_P(PointsNum_Algo, solvePnP,
|
||||
testing::Combine(
|
||||
testing::Values(4, 3*9, 7*13),
|
||||
testing::Values(/*4,*/ 3*9, 7*13), //TODO: find why results on 4 points are too unstable
|
||||
testing::Values((int)CV_ITERATIVE, (int)CV_EPNP)
|
||||
)
|
||||
)
|
||||
@@ -86,6 +86,7 @@ PERF_TEST(PointsNum_Algo, solveP3P)
|
||||
add(points2d, noise, points2d);
|
||||
|
||||
declare.in(points3d, points2d);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE_N(1000)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
# ifdef __clang__
|
||||
# if defined __clang__ || defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma GCC diagnostic ignored "-Wextra"
|
||||
# endif
|
||||
|
||||
@@ -2778,17 +2778,13 @@ CV_IMPL int cvStereoRectifyUncalibrated(
|
||||
cvPerspectiveTransform( _m1, _m1, &H0 );
|
||||
cvPerspectiveTransform( _m2, _m2, &H2 );
|
||||
CvMat A = cvMat( 1, npoints, CV_64FC3, lines1 ), BxBy, B;
|
||||
double a[9], atb[3], x[3];
|
||||
CvMat AtA = cvMat( 3, 3, CV_64F, a );
|
||||
CvMat AtB = cvMat( 3, 1, CV_64F, atb );
|
||||
double x[3];
|
||||
CvMat X = cvMat( 3, 1, CV_64F, x );
|
||||
cvConvertPointsHomogeneous( _m1, &A );
|
||||
cvReshape( &A, &A, 1, npoints );
|
||||
cvReshape( _m2, &BxBy, 1, npoints );
|
||||
cvGetCol( &BxBy, &B, 0 );
|
||||
cvGEMM( &A, &A, 1, 0, 0, &AtA, CV_GEMM_A_T );
|
||||
cvGEMM( &A, &B, 1, 0, 0, &AtB, CV_GEMM_A_T );
|
||||
cvSolve( &AtA, &AtB, &X, CV_SVD_SYM );
|
||||
cvSolve( &A, &B, &X, CV_SVD );
|
||||
|
||||
double ha[] =
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
# ifdef __clang__
|
||||
# if defined __clang__ || defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma GCC diagnostic ignored "-Wextra"
|
||||
# endif
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ Retina::getMagno
|
||||
Retina::getParameters
|
||||
+++++++++++++++++++++
|
||||
|
||||
.. ocv:function:: struct Retina::RetinaParameters Retina::getParameters()
|
||||
.. ocv:function:: Retina::RetinaParameters Retina::getParameters()
|
||||
|
||||
Retrieve the current parameters values in a *Retina::RetinaParameters* structure
|
||||
|
||||
@@ -323,7 +323,8 @@ Retina::RetinaParameters
|
||||
========================
|
||||
|
||||
.. ocv:struct:: Retina::RetinaParameters
|
||||
This structure merges all the parameters that can be adjusted threw the **Retina::setup()**, **Retina::setupOPLandIPLParvoChannel** and **Retina::setupIPLMagnoChannel** setup methods
|
||||
|
||||
This structure merges all the parameters that can be adjusted threw the **Retina::setup()**, **Retina::setupOPLandIPLParvoChannel** and **Retina::setupIPLMagnoChannel** setup methods
|
||||
Parameters structure for better clarity, check explenations on the comments of methods : setupOPLandIPLParvoChannel and setupIPLMagnoChannel. ::
|
||||
|
||||
class RetinaParameters{
|
||||
|
||||
@@ -583,7 +583,7 @@ namespace cv
|
||||
virtual ~StereoVar();
|
||||
|
||||
//! the stereo correspondence operator that computes disparity map for the specified rectified stereo pair
|
||||
CV_WRAP_AS(compute) virtual void operator()(const Mat& left, const Mat& right, Mat& disp);
|
||||
CV_WRAP_AS(compute) virtual void operator()(const Mat& left, const Mat& right, CV_OUT Mat& disp);
|
||||
|
||||
CV_PROP_RW int levels;
|
||||
CV_PROP_RW double pyrScale;
|
||||
|
||||
@@ -767,8 +767,8 @@ void ChamferMatcher::Matching::findContourOrientations(const template_coords_t&
|
||||
}
|
||||
|
||||
// get the middle two angles
|
||||
nth_element(angles.begin(), angles.begin()+M-1, angles.end());
|
||||
nth_element(angles.begin()+M-1, angles.begin()+M, angles.end());
|
||||
std::nth_element(angles.begin(), angles.begin()+M-1, angles.end());
|
||||
std::nth_element(angles.begin()+M-1, angles.begin()+M, angles.end());
|
||||
// sort(angles.begin(), angles.end());
|
||||
|
||||
// average them to compute tangent
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(ANDROID)
|
||||
#include "opencv2/contrib/detection_based_tracker.hpp"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define DEBUGLOGS 1
|
||||
|
||||
#ifdef ANDROID
|
||||
|
||||
@@ -300,7 +300,13 @@ public:
|
||||
//------------------------------------------------------------------------------
|
||||
// FaceRecognizer
|
||||
//------------------------------------------------------------------------------
|
||||
void FaceRecognizer::update(InputArrayOfArrays, InputArray) {
|
||||
void FaceRecognizer::update(InputArrayOfArrays src, InputArray labels ) {
|
||||
if( dynamic_cast<LBPH*>(this) != 0 )
|
||||
{
|
||||
dynamic_cast<LBPH*>(this)->update( src, labels );
|
||||
return;
|
||||
}
|
||||
|
||||
string error_msg = format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.", this->name().c_str());
|
||||
CV_Error(CV_StsNotImplemented, error_msg);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace
|
||||
};
|
||||
size_t colors_mum = sizeof(colors)/sizeof(colors[0]);
|
||||
|
||||
#if defined __cplusplus && __cplusplus > 199711L
|
||||
#if (defined __cplusplus && __cplusplus > 199711L) || defined _STLPORT_MAJOR
|
||||
#else
|
||||
template<class FwIt, class T> void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
# ifdef __clang__
|
||||
# if defined __clang__ || defined __APPLE__
|
||||
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
|
||||
# pragma GCC diagnostic ignored "-Wextra"
|
||||
# endif
|
||||
|
||||
@@ -204,11 +204,11 @@ CV_EXPORTS ErrorCallback redirectError( ErrorCallback errCallback,
|
||||
#ifdef __GNUC__
|
||||
#define CV_Error( code, msg ) cv::error( cv::Exception(code, msg, __func__, __FILE__, __LINE__) )
|
||||
#define CV_Error_( code, args ) cv::error( cv::Exception(code, cv::format args, __func__, __FILE__, __LINE__) )
|
||||
#define CV_Assert( expr ) if((expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, __func__, __FILE__, __LINE__) )
|
||||
#define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, __func__, __FILE__, __LINE__) )
|
||||
#else
|
||||
#define CV_Error( code, msg ) cv::error( cv::Exception(code, msg, "", __FILE__, __LINE__) )
|
||||
#define CV_Error_( code, args ) cv::error( cv::Exception(code, cv::format args, "", __FILE__, __LINE__) )
|
||||
#define CV_Assert( expr ) if((expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, "", __FILE__, __LINE__) )
|
||||
#define CV_Assert( expr ) if(!!(expr)) ; else cv::error( cv::Exception(CV_StsAssert, #expr, "", __FILE__, __LINE__) )
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -4655,7 +4655,7 @@ class CV_EXPORTS CommandLineParser
|
||||
template<typename _Tp>
|
||||
static _Tp getData(const std::string& str)
|
||||
{
|
||||
_Tp res;
|
||||
_Tp res = _Tp();
|
||||
std::stringstream s1(str);
|
||||
s1 >> res;
|
||||
return res;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#define CV_XADD(addr,delta) _InterlockedExchangeAdd(const_cast<void*>(reinterpret_cast<volatile void*>(addr)), delta)
|
||||
#elif defined __GNUC__
|
||||
|
||||
#if defined __clang__ && __clang_major__ >= 3
|
||||
#if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__
|
||||
#ifdef __ATOMIC_SEQ_CST
|
||||
#define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), (delta), __ATOMIC_SEQ_CST)
|
||||
#else
|
||||
@@ -64,8 +64,9 @@
|
||||
#endif
|
||||
#elif __GNUC__*10 + __GNUC_MINOR__ >= 42
|
||||
|
||||
#if !defined WIN32 && (defined __i486__ || defined __i586__ || \
|
||||
defined __i686__ || defined __MMX__ || defined __SSE__ || defined __ppc__)
|
||||
#if !(defined WIN32 || defined _WIN32) && (defined __i486__ || defined __i586__ || \
|
||||
defined __i686__ || defined __MMX__ || defined __SSE__ || defined __ppc__) || \
|
||||
(defined __GNUC__ && defined _STLPORT_MAJOR)
|
||||
#define CV_XADD __sync_fetch_and_add
|
||||
#else
|
||||
#include <ext/atomicity.h>
|
||||
@@ -3873,10 +3874,21 @@ template<typename _Tp> inline std::ostream& operator<<(std::ostream& out, const
|
||||
template<typename _Tp, int n> inline std::ostream& operator<<(std::ostream& out, const Vec<_Tp, n>& vec)
|
||||
{
|
||||
out << "[";
|
||||
for (int i = 0; i < n - 1; ++i) {
|
||||
out << vec[i] << ", ";
|
||||
|
||||
if(Vec<_Tp, n>::depth < CV_32F)
|
||||
{
|
||||
for (int i = 0; i < n - 1; ++i) {
|
||||
out << (int)vec[i] << ", ";
|
||||
}
|
||||
out << (int)vec[n-1] << "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < n - 1; ++i) {
|
||||
out << vec[i] << ", ";
|
||||
}
|
||||
out << vec[n-1] << "]";
|
||||
}
|
||||
out << vec[n-1] << "]";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,6 @@
|
||||
|
||||
#define CVAUX_STR_EXP(__A) #__A
|
||||
#define CVAUX_STR(__A) CVAUX_STR_EXP(__A)
|
||||
#define CV_VERSION CVAUX_STR(CV_MAJOR_VERSION) "." CVAUX_STR(CV_MINOR_VERSION) "." CVAUX_STR(CV_SUBMINOR_VERSION)
|
||||
#define CV_VERSION CVAUX_STR(CV_MAJOR_VERSION) "." CVAUX_STR(CV_MINOR_VERSION) "." CVAUX_STR(CV_SUBMINOR_VERSION) ".2"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -123,6 +123,7 @@ PERF_TEST_P(Size_MatType, add, TYPICAL_MATS_CORE_ARITHM)
|
||||
cv::Mat c = Mat(sz, type);
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
declare.time(50);
|
||||
|
||||
if (CV_MAT_DEPTH(type) == CV_32S)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ PERF_TEST_P(Size_MatType, bitwise_not, TYPICAL_MATS_BITW_ARITHM)
|
||||
cv::Mat c = Mat(sz, type);
|
||||
|
||||
declare.in(a, WARMUP_RNG).out(c);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() cv::bitwise_not(a, c);
|
||||
|
||||
@@ -34,6 +35,7 @@ PERF_TEST_P(Size_MatType, bitwise_and, TYPICAL_MATS_BITW_ARITHM)
|
||||
cv::Mat c = Mat(sz, type);
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() bitwise_and(a, b, c);
|
||||
|
||||
@@ -49,6 +51,7 @@ PERF_TEST_P(Size_MatType, bitwise_or, TYPICAL_MATS_BITW_ARITHM)
|
||||
cv::Mat c = Mat(sz, type);
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() bitwise_or(a, b, c);
|
||||
|
||||
@@ -64,6 +67,7 @@ PERF_TEST_P(Size_MatType, bitwise_xor, TYPICAL_MATS_BITW_ARITHM)
|
||||
cv::Mat c = Mat(sz, type);
|
||||
|
||||
declare.in(a, b, WARMUP_RNG).out(c);
|
||||
declare.time(100);
|
||||
|
||||
TEST_CYCLE() bitwise_xor(a, b, c);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user