1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Global CMake reorganization:

[~] Automatically tracked dependencies between modules
 [+] Support for optional module dependencies
 [+] Options to choose modules to build
 [~] Removed hardcoded modules lists from OpenCVConfig.cmake, opencv.pc and OpenCV.mk
 [+] Added COMPONENTS support for FIND_PACKAGE(OpenCV)
 [~] haartraining and traincascade are moved outside of modules folder since they aren't the modules
This commit is contained in:
Andrey Kamaev
2012-02-03 11:26:49 +00:00
parent ada9158521
commit 984eb99428
96 changed files with 2722 additions and 2103 deletions
+22 -35
View File
@@ -2,46 +2,33 @@
# CMake file for Android samples. See root CMakeLists.txt
#
# ----------------------------------------------------------------------------
SET(OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core)
if (BUILD_ANDROID_EXAMPLES)
project(android_samples)
ocv_check_dependencies(${OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS} opencv_java)
include_directories(
"${CMAKE_SOURCE_DIR}/modules/core/include"
"${CMAKE_SOURCE_DIR}/modules/flann/include"
"${CMAKE_SOURCE_DIR}/modules/imgproc/include"
"${CMAKE_SOURCE_DIR}/modules/video/include"
"${CMAKE_SOURCE_DIR}/modules/highgui/include"
"${CMAKE_SOURCE_DIR}/modules/ml/include"
"${CMAKE_SOURCE_DIR}/modules/calib3d/include"
"${CMAKE_SOURCE_DIR}/modules/features2d/include"
"${CMAKE_SOURCE_DIR}/modules/objdetect/include"
"${CMAKE_SOURCE_DIR}/modules/legacy/include"
"${CMAKE_SOURCE_DIR}/modules/contrib/include"
)
if(BUILD_ANDROID_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
project(android_samples)
SET (sample_dependencies opencv_contrib opencv_legacy opencv_objdetect opencv_calib3d opencv_features2d opencv_video opencv_highgui opencv_ml opencv_imgproc opencv_flann opencv_core)
if(NOT BUILD_SHARED_LIBS)
LIST(APPEND sample_dependencies opencv_androidcamera)
endif()
foreach(m ${OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS})
string(REPLACE "opencv_" "" m "${m}")
include_directories("${OpenCV_SOURCE_DIR}/modules/${m}/include")
endforeach()
file(GLOB android_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
list(REMOVE_ITEM android_samples hello-android)
list(SORT android_samples)
file(GLOB android_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
list(REMOVE_ITEM android_samples hello-android)
list(SORT android_samples)
foreach(sample ${android_samples})
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${sample}/AndroidManifest.xml")
add_android_project("${sample}" "${CMAKE_CURRENT_SOURCE_DIR}/${sample}" INSTALL)
endif()
endforeach()
#hello-android sample
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}")
if(INSTALL_ANDROID_EXAMPLES)
install(TARGETS hello-android DESTINATION bin COMPONENT main)
foreach(sample ${android_samples})
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${sample}/AndroidManifest.xml")
add_android_project("${sample}" "${CMAKE_CURRENT_SOURCE_DIR}/${sample}" INSTALL)
endif()
endforeach()
#hello-android sample
ADD_EXECUTABLE(hello-android hello-android/main.cpp)
TARGET_LINK_LIBRARIES(hello-android ${OPENCV_LINKER_LIBS} ${OPENCV_ANDROID_SAMPLES_REQUIRED_DEPS})
set_target_properties(hello-android PROPERTIES OUTPUT_NAME hello-android RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}")
if(INSTALL_ANDROID_EXAMPLES)
install(TARGETS hello-android DESTINATION bin COMPONENT main)
endif()
endif()