Android cmake toolchain is reworked for NDK r7; added experimental Android x86 support.

This commit is contained in:
Andrey Kamaev 2011-11-16 14:32:10 +00:00
parent d51a5262b3
commit 3bdb53e484
12 changed files with 705 additions and 287 deletions

View File

@ -136,7 +136,7 @@ else()
endif() endif()
if(ANDROID) if(ANDROID)
set(OPENCV_LIB_INSTALL_PATH libs/${ARMEABI_NDK_NAME}) set(OPENCV_LIB_INSTALL_PATH libs/${ANDROID_NDK_ABI_NAME})
else() else()
set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX})
endif() endif()
@ -745,7 +745,7 @@ endif()
# Java support # Java support
# =================================================== # ===================================================
if (PYTHON_EXECUTABLE AND ANDROID AND ANDROID_API_LEVEL GREATER 7) if (PYTHON_EXECUTABLE AND ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)
option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE) option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE)
endif() endif()
@ -815,7 +815,7 @@ if (BUILD_JAVA_SUPPORT)
# detect ANDROID_SDK_TARGET if no target is provided by user # detect ANDROID_SDK_TARGET if no target is provided by user
if (NOT ANDROID_SDK_TARGET) if (NOT ANDROID_SDK_TARGET)
set(desired_android_target_level ${ANDROID_API_LEVEL}) set(desired_android_target_level ${ANDROID_NATIVE_API_LEVEL})
if (desired_android_target_level LESS 8) if (desired_android_target_level LESS 8)
set(desired_android_target_level 8) set(desired_android_target_level 8)
endif() endif()
@ -1124,7 +1124,7 @@ if(WIN32)
endif() endif()
############## Android source tree for native camera ############### ############## Android source tree for native camera ###############
if(ANDROID AND ANDROID_API_LEVEL GREATER 7) if(ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7)
option(WITH_ANDROID_CAMERA "Build with native Android camera support" TRUE) option(WITH_ANDROID_CAMERA "Build with native Android camera support" TRUE)
SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH SET (ANDROID_SOURCE_TREE "ANDROID_SOURCE_TREE-NOTFOUND" CACHE PATH
@ -1398,8 +1398,8 @@ set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_P
set(CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "") set(CMAKE_OPENCV2_INCLUDE_DIRS_CONFIGCMAKE "")
if(ANDROID) if(ANDROID)
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/libs/\${ARMEABI_NDK_NAME}\"") set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/libs/\${ANDROID_NDK_ABI_NAME}\"")
set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/libs/\${ARMEABI_NDK_NAME}\"") set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/libs/\${ANDROID_NDK_ABI_NAME}\"")
else() else()
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"") set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"")
set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") set(CMAKE_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"")
@ -1462,7 +1462,7 @@ if(ANDROID)
set(CMAKE_CAMERA_LIBS_CONFIGCMAKE "native_camera_r${ANDROID_VERSION}") set(CMAKE_CAMERA_LIBS_CONFIGCMAKE "native_camera_r${ANDROID_VERSION}")
elseif(WITH_ANDROID_CAMERA) elseif(WITH_ANDROID_CAMERA)
SET(CMAKE_CAMERA_LIBS_CONFIGCMAKE "") SET(CMAKE_CAMERA_LIBS_CONFIGCMAKE "")
file(GLOB CMAKE_CAMERA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/${ARMEABI_NDK_NAME}/libnative_camera_r*.so") file(GLOB CMAKE_CAMERA_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}/libnative_camera_r*.so")
foreach(cam_lib ${CMAKE_CAMERA_LIBS}) foreach(cam_lib ${CMAKE_CAMERA_LIBS})
get_filename_component(cam_lib "${cam_lib}" NAME) get_filename_component(cam_lib "${cam_lib}" NAME)
string(REGEX REPLACE "lib(native_camera_r[0-9]+\\.[0-9]+\\.[0-9]+)\\.so" "\\1" cam_lib "${cam_lib}") string(REGEX REPLACE "lib(native_camera_r[0-9]+\\.[0-9]+\\.[0-9]+)\\.so" "\\1" cam_lib "${cam_lib}")
@ -1671,8 +1671,8 @@ else()
endif() endif()
if(ANDROID) if(ANDROID)
status(" Floating point type:" ${ARM_TARGET}) status(" Android ABI:" ${ANDROID_ABI})
status(" Native API level:" android-${ANDROID_API_LEVEL}) status(" Native API level:" android-${ANDROID_NATIVE_API_LEVEL})
status(" SDK target:" "${ANDROID_SDK_TARGET}") status(" SDK target:" "${ANDROID_SDK_TARGET}")
endif() endif()
@ -1735,7 +1735,7 @@ if(UNIX AND NOT APPLE)
if(ANDROID) if(ANDROID)
if(WITH_ANDROID_CAMERA) if(WITH_ANDROID_CAMERA)
status(" AndroidNativeCamera:" BUILD_ANDROID_CAMERA_WRAPPER THEN "build for Android ${ANDROID_VERSION}" ELSE "use prebuilt libraries") status(" AndroidNativeCamera:" BUILD_ANDROID_CAMERA_WRAPPER THEN "YES, build for Android ${ANDROID_VERSION}" ELSE "YES, use prebuilt libraries")
else() else()
status(" AndroidNativeCamera:" "NO (native camera requires Android API level 8 or higher)") status(" AndroidNativeCamera:" "NO (native camera requires Android API level 8 or higher)")
endif() endif()
@ -1776,7 +1776,7 @@ status(" Interfaces:")
status(" Python:" BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE NO) status(" Python:" BUILD_NEW_PYTHON_SUPPORT THEN YES ELSE NO)
status(" Python interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_MAJOR_MINOR})" ELSE NO) status(" Python interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_MAJOR_MINOR})" ELSE NO)
status(" Python numpy:" PYTHON_USE_NUMPY THEN YES ELSE "NO (Python wrappers will not be generated)") status(" Python numpy:" PYTHON_USE_NUMPY THEN YES ELSE "NO (Python wrappers will not be generated)")
if(ANDROID AND ANDROID_API_LEVEL LESS 8) if(ANDROID AND ANDROID_NATIVE_API_LEVEL LESS 8)
status(" Java:" "NO (Java API requires Android API level 8 or higher)") status(" Java:" "NO (Java API requires Android API level 8 or higher)")
else() else()
status(" Java:" BUILD_JAVA_SUPPORT THEN YES ELSE NO) status(" Java:" BUILD_JAVA_SUPPORT THEN YES ELSE NO)

