Commit d96f5337 authored by Andrey Kamaev's avatar Andrey Kamaev

Instroduced separate option for Android examples - BUILD_ANDROID_EXAMPLES

parent 65cb53aa
...@@ -668,7 +668,7 @@ if (PYTHON_EXECUTABLE AND ANDROID) ...@@ -668,7 +668,7 @@ if (PYTHON_EXECUTABLE AND ANDROID)
option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE) option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE)
endif() endif()
if (BUILD_JAVA_SUPPORT AND (BUILD_EXAMPLES OR BUILD_TESTS)) if (BUILD_JAVA_SUPPORT)
file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH) file(TO_CMAKE_PATH "$ENV{ANT_DIR}" ANT_DIR_ENV_PATH)
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH)
...@@ -713,6 +713,10 @@ if (BUILD_JAVA_SUPPORT AND (BUILD_EXAMPLES OR BUILD_TESTS)) ...@@ -713,6 +713,10 @@ if (BUILD_JAVA_SUPPORT AND (BUILD_EXAMPLES OR BUILD_TESTS))
endif() endif()
endif() endif()
if(CAN_BUILD_ANDROID_PROJECTS)
option(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" TRUE)
endif()
#YV #YV
############################### QT ################################ ############################### QT ################################
...@@ -1441,7 +1445,7 @@ add_subdirectory(doc) ...@@ -1441,7 +1445,7 @@ add_subdirectory(doc)
add_subdirectory(data) add_subdirectory(data)
add_subdirectory(3rdparty) add_subdirectory(3rdparty)
if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES) if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
add_subdirectory(samples) add_subdirectory(samples)
endif() endif()
...@@ -1509,6 +1513,11 @@ else() ...@@ -1509,6 +1513,11 @@ else()
status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}) status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
endif() endif()
if(ANDROID)
status(" Floating point type:" ${ARM_TARGET})
status(" Native API level:" android-${ANDROID_API_LEVEL})
endif()
#YV #YV
status("") status("")
status(" GUI: ") status(" GUI: ")
...@@ -1626,7 +1635,7 @@ status(" Examples:" BUILD_EXAMPLES THEN YES ELSE NO) ...@@ -1626,7 +1635,7 @@ status(" Examples:" BUILD_EXAMPLES THEN YES ELSE NO)
if(ANDROID) if(ANDROID)
status(" Android tests:" BUILD_TESTS AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO) status(" Android tests:" BUILD_TESTS AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO)
status(" Android examples:" BUILD_EXAMPLES AND CAN_BUILD_ANDROID_PROJECTS THEN YES ELSE NO) status(" Android examples:" BUILD_ANDROID_EXAMPLES THEN YES ELSE NO)
endif() endif()
# auxiliary # auxiliary
...@@ -1640,4 +1649,4 @@ status("") ...@@ -1640,4 +1649,4 @@ status("")
# warn in the case of in-source build # warn in the case of in-source build
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree") message(WARNING "The source directory is the same as binary directory. \"make clean\" may damage the source tree")
endif() endif()
\ No newline at end of file
...@@ -64,8 +64,17 @@ FILE(GLOB handwrittren_cpp_sources "${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/*.cpp") ...@@ -64,8 +64,17 @@ FILE(GLOB handwrittren_cpp_sources "${CMAKE_CURRENT_SOURCE_DIR}/src/cpp/*.cpp")
add_library(${target} SHARED ${handwrittren_cpp_sources} ${generated_cpp_sources}) add_library(${target} SHARED ${handwrittren_cpp_sources} ${generated_cpp_sources})
target_link_libraries(${target} ${dependent_libs} ${dependent_extra_libs} ${OPENCV_LINKER_LIBS}) target_link_libraries(${target} ${dependent_libs} ${dependent_extra_libs} ${OPENCV_LINKER_LIBS})
if(ANDROID) if(ANDROID)
target_link_libraries(${target} jnigraphics) target_link_libraries(${target} jnigraphics)
# force strip library before install/strip command
# because samples and tests will make a copy of library before install
ADD_CUSTOM_COMMAND(
TARGET ${target}
POST_BUILD
COMMAND ${CMAKE_STRIP} "${LIBRARY_OUTPUT_PATH}/lib${target}.so"
)
endif() endif()
#add_dependencies(${the_target} ${dependent_extra_libs} ${dependent_libs}) #add_dependencies(${the_target} ${dependent_extra_libs} ${dependent_libs})
......
...@@ -10,7 +10,7 @@ if(NOT ANDROID) ...@@ -10,7 +10,7 @@ if(NOT ANDROID)
add_subdirectory(gpu) add_subdirectory(gpu)
endif() endif()
if(ANDROID AND CAN_BUILD_ANDROID_PROJECTS) if(BUILD_ANDROID_EXAMPLES)
add_subdirectory(android) add_subdirectory(android)
endif() endif()
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
if (BUILD_EXAMPLES) if (BUILD_ANDROID_EXAMPLES)
project(android_samples) project(android_samples)
include_directories( include_directories(
...@@ -98,7 +98,7 @@ if (BUILD_EXAMPLES) ...@@ -98,7 +98,7 @@ if (BUILD_EXAMPLES)
endforeach() endforeach()
#hello-android sample #hello-android sample
ADD_EXECUTABLE( hello-android hello-android/main.cpp ) ADD_EXECUTABLE(hello-android hello-android/main.cpp)
ADD_DEPENDENCIES(hello-android ${sample_dependencies}) ADD_DEPENDENCIES(hello-android ${sample_dependencies})
TARGET_LINK_LIBRARIES(hello-android ${OPENCV_LINKER_LIBS} ${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_target_properties(hello-android PROPERTIES OUTPUT_NAME hello-android RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment