option(BUILD_JAVA_SUPPORT "Build with Java support" TRUE)
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{ProgramFiles}" ProgramFiles_ENV_PATH)
endif()
endif()
+if(CAN_BUILD_ANDROID_PROJECTS)
+ option(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" TRUE)
+endif()
+
#YV
############################### QT ################################
add_subdirectory(data)
add_subdirectory(3rdparty)
-if(BUILD_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
+if(BUILD_EXAMPLES OR BUILD_ANDROID_EXAMPLES OR INSTALL_PYTHON_EXAMPLES)
add_subdirectory(samples)
endif()
status(" Linker flags (Debug):" ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS_DEBUG})
endif()
+if(ANDROID)
+ status(" Floating point type:" ${ARM_TARGET})
+ status(" Native API level:" android-${ANDROID_API_LEVEL})
+endif()
+
#YV
status("")
status(" GUI: ")
if(ANDROID)
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()
# auxiliary
# warn in the case of in-source build
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")
-endif()
\ No newline at end of file
+endif()
add_library(${target} SHARED ${handwrittren_cpp_sources} ${generated_cpp_sources})
target_link_libraries(${target} ${dependent_libs} ${dependent_extra_libs} ${OPENCV_LINKER_LIBS})
+
if(ANDROID)
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()
#add_dependencies(${the_target} ${dependent_extra_libs} ${dependent_libs})
#
# ----------------------------------------------------------------------------
-if (BUILD_EXAMPLES)
+if (BUILD_ANDROID_EXAMPLES)
project(android_samples)
include_directories(
endforeach()
#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})
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}")