HelloAndroid sample is moved to samples/android
This commit is contained in:
parent
e005570719
commit
f8e42721d3
@ -1,9 +0,0 @@
|
||||
@ECHO OFF
|
||||
SETLOCAL
|
||||
PUSHD %~dp0
|
||||
SET PROJECT_NAME=HelloAndroid
|
||||
SET BUILD_DIR=build_armeabi
|
||||
SET ARM_TARGET=armeabi
|
||||
CALL ..\..\scripts\build.cmd %*
|
||||
POPD
|
||||
ENDLOCAL
|
@ -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 $@ ../..
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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)
|
9
samples/android/hello-android/cmake_android.cmd
Normal file
9
samples/android/hello-android/cmake_android.cmd
Normal file
@ -0,0 +1,9 @@
|
||||
@ECHO OFF
|
||||
SETLOCAL
|
||||
PUSHD %~dp0
|
||||
SET PROJECT_NAME=hello-android
|
||||
SET BUILD_DIR=build_armeabi
|
||||
SET ARM_TARGET=armeabi
|
||||
CALL ..\..\..\android\scripts\build.cmd %*
|
||||
POPD
|
||||
ENDLOCAL
|
@ -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
|
@ -15,12 +15,10 @@ SETLOCAL ENABLEEXTENSIONS || (ECHO Unable to enable command extensions. & EXIT \
|
||||
|
||||
PUSHD %~dp0
|
||||
:: project specific settings
|
||||
SET PROJECT_NAME=HelloAndroid
|
||||
SET BUILD_DIR=build_armeabi
|
||||
SET ARM_TARGET=armeabi
|
||||
SET PROJECT_NAME=hello-android
|
||||
|
||||
:: try to load config file
|
||||
SET CFG_PATH=..\..\scripts\wincfg.cmd
|
||||
SET CFG_PATH=..\..\..\android\scripts\wincfg.cmd
|
||||
IF EXIST %CFG_PATH% CALL %CFG_PATH%
|
||||
|
||||
:: check if sdk path defined
|
||||
@ -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)
|
||||
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\%OUT_DIR%\%PROJECT_NAME% /data/bin/sample/%PROJECT_NAME% || GOTO end
|
||||
%adb% push .\bin\%PROJECT_NAME% /data/bin/sample/%PROJECT_NAME% || GOTO end
|
||||
|
||||
:: set execute permission
|
||||
%adb% shell chmod 777 /data/bin/sample/%PROJECT_NAME% || GOTO end
|
||||
@ -51,4 +46,4 @@ GOTO end
|
||||
|
||||
:end
|
||||
POPD
|
||||
ENDLOCAL
|
||||
ENDLOCAL
|
@ -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
|
||||
adb pull /mnt/sdcard/HelloAndroid.png || return
|
Loading…
Reference in New Issue
Block a user