From 166bfdda45c29edfdfc3763fb89211455e2a1c58 Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Sat, 28 May 2011 18:42:58 +0000 Subject: [PATCH] Updated build scripts for HelloAndroid sample. --- android/apps/HelloAndroid/CMakeLists.txt | 22 ++++++++++++++++++++++ android/apps/HelloAndroid/cmake_android.sh | 2 +- android/apps/HelloAndroid/run.cmd | 5 ++++- android/apps/HelloAndroid/run.sh | 3 ++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/android/apps/HelloAndroid/CMakeLists.txt b/android/apps/HelloAndroid/CMakeLists.txt index 14f34619d0..c4c1d969f5 100644 --- a/android/apps/HelloAndroid/CMakeLists.txt +++ b/android/apps/HelloAndroid/CMakeLists.txt @@ -1,5 +1,9 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) +######################################################### +# Set project name +######################################################### + IF( NOT PROJECT_NAME ) IF ( NOT "x$ENV{PROJECT_NAME}" STREQUAL "x" ) SET( PROJECT_NAME $ENV{PROJECT_NAME} ) @@ -43,3 +47,21 @@ FILE( GLOB srcs "*.cpp" ) ADD_EXECUTABLE( ${PROJECT_NAME} ${srcs} ) TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${LIBRARY_DEPS} ) + +######################################################### +# Summary report +######################################################### +message( STATUS "") +message( STATUS "General configuration for ${PROJECT_NAME} =====================================") +message( STATUS "") +message( STATUS " OpenCV path: ${OpenCV_DIR}") +message( STATUS " Compiler: ${CMAKE_COMPILER}") +message( STATUS " C++ flags (Release): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") +message( STATUS " C++ flags (Debug): ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") +if(WIN32) +message( STATUS " Linker flags (Release): ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +message( STATUS " Linker flags (Debug): ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_DEBUG}") +else() +message( STATUS " Linker flags (Release): ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +message( STATUS " Linker flags (Debug): ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}") +endif() diff --git a/android/apps/HelloAndroid/cmake_android.sh b/android/apps/HelloAndroid/cmake_android.sh index 06338db594..d724bf23eb 100644 --- a/android/apps/HelloAndroid/cmake_android.sh +++ b/android/apps/HelloAndroid/cmake_android.sh @@ -3,7 +3,7 @@ cd `dirname $0` BUILD_DIR=build_armeabi opencv_android=`pwd`/../.. -opencv_build_dir=$opencv_android/build +opencv_build_dir=$opencv_android/$BUILD_DIR mkdir -p $BUILD_DIR cd $BUILD_DIR diff --git a/android/apps/HelloAndroid/run.cmd b/android/apps/HelloAndroid/run.cmd index 4175cb882a..774a64ddb7 100644 --- a/android/apps/HelloAndroid/run.cmd +++ b/android/apps/HelloAndroid/run.cmd @@ -25,8 +25,11 @@ IF NOT DEFINED ANDROID_SDK (ECHO. & ECHO You should set an environment variable (PUSHD "%ANDROID_SDK%" 2>NUL && POPD) || (ECHO. & ECHO Directory "%ANDROID_SDK%" specified by ANDROID_SDK variable does not exist & GOTO end) SET adb=%ANDROID_SDK%\platform-tools\adb.exe +::binary output path is different for emulator build +IF "%ARM_TARGET%"=="armeabi" (SET OUT_DIR=armeabi) ELSE (SET OUT_DIR=armeabi-v7a) + :: copy file to device (usually takes 10 seconds or more) -%adb% push .\bin\armeabi\%PROJECT_NAME% /data/bin/sample/%PROJECT_NAME% || GOTO end +%adb% push .\bin\%OUT_DIR%\%PROJECT_NAME% /data/bin/sample/%PROJECT_NAME% || GOTO end :: set execute permission %adb% shell chmod 777 /data/bin/sample/%PROJECT_NAME% || GOTO end diff --git a/android/apps/HelloAndroid/run.sh b/android/apps/HelloAndroid/run.sh index 8ac62b0abf..467a4a6a6d 100644 --- a/android/apps/HelloAndroid/run.sh +++ b/android/apps/HelloAndroid/run.sh @@ -1,9 +1,10 @@ #!/bin/sh cd `dirname $0` PROJECT_NAME=HelloAndroid +OUT_DIR=armeabi # copy file to device (usually takes 10 seconds or more) -adb push ./bin/armeabi/$PROJECT_NAME /data/bin/sample/$PROJECT_NAME || return +adb push ./bin/$OUT_DIR/$PROJECT_NAME /data/bin/sample/$PROJECT_NAME || return # set execute permission adb shell chmod 777 /data/bin/sample/$PROJECT_NAME || return