mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
Updated build scripts for HelloAndroid sample.
This commit is contained in:
parent
eadb3bad45
commit
166bfdda45
@ -1,5 +1,9 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
# Set project name
|
||||||
|
#########################################################
|
||||||
|
|
||||||
IF( NOT PROJECT_NAME )
|
IF( NOT PROJECT_NAME )
|
||||||
IF ( NOT "x$ENV{PROJECT_NAME}" STREQUAL "x" )
|
IF ( NOT "x$ENV{PROJECT_NAME}" STREQUAL "x" )
|
||||||
SET( PROJECT_NAME $ENV{PROJECT_NAME} )
|
SET( PROJECT_NAME $ENV{PROJECT_NAME} )
|
||||||
@ -43,3 +47,21 @@ FILE( GLOB srcs "*.cpp" )
|
|||||||
|
|
||||||
ADD_EXECUTABLE( ${PROJECT_NAME} ${srcs} )
|
ADD_EXECUTABLE( ${PROJECT_NAME} ${srcs} )
|
||||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${LIBRARY_DEPS} )
|
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()
|
||||||
|
@ -3,7 +3,7 @@ cd `dirname $0`
|
|||||||
|
|
||||||
BUILD_DIR=build_armeabi
|
BUILD_DIR=build_armeabi
|
||||||
opencv_android=`pwd`/../..
|
opencv_android=`pwd`/../..
|
||||||
opencv_build_dir=$opencv_android/build
|
opencv_build_dir=$opencv_android/$BUILD_DIR
|
||||||
|
|
||||||
mkdir -p $BUILD_DIR
|
mkdir -p $BUILD_DIR
|
||||||
cd $BUILD_DIR
|
cd $BUILD_DIR
|
||||||
|
@ -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)
|
(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
|
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)
|
:: 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
|
:: set execute permission
|
||||||
%adb% shell chmod 777 /data/bin/sample/%PROJECT_NAME% || GOTO end
|
%adb% shell chmod 777 /data/bin/sample/%PROJECT_NAME% || GOTO end
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd `dirname $0`
|
cd `dirname $0`
|
||||||
PROJECT_NAME=HelloAndroid
|
PROJECT_NAME=HelloAndroid
|
||||||
|
OUT_DIR=armeabi
|
||||||
|
|
||||||
# copy file to device (usually takes 10 seconds or more)
|
# 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
|
# set execute permission
|
||||||
adb shell chmod 777 /data/bin/sample/$PROJECT_NAME || return
|
adb shell chmod 777 /data/bin/sample/$PROJECT_NAME || return
|
||||||
|
Loading…
Reference in New Issue
Block a user