+++ /dev/null
-@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
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 $@ ../..
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})
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()
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")
# Find OpenCV
#########################################################
-SET( OpenCV_DIR ${CMAKE_SOURCE_DIR}/../../build CACHE PATH "The path where you built opencv for android" )
FIND_PACKAGE( OpenCV REQUIRED )
#########################################################
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)
--- /dev/null
+@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
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
\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
(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
\r
:end\r
POPD\r
-ENDLOCAL
\ No newline at end of file
+ENDLOCAL\r
#!/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
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