Instroduced separate option for Android examples - BUILD_ANDROID_EXAMPLES

pull/13383/head
Andrey Kamaev 14 years ago
parent 65cb53aa1e
commit d96f533784
  1. 17
      CMakeLists.txt
  2. 9
      modules/java/CMakeLists.txt
  3. 2
      samples/CMakeLists.txt
  4. 4
      samples/android/CMakeLists.txt

@ -668,7 +668,7 @@ if (PYTHON_EXECUTABLE AND ANDROID)
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)
@ -713,6 +713,10 @@ if (BUILD_JAVA_SUPPORT AND (BUILD_EXAMPLES OR BUILD_TESTS))
endif()
endif()
if(CAN_BUILD_ANDROID_PROJECTS)
option(BUILD_ANDROID_EXAMPLES "Build examples for Android platform" TRUE)
endif()
#YV
############################### QT ################################
@ -1441,7 +1445,7 @@ add_subdirectory(doc)
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()
@ -1509,6 +1513,11 @@ else()
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: ")
@ -1626,7 +1635,7 @@ status(" Examples:" BUILD_EXAMPLES THEN YES ELSE NO)
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
@ -1640,4 +1649,4 @@ status("")
# 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()
endif()

@ -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})
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})

@ -10,7 +10,7 @@ if(NOT ANDROID)
add_subdirectory(gpu)
endif()
if(ANDROID AND CAN_BUILD_ANDROID_PROJECTS)
if(BUILD_ANDROID_EXAMPLES)
add_subdirectory(android)
endif()

@ -3,7 +3,7 @@
#
# ----------------------------------------------------------------------------
if (BUILD_EXAMPLES)
if (BUILD_ANDROID_EXAMPLES)
project(android_samples)
include_directories(
@ -98,7 +98,7 @@ if (BUILD_EXAMPLES)
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}")

Loading…
Cancel
Save