android: enable C++11 in test sample

This commit is contained in:
Alexander Alekhin 2018-03-26 15:21:45 +03:00
parent d4688e6474
commit b07f772f36
2 changed files with 10 additions and 5 deletions

View File

@ -8,12 +8,17 @@ log.basicConfig(format='%(message)s', level=log.DEBUG)
CMAKE_TEMPLATE='''\
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
SET(PROJECT_NAME hello-android)
PROJECT(${PROJECT_NAME})
FIND_PACKAGE(OpenCV REQUIRED %(libset)s)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
FILE(GLOB srcs "*.cpp")
ADD_EXECUTABLE(${PROJECT_NAME} ${srcs})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OpenCV_LIBS} dl z)
'''
@ -28,9 +33,9 @@ int main(int argc, char* argv[])
{
(void)argc; (void)argv;
printf("%s\\n", message);
Size textsize = getTextSize(message, CV_FONT_HERSHEY_COMPLEX, 3, 5, 0);
Size textsize = getTextSize(message, FONT_HERSHEY_COMPLEX, 3, 5, 0);
Mat img(textsize.height + 20, textsize.width + 20, CV_32FC1, Scalar(230,230,230));
putText(img, message, Point(10, img.rows - 10), CV_FONT_HERSHEY_COMPLEX, 3, Scalar(0, 0, 0), 5);
putText(img, message, Point(10, img.rows - 10), FONT_HERSHEY_COMPLEX, 3, Scalar(0, 0, 0), 5);
imwrite("/mnt/sdcard/HelloAndroid.png", img);
return 0;
}

View File

@ -22,7 +22,7 @@ include $(BUILD_SHARED_LIBRARY)
TEMPLATE_APPLICATION_MK = '''\
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_CPPFLAGS := -frtti -fexceptions -std=c++11
APP_ABI := {abi}
APP_PLATFORM := android-9
'''