View File

@ -106,13 +106,13 @@ macro(add_android_project _target _path)
set_target_properties(${JNI_LIB_NAME} PROPERTIES set_target_properties(${JNI_LIB_NAME} PROPERTIES
OUTPUT_NAME "${JNI_LIB_NAME}" OUTPUT_NAME "${JNI_LIB_NAME}"
LIBRARY_OUTPUT_DIRECTORY "${build_path}/libs/${ARMEABI_NDK_NAME}" LIBRARY_OUTPUT_DIRECTORY "${build_path}/libs/${ANDROID_NDK_ABI_NAME}"
) )
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
TARGET ${JNI_LIB_NAME} TARGET ${JNI_LIB_NAME}
POST_BUILD POST_BUILD
COMMAND ${CMAKE_STRIP} "${build_path}/libs/${ARMEABI_NDK_NAME}/*.so" COMMAND ${CMAKE_STRIP} "${build_path}/libs/${ANDROID_NDK_ABI_NAME}/*.so"
) )
else() else()
SET(JNI_LIB_NAME) SET(JNI_LIB_NAME)

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ POPD
:: defaults :: defaults
IF NOT DEFINED BUILD_DIR SET BUILD_DIR=build IF NOT DEFINED BUILD_DIR SET BUILD_DIR=build
IF NOT DEFINED ARM_TARGET SET ARM_TARGET=armeabi-v7a IF NOT DEFINED ANDROID_ABI SET ANDROID_ABI=armeabi-v7a
SET OPENCV_BUILD_DIR=%SCRIPTS_DIR%\..\%BUILD_DIR% SET OPENCV_BUILD_DIR=%SCRIPTS_DIR%\..\%BUILD_DIR%
:: check that all required variables defined :: check that all required variables defined
@ -49,14 +49,14 @@ PUSHD "%BUILD_DIR%" || (ECHO. & ECHO Directory "%BUILD_DIR%" is not found & GOTO
:: run cmake :: run cmake
ECHO. & ECHO Runnning cmake... ECHO. & ECHO Runnning cmake...
ECHO ARM_TARGET=%ARM_TARGET% ECHO ANDROID_ABI=%ANDROID_ABI%
ECHO. ECHO.
IF NOT %BUILD_OPENCV%==1 GOTO other-cmake IF NOT %BUILD_OPENCV%==1 GOTO other-cmake
:opencv-cmake :opencv-cmake
("%CMAKE_EXE%" -G"MinGW Makefiles" -DARM_TARGET="%ARM_TARGET%" -C "%SOURCE_DIR%\CMakeCache.android.initial.cmake" -DCMAKE_TOOLCHAIN_FILE="%SOURCE_DIR%"\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="%MAKE_EXE%" %* "%SOURCE_DIR%\..") && GOTO cmakefin ("%CMAKE_EXE%" -G"MinGW Makefiles" -DANDROID_ABI="%ANDROID_ABI%" -C "%SOURCE_DIR%\CMakeCache.android.initial.cmake" -DCMAKE_TOOLCHAIN_FILE="%SOURCE_DIR%"\android.toolchain.cmake -DCMAKE_BUILD_TOOL="%MAKE_EXE%" %* "%SOURCE_DIR%\..") && GOTO cmakefin
ECHO. & ECHO cmake failed & GOTO end ECHO. & ECHO cmake failed & GOTO end
:other-cmake :other-cmake
("%CMAKE_EXE%" -G"MinGW Makefiles" -DARM_TARGET="%ARM_TARGET%" -DOpenCV_DIR="%OPENCV_BUILD_DIR%" -DCMAKE_TOOLCHAIN_FILE="%OPENCV_BUILD_DIR%\..\android.toolchain.cmake" -DCMAKE_MAKE_PROGRAM="%MAKE_EXE%" %* "%SOURCE_DIR%") && GOTO cmakefin ("%CMAKE_EXE%" -G"MinGW Makefiles" -DANDROID_ABI="%ANDROID_ABI%" -DOpenCV_DIR="%OPENCV_BUILD_DIR%" -DCMAKE_TOOLCHAIN_FILE="%OPENCV_BUILD_DIR%\..\android.toolchain.cmake" -DCMAKE_BUILD_TOOL="%MAKE_EXE%" %* "%SOURCE_DIR%") && GOTO cmakefin
ECHO. & ECHO cmake failed & GOTO end ECHO. & ECHO cmake failed & GOTO end
:cmakefin :cmakefin
@ -77,4 +77,4 @@ ECHO. & ECHO Compiling Android project...
:end :end
POPD POPD
ENDLOCAL ENDLOCAL

View File

@ -4,5 +4,5 @@ cd `dirname $0`/..
mkdir -p build_armeabi mkdir -p build_armeabi
cd build_armeabi cd build_armeabi
cmake -C ../CMakeCache.android.initial.cmake -DARM_TARGET=armeabi -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../.. cmake -C ../CMakeCache.android.initial.cmake -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../..

View File

@ -4,5 +4,5 @@ cd `dirname $0`/..
mkdir -p build_neon mkdir -p build_neon
cd build_neon cd build_neon
cmake -C ../CMakeCache.android.initial.cmake -DARM_TARGET="armeabi-v7a with NEON" -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../.. cmake -C ../CMakeCache.android.initial.cmake -DANDROID_ABI="armeabi-v7a with NEON" -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../..

View File

@ -15,7 +15,7 @@ mkdir opencv
#mkdir build-neon #mkdir build-neon
#cd build-neon #cd build-neon
#cmake -C "$ANDROID_DIR/CMakeCache.android.initial.cmake" -DARM_TARGET="armeabi-v7a with NEON" -DBUILD_DOCS=OFF -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DCMAKE_TOOLCHAIN_FILE="$ANDROID_DIR/android.toolchain.cmake" -DCMAKE_INSTALL_PREFIX="$PRG_DIR/opencv" "$ANDROID_DIR/.." || exit 1 #cmake -C "$ANDROID_DIR/CMakeCache.android.initial.cmake" -DANDROID_ABI="armeabi-v7a with NEON" -DBUILD_DOCS=OFF -DBUILD_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DCMAKE_TOOLCHAIN_FILE="$ANDROID_DIR/android.toolchain.cmake" -DCMAKE_INSTALL_PREFIX="$PRG_DIR/opencv" "$ANDROID_DIR/.." || exit 1
#make -j8 install/strip || exit 1 #make -j8 install/strip || exit 1
#cd "$PRG_DIR/opencv" #cd "$PRG_DIR/opencv"
@ -29,7 +29,7 @@ cd "$PRG_DIR"
mkdir build mkdir build
cd build cd build
cmake -C "$ANDROID_DIR/CMakeCache.android.initial.cmake" -DARM_TARGET="armeabi-v7a" -DBUILD_DOCS=OFF -DBUILD_TESTS=ON -DBUILD_EXAMPLES=OFF -DBUILD_ANDROID_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE="$ANDROID_DIR/android.toolchain.cmake" -DCMAKE_INSTALL_PREFIX="$PRG_DIR/opencv" "$ANDROID_DIR/.." || exit 1 cmake -C "$ANDROID_DIR/CMakeCache.android.initial.cmake" -DANDROID_ABI="armeabi-v7a" -DBUILD_DOCS=OFF -DBUILD_TESTS=ON -DBUILD_EXAMPLES=OFF -DBUILD_ANDROID_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE="$ANDROID_DIR/android.toolchain.cmake" -DCMAKE_INSTALL_PREFIX="$PRG_DIR/opencv" "$ANDROID_DIR/.." || exit 1
make -j8 install/strip || exit 1 make -j8 install/strip || exit 1
cd "$PRG_DIR/opencv" cd "$PRG_DIR/opencv"
@ -40,7 +40,7 @@ rm -rf doc include src .classpath .project AndroidManifest.xml default.propertie
cd "$PRG_DIR/build" cd "$PRG_DIR/build"
rm -rf CMakeCache.txt rm -rf CMakeCache.txt
cmake -C "$ANDROID_DIR/CMakeCache.android.initial.cmake" -DARM_TARGET="armeabi" -DBUILD_DOCS=ON -DBUILD_TESTS=ON -DBUILD_EXAMPLES=OFF -DBUILD_ANDROID_EXAMPLES=ON -DINSTALL_ANDROID_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE="$ANDROID_DIR/android.toolchain.cmake" -DCMAKE_INSTALL_PREFIX="$PRG_DIR/opencv" "$ANDROID_DIR/.." || exit 1 cmake -C "$ANDROID_DIR/CMakeCache.android.initial.cmake" -DANDROID_ABI="armeabi" -DBUILD_DOCS=ON -DBUILD_TESTS=ON -DBUILD_EXAMPLES=OFF -DBUILD_ANDROID_EXAMPLES=ON -DINSTALL_ANDROID_EXAMPLES=ON -DCMAKE_TOOLCHAIN_FILE="$ANDROID_DIR/android.toolchain.cmake" -DCMAKE_INSTALL_PREFIX="$PRG_DIR/opencv" "$ANDROID_DIR/.." || exit 1
make -j8 install/strip docs || exit 1 make -j8 install/strip docs || exit 1
find doc -name "*.pdf" -exec cp {} $PRG_DIR/opencv/doc \; find doc -name "*.pdf" -exec cp {} $PRG_DIR/opencv/doc \;

View File

@ -1,8 +1,8 @@
:: variables required for OpenCV build :: :: variables required for OpenCV build ::
:: Note: all pathes should be specified without tailing slashes! :: Note: all pathes should be specified without tailing slashes!
SET ANDROID_NDK=C:\full\path\to\your\copy\of\android\NDK\android-ndk-r6b SET ANDROID_NDK=C:\full\path\to\your\copy\of\android\NDK\android-ndk-r7
SET CMAKE_EXE=C:\full\path\to\cmake\utility\cmake.exe SET CMAKE_EXE=C:\full\path\to\cmake\utility\cmake.exe
SET MAKE_EXE=C:\full\path\to\native\port\of\make\utility\make.exe SET MAKE_EXE=%ANDROID_NDK%\prebuilt\windows\bin\make.exe
:: variables required for android-opencv build :: :: variables required for android-opencv build ::
SET ANDROID_SDK=C:\full\path\to\your\copy\of\android\SDK\android-sdk-windows SET ANDROID_SDK=C:\full\path\to\your\copy\of\android\SDK\android-sdk-windows
@ -11,16 +11,20 @@ SET JAVA_HOME=C:\full\path\to\JDK\jdk1.6.0_25
:: configuration options :: :: configuration options ::
:::: general ARM-V7 settings :::: general ARM-V7 settings
SET ARM_TARGET=armeabi-v7a SET ANDROID_ABI=armeabi-v7a
SET BUILD_DIR=build SET BUILD_DIR=build
:::: uncomment following lines to compile for emulator or old device :::: uncomment following lines to compile for old emulator or old device
::SET ARM_TARGET=armeabi ::SET ANDROID_ABI=armeabi
::SET BUILD_DIR=build_armeabi ::SET BUILD_DIR=build_armeabi
:::: uncomment following lines to compile for ARM-V7 with NEON support :::: uncomment following lines to compile for ARM-V7 with NEON support
::SET ARM_TARGET=armeabi-v7a with NEON ::SET ANDROID_ABI=armeabi-v7a with NEON
::SET BUILD_DIR=build_neon ::SET BUILD_DIR=build_neon
:::: uncomment following lines to compile for x86
::SET ANDROID_ABI=x86
::SET BUILD_DIR=build_x86
:::: other options :::: other options
::SET ANDROID_API_LEVEL=8 &:: android-3 is enough for native part of OpenCV but android-8 is required for Java API and samples ::SET ANDROID_NATIVE_API_LEVEL=8 &:: android-3 is enough for native part of OpenCV but android-8 is required for Java API and samples

View File

@ -38,7 +38,7 @@ IF (NOT BUILD_SHARED_LIBS)
ENDIF() ENDIF()
if (NOT BUILD_ANDROID_CAMERA_WRAPPER) if (NOT BUILD_ANDROID_CAMERA_WRAPPER)
file(GLOB camera_wrappers "${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib/${ARMEABI_NDK_NAME}/libnative_camera_r*.so") file(GLOB camera_wrappers "${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/lib/${ANDROID_NDK_ABI_NAME}/libnative_camera_r*.so")
foreach(wrapper ${camera_wrappers}) foreach(wrapper ${camera_wrappers})
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(

View File

@ -12,7 +12,7 @@
#ifdef ANDROID #ifdef ANDROID
# include <android/api-level.h> # include <android/api-level.h>
# define GTEST_HAS_CLONE (__ANDROID_API__ > 7) # define GTEST_HAS_CLONE (__ANDROID_API__ > 7 && __arm__)
# define GTEST_HAS_POSIX_RE (__ANDROID_API__ > 7) # define GTEST_HAS_POSIX_RE (__ANDROID_API__ > 7)
# define GTEST_HAS_STD_WSTRING _GLIBCXX_USE_WCHAR_T # define GTEST_HAS_STD_WSTRING _GLIBCXX_USE_WCHAR_T
#endif #endif

View File

@ -16,8 +16,8 @@ parse_patterns = (
{'name': "cxx_flags", 'default': None, 'pattern': re.compile("^CMAKE_CXX_FLAGS:STRING=(.*)$")}, {'name': "cxx_flags", 'default': None, 'pattern': re.compile("^CMAKE_CXX_FLAGS:STRING=(.*)$")},
{'name': "cxx_flags_debug", 'default': None, 'pattern': re.compile("^CMAKE_CXX_FLAGS_DEBUG:STRING=(.*)$")}, {'name': "cxx_flags_debug", 'default': None, 'pattern': re.compile("^CMAKE_CXX_FLAGS_DEBUG:STRING=(.*)$")},
{'name': "cxx_flags_release", 'default': None, 'pattern': re.compile("^CMAKE_CXX_FLAGS_RELEASE:STRING=(.*)$")}, {'name': "cxx_flags_release", 'default': None, 'pattern': re.compile("^CMAKE_CXX_FLAGS_RELEASE:STRING=(.*)$")},
{'name': "ndk_path", 'default': None, 'pattern': re.compile("^ANDROID_NDK(?:_TOOLCHAIN_ROOT)?:PATH=(.*)$")}, {'name': "ndk_path", 'default': None, 'pattern': re.compile("^(?:ANDROID_NDK|ANDROID_STANDALONE_TOOLCHAIN)?:PATH=(.*)$")},
{'name': "arm_target", 'default': None, 'pattern': re.compile("^ARM_TARGET:INTERNAL=(.*)$")}, {'name': "android_abi", 'default': None, 'pattern': re.compile("^ANDROID_ABI:STRING=(.*)$")},
{'name': "android_executable", 'default': None, 'pattern': re.compile("^ANDROID_EXECUTABLE:FILEPATH=(.*android.*)$")}, {'name': "android_executable", 'default': None, 'pattern': re.compile("^ANDROID_EXECUTABLE:FILEPATH=(.*android.*)$")},
{'name': "is_x64", 'default': "OFF", 'pattern': re.compile("^CUDA_64_BIT_DEVICE_CODE:BOOL=(ON)$")},#ugly( {'name': "is_x64", 'default': "OFF", 'pattern': re.compile("^CUDA_64_BIT_DEVICE_CODE:BOOL=(ON)$")},#ugly(
{'name': "cmake_generator", 'default': None, 'pattern': re.compile("^CMAKE_GENERATOR:INTERNAL=(.+)$")}, {'name': "cmake_generator", 'default': None, 'pattern': re.compile("^CMAKE_GENERATOR:INTERNAL=(.+)$")},
@ -181,7 +181,7 @@ class RunInfo(object):
self.adb = None self.adb = None
# detect target platform # detect target platform
if self.android_executable or self.arm_target or self.ndk_path: if self.android_executable or self.android_abi or self.ndk_path:
self.targetos = "android" self.targetos = "android"
else: else:
self.targetos = hostos self.targetos = hostos
@ -405,7 +405,7 @@ class RunInfo(object):
if connected_devices > 1: if connected_devices > 1:
self.error = "Too many (%s) devices are connected. Single device is required. (for %s)" % (connected_devices, self.path) self.error = "Too many (%s) devices are connected. Single device is required. (for %s)" % (connected_devices, self.path)
return False return False
if "armeabi-v7a" in self.arm_target: if "armeabi-v7a" in self.android_abi:
adb_res = self.runAdb("shell", "cat /proc/cpuinfo") adb_res = self.runAdb("shell", "cat /proc/cpuinfo")
if not adb_res: if not adb_res:
self.error = "Could not get info about Android platform: %s (for %s)" % (self.error, self.path) self.error = "Could not get info about Android platform: %s (for %s)" % (self.error, self.path)
@ -413,8 +413,8 @@ class RunInfo(object):
if "ARMv7" not in adb_res: if "ARMv7" not in adb_res:
self.error = "Android device does not support ARMv7 commands, but tests are built for armeabi-v7a (for %s)" % self.path self.error = "Android device does not support ARMv7 commands, but tests are built for armeabi-v7a (for %s)" % self.path
return False return False
if "NEON" in self.arm_target and "neon" not in adb_res: if "NEON" in self.android_abi and "neon" not in adb_res:
self.error = "Android device has no NEON, but tests are built for %s (for %s)" % (self.arm_target, self.path) self.error = "Android device has no NEON, but tests are built for %s (for %s)" % (self.android_abi, self.path)
return False return False
hw = re.search(r"^Hardware[ \t]*:[ \t]*(.*?)$", adb_res, re.MULTILINE) hw = re.search(r"^Hardware[ \t]*:[ \t]*(.*?)$", adb_res, re.MULTILINE)
if hw: if hw:

View File

@ -3,7 +3,7 @@ SETLOCAL
PUSHD %~dp0 PUSHD %~dp0
SET PROJECT_NAME=hello-android SET PROJECT_NAME=hello-android
SET BUILD_DIR=build_armeabi SET BUILD_DIR=build_armeabi
SET ARM_TARGET=armeabi SET ANDROID_ABI=armeabi
CALL ..\..\..\android\scripts\build.cmd %* CALL ..\..\..\android\scripts\build.cmd %*
POPD POPD
ENDLOCAL ENDLOCAL