HelloAndroid sample is moved to samples/android
authorAndrey Kamaev <no@email>
Fri, 1 Jul 2011 13:12:05 +0000 (13:12 +0000)
committerAndrey Kamaev <no@email>
Fri, 1 Jul 2011 13:12:05 +0000 (13:12 +0000)
android/apps/HelloAndroid/cmake_android.cmd [deleted file]
android/scripts/cmake_android_armeabi.sh
samples/android/CMakeLists.txt
samples/android/hello-android/CMakeLists.txt [moved from android/apps/HelloAndroid/CMakeLists.txt with 91% similarity]
samples/android/hello-android/cmake_android.cmd [new file with mode: 0644]
samples/android/hello-android/cmake_android.sh [moved from android/apps/HelloAndroid/cmake_android.sh with 88% similarity]
samples/android/hello-android/main.cpp [moved from android/apps/HelloAndroid/main.cpp with 100% similarity]
samples/android/hello-android/run.cmd [moved from android/apps/HelloAndroid/run.cmd with 77% similarity]
samples/android/hello-android/run.sh [moved from android/apps/HelloAndroid/run.sh with 62% similarity]

diff --git a/android/apps/HelloAndroid/cmake_android.cmd b/android/apps/HelloAndroid/cmake_android.cmd
deleted file mode 100644 (file)
index e43e390..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-@ECHO OFF\r
-SETLOCAL\r
-PUSHD %~dp0\r
-SET PROJECT_NAME=HelloAndroid\r
-SET BUILD_DIR=build_armeabi\r
-SET ARM_TARGET=armeabi\r
-CALL ..\..\scripts\build.cmd %*\r
-POPD\r
-ENDLOCAL
\ No newline at end of file
index 3e6ee1d..961c9d6 100644 (file)
@@ -4,5 +4,5 @@ cd `dirname $0`/..
 mkdir -p 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 -DARM_TARGET=armeabi -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../..
 
index 692a73e..7ed8686 100644 (file)
@@ -85,6 +85,7 @@ if (BUILD_EXAMPLES)
     endmacro()
 
     file(GLOB android_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
+    list(REMOVE_ITEM android_samples hello-android)
     list(SORT android_samples)
 
     foreach(sample ${android_samples})
@@ -93,5 +94,12 @@ if (BUILD_EXAMPLES)
         endif()
     endforeach()
 
+    #hello-android sample
+    ADD_EXECUTABLE( hello-android hello-android/main.cpp )
+    ADD_DEPENDENCIES(hello-android ${sample_dependencies})
+    TARGET_LINK_LIBRARIES(hello-android ${OPENCV_LINKER_LIBS} ${sample_dependencies})
+    set_target_properties(hello-android PROPERTIES OUTPUT_NAME hello-android RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
+
+
     set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${additional_clean_files}")
 endif()
similarity index 91%
rename from android/apps/HelloAndroid/CMakeLists.txt
rename to samples/android/hello-android/CMakeLists.txt
index c4c1d96..032d983 100644 (file)
@@ -8,7 +8,7 @@ IF( NOT PROJECT_NAME )
   IF ( NOT "x$ENV{PROJECT_NAME}" STREQUAL "x" )
     SET( PROJECT_NAME $ENV{PROJECT_NAME} )
   ELSE()
-    SET( PROJECT_NAME HelloAndroid )
+    SET( PROJECT_NAME hello-android )
   ENDIF()
 ENDIF()
 SET( PROJECT_NAME ${PROJECT_NAME} CACHE STRING "The name of your project")
@@ -19,7 +19,6 @@ PROJECT( ${PROJECT_NAME} )
 # Find OpenCV
 #########################################################
 
-SET( OpenCV_DIR ${CMAKE_SOURCE_DIR}/../../build CACHE PATH "The path where you built opencv for android" )
 FIND_PACKAGE( OpenCV REQUIRED )
 
 #########################################################
@@ -55,7 +54,7 @@ message( STATUS "")
 message( STATUS "General configuration for ${PROJECT_NAME} =====================================")
 message( STATUS "")
 message( STATUS "    OpenCV path:                ${OpenCV_DIR}")
-message( STATUS "    Compiler:                   ${CMAKE_COMPILER}")
+message( STATUS "    Compiler:                   ${CMAKE_CXX_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)
diff --git a/samples/android/hello-android/cmake_android.cmd b/samples/android/hello-android/cmake_android.cmd
new file mode 100644 (file)
index 0000000..e9daa27
--- /dev/null
@@ -0,0 +1,9 @@
+@ECHO OFF\r
+SETLOCAL\r
+PUSHD %~dp0\r
+SET PROJECT_NAME=hello-android\r
+SET BUILD_DIR=build_armeabi\r
+SET ARM_TARGET=armeabi\r
+CALL ..\..\..\android\scripts\build.cmd %*\r
+POPD\r
+ENDLOCAL\r
similarity index 88%
rename from android/apps/HelloAndroid/cmake_android.sh
rename to samples/android/hello-android/cmake_android.sh
index d724bf2..f233e30 100644 (file)
@@ -2,7 +2,7 @@
 cd `dirname $0`
 
 BUILD_DIR=build_armeabi
-opencv_android=`pwd`/../..
+opencv_android=`pwd`/../../../android
 opencv_build_dir=$opencv_android/$BUILD_DIR
 
 mkdir -p $BUILD_DIR
similarity index 77%
rename from android/apps/HelloAndroid/run.cmd
rename to samples/android/hello-android/run.cmd
index f54b826..717d56d 100644 (file)
@@ -15,12 +15,10 @@ SETLOCAL ENABLEEXTENSIONS || (ECHO Unable to enable command extensions. & EXIT \
 \r
 PUSHD %~dp0\r
 :: project specific settings\r
-SET PROJECT_NAME=HelloAndroid\r
-SET BUILD_DIR=build_armeabi\r
-SET ARM_TARGET=armeabi\r
+SET PROJECT_NAME=hello-android\r
 \r
 :: try to load config file\r
-SET CFG_PATH=..\..\scripts\wincfg.cmd\r
+SET CFG_PATH=..\..\..\android\scripts\wincfg.cmd\r
 IF EXIST %CFG_PATH% CALL %CFG_PATH%\r
 \r
 :: check if sdk path defined\r
@@ -28,11 +26,8 @@ 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)\r
 SET adb=%ANDROID_SDK%\platform-tools\adb.exe\r
 \r
-::binary output path is different for emulator build\r
-IF "%ARM_TARGET%"=="armeabi" (SET OUT_DIR=armeabi) ELSE (SET OUT_DIR=armeabi-v7a)\r
-\r
 :: copy file to device (usually takes 10 seconds or more)\r
-%adb% push .\bin\%OUT_DIR%\%PROJECT_NAME% /data/bin/sample/%PROJECT_NAME% || GOTO end\r
+%adb% push .\bin\%PROJECT_NAME% /data/bin/sample/%PROJECT_NAME% || GOTO end\r
 \r
 :: set execute permission\r
 %adb% shell chmod 777 /data/bin/sample/%PROJECT_NAME% || GOTO end\r
@@ -51,4 +46,4 @@ GOTO end
 \r
 :end\r
 POPD\r
-ENDLOCAL
\ No newline at end of file
+ENDLOCAL\r
similarity index 62%
rename from android/apps/HelloAndroid/run.sh
rename to samples/android/hello-android/run.sh
index 467a4a6..1168c51 100644 (file)
@@ -1,10 +1,9 @@
 #!/bin/sh
 cd `dirname $0`
-PROJECT_NAME=HelloAndroid
-OUT_DIR=armeabi
+PROJECT_NAME=hello-android
 
 # copy file to device (usually takes 10 seconds or more)
-adb push ./bin/$OUT_DIR/$PROJECT_NAME /data/bin/sample/$PROJECT_NAME || return
+adb push ./bin/$PROJECT_NAME /data/bin/sample/$PROJECT_NAME || return
 
 # set execute permission
 adb shell chmod 777 /data/bin/sample/$PROJECT_NAME || return
@@ -13,4 +12,4 @@ adb shell chmod 777 /data/bin/sample/$PROJECT_NAME || return
 adb shell /data/bin/sample/$PROJECT_NAME || return
 
 # get image result from device
-adb pull /mnt/sdcard/HelloAndroid.png || return
\ No newline at end of file
+adb pull /mnt/sdcard/HelloAndroid.png || return