From b28b2428f6d32faad1d194703dd7f3fab6670549 Mon Sep 17 00:00:00 2001 From: Marina Kolpakova Date: Thu, 28 Jun 2012 17:23:50 +0000 Subject: [PATCH] changing package layout after 'make install' for Android build --- 3rdparty/libjasper/CMakeLists.txt | 4 +- 3rdparty/libjpeg/CMakeLists.txt | 4 +- 3rdparty/libpng/CMakeLists.txt | 4 +- 3rdparty/libtiff/CMakeLists.txt | 4 +- 3rdparty/tbb/CMakeLists.txt | 4 +- 3rdparty/zlib/CMakeLists.txt | 4 +- CMakeLists.txt | 26 ++++++++++--- android/scripts/cmake_android.cmd | 2 +- android/scripts/cmake_android.sh | 2 +- cmake/OpenCVDetectAndroidSDK.cmake | 29 ++++++++++++-- cmake/OpenCVGenAndroidMK.cmake | 10 +++-- cmake/OpenCVGenConfig.cmake | 39 +++++++------------ cmake/OpenCVGenHeaders.cmake | 2 +- cmake/OpenCVGenPkgconfig.cmake | 2 +- cmake/OpenCVModule.cmake | 2 +- cmake/templates/OpenCV.mk.in | 15 +++---- cmake/templates/OpenCVConfig.cmake.in | 11 ++++-- data/CMakeLists.txt | 7 +++- include/CMakeLists.txt | 4 +- modules/gpu/CMakeLists.txt | 2 +- modules/highgui/src/window_gtk.cpp | 2 +- modules/java/CMakeLists.txt | 14 +++++-- modules/java/android_test/CMakeLists.txt | 1 + samples/CMakeLists.txt | 2 +- samples/android/face-detection/jni/Android.mk | 13 ++----- .../android/tutorial-3-native/jni/Android.mk | 11 +----- .../android/tutorial-4-mixed/jni/Android.mk | 12 +----- samples/c/CMakeLists.txt | 8 ++-- samples/cpp/CMakeLists.txt | 10 ++--- samples/gpu/CMakeLists.txt | 10 ++--- samples/gpu/performance/CMakeLists.txt | 8 ++-- 31 files changed, 146 insertions(+), 122 deletions(-) diff --git a/3rdparty/libjasper/CMakeLists.txt b/3rdparty/libjasper/CMakeLists.txt index ab505d505f..5b850c9dd8 100644 --- a/3rdparty/libjasper/CMakeLists.txt +++ b/3rdparty/libjasper/CMakeLists.txt @@ -36,7 +36,7 @@ set_target_properties(${JASPER_LIBRARY} PROPERTIES OUTPUT_NAME ${JASPER_LIBRARY} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" + ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} ) if(ENABLE_SOLUTION_FOLDERS) @@ -44,6 +44,6 @@ if(ENABLE_SOLUTION_FOLDERS) endif() if(NOT BUILD_SHARED_LIBS) - install(TARGETS ${JASPER_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + install(TARGETS ${JASPER_LIBRARY} ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main) endif() diff --git a/3rdparty/libjpeg/CMakeLists.txt b/3rdparty/libjpeg/CMakeLists.txt index 46eaab105f..708e63e25b 100644 --- a/3rdparty/libjpeg/CMakeLists.txt +++ b/3rdparty/libjpeg/CMakeLists.txt @@ -30,7 +30,7 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow -Wunused) set_target_properties(${JPEG_LIBRARY} PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH} + ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} ) if(ENABLE_SOLUTION_FOLDERS) @@ -38,5 +38,5 @@ if(ENABLE_SOLUTION_FOLDERS) endif() if(NOT BUILD_SHARED_LIBS) - install(TARGETS ${JPEG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + install(TARGETS ${JPEG_LIBRARY} ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main) endif() diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index bfbf501159..41d57f325b 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -26,7 +26,7 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align) set_target_properties(${PNG_LIBRARY} PROPERTIES OUTPUT_NAME ${PNG_LIBRARY} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" + ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} ) if(ENABLE_SOLUTION_FOLDERS) @@ -34,5 +34,5 @@ if(ENABLE_SOLUTION_FOLDERS) endif() if(NOT BUILD_SHARED_LIBS) - install(TARGETS ${PNG_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + install(TARGETS ${PNG_LIBRARY} ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main) endif() diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 991df08fed..ed9d1c86b7 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -102,7 +102,7 @@ set_target_properties(${TIFF_LIBRARY} PROPERTIES OUTPUT_NAME "${TIFF_LIBRARY}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" + ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} ) if(ENABLE_SOLUTION_FOLDERS) @@ -110,5 +110,5 @@ if(ENABLE_SOLUTION_FOLDERS) endif() if(NOT BUILD_SHARED_LIBS) - install(TARGETS ${TIFF_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + install(TARGETS ${TIFF_LIBRARY} ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main) endif() diff --git a/3rdparty/tbb/CMakeLists.txt b/3rdparty/tbb/CMakeLists.txt index 63d645585a..cf26ff02db 100644 --- a/3rdparty/tbb/CMakeLists.txt +++ b/3rdparty/tbb/CMakeLists.txt @@ -128,7 +128,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/a set_target_properties(tbb PROPERTIES OUTPUT_NAME tbb DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" + ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} ) if(ENABLE_SOLUTION_FOLDERS) @@ -136,7 +136,7 @@ if(ENABLE_SOLUTION_FOLDERS) endif() if(NOT BUILD_SHARED_LIBS) - install(TARGETS tbb ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + install(TARGETS tbb ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main) endif() # get TBB version diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index f4315e7686..17bfab49f0 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -87,7 +87,7 @@ ocv_warnings_disable(CMAKE_C_FLAGS /wd4013 -Wattributes -Wstrict-prototypes -Wmi set_target_properties(${ZLIB_LIBRARY} PROPERTIES OUTPUT_NAME ${ZLIB_LIBRARY} DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}" + ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} ) if(ENABLE_SOLUTION_FOLDERS) @@ -95,7 +95,7 @@ if(ENABLE_SOLUTION_FOLDERS) endif() if(NOT BUILD_SHARED_LIBS) - install(TARGETS ${ZLIB_LIBRARY} ARCHIVE DESTINATION share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH} COMPONENT main) + install(TARGETS ${ZLIB_LIBRARY} ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT main) endif() ocv_parse_header2(ZLIB "${CMAKE_CURRENT_SOURCE_DIR}/zlib.h" ZLIB_VERSION PARENT_SCOPE) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37e29ad3e2..94bad953df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,8 @@ if(NOT CMAKE_TOOLCHAIN_FILE) else(NOT CMAKE_TOOLCHAIN_FILE) #Android: set output folder to ${CMAKE_BINARY_DIR} set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_BINARY_DIR} CACHE PATH "root for library output, set this to change where android libs are compiled to" ) + # any crosscompiling + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") endif(NOT CMAKE_TOOLCHAIN_FILE) # -------------------------------------------------------------- @@ -218,7 +220,6 @@ include(cmake/OpenCVVersion.cmake REQUIRED) # ---------------------------------------------------------------------------- # Save libs and executables in the same place -set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib" CACHE PATH "Output directory for libraries" ) set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Output directory for applications" ) if(ANDROID OR WIN32) @@ -230,17 +231,32 @@ else() endif() if(ANDROID) - set(OPENCV_LIB_INSTALL_PATH libs/${ANDROID_NDK_ABI_NAME}) + set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}") + set(3P_LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/3rdparty/lib/${ANDROID_NDK_ABI_NAME}") + set(OPENCV_LIB_INSTALL_PATH sdk/native/libs/${ANDROID_NDK_ABI_NAME}) + set(OPENCV_3P_LIB_INSTALL_PATH sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME}) + set(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni) + set(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include) else() - set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) + set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib") + set(3P_LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}") + set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) + set(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}) + set(OPENCV_INCLUDE_INSTALL_PATH include) + + math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}") + if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX) + set(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/cmake/opencv) + else() + set(OPENCV_CONFIG_INSTALL_PATH share/OpenCV) + endif() endif() set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}") set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -set(OPENCV_INCLUDE_PREFIX include) if(INSTALL_TO_MANGLED_PATHS) - set(OPENCV_INCLUDE_PREFIX include/opencv-${OPENCV_VERSION}) + set(OPENCV_INCLUDE_INSTALL_PATH ${OPENCV_INCLUDE_INSTALL_PATH}/opencv-${OPENCV_VERSION}) endif() if(WIN32) diff --git a/android/scripts/cmake_android.cmd b/android/scripts/cmake_android.cmd index dc9e260441..3e6d923953 100644 --- a/android/scripts/cmake_android.cmd +++ b/android/scripts/cmake_android.cmd @@ -1,5 +1,5 @@ @ECHO OFF PUSHD %~dp0.. -CALL .\scripts\build.cmd %* +CALL .\scripts\build.cmd %* -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON POPD \ No newline at end of file diff --git a/android/scripts/cmake_android.sh b/android/scripts/cmake_android.sh index f2cbe481e9..101ba3cee8 100644 --- a/android/scripts/cmake_android.sh +++ b/android/scripts/cmake_android.sh @@ -4,5 +4,5 @@ cd `dirname $0`/.. mkdir -p build cd build -cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../.. +cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../.. diff --git a/cmake/OpenCVDetectAndroidSDK.cmake b/cmake/OpenCVDetectAndroidSDK.cmake index b1b7c768e4..95b5d69101 100644 --- a/cmake/OpenCVDetectAndroidSDK.cmake +++ b/cmake/OpenCVDetectAndroidSDK.cmake @@ -218,7 +218,7 @@ macro(add_android_project target path) # get project sources file(GLOB_RECURSE android_proj_files RELATIVE "${path}" "${path}/res/*" "${path}/src/*") - ocv_list_filterout(android_proj_files ".svn") + ocv_list_filterout(android_proj_files "\\\\.svn") # copy sources out from the build tree set(android_proj_file_deps "") @@ -257,7 +257,7 @@ macro(add_android_project target path) # build native part file(GLOB_RECURSE android_proj_jni_files "${path}/jni/*.c" "${path}/jni/*.h" "${path}/jni/*.cpp" "${path}/jni/*.hpp") - ocv_list_filterout(android_proj_jni_files ".svn") + ocv_list_filterout(android_proj_jni_files "\\\\.svn") if(android_proj_jni_files AND EXISTS ${path}/jni/Android.mk AND NOT DEFINED JNI_LIB_NAME) file(STRINGS "${path}/jni/Android.mk" JNI_LIB_NAME REGEX "LOCAL_MODULE[ ]*:=[ ]*.*" ) @@ -313,7 +313,30 @@ macro(add_android_project target path) # put the final .apk to the OpenCV's bin folder add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${android_proj_bin_dir}/bin/${target}-debug.apk" "${OpenCV_BINARY_DIR}/bin/${target}.apk") if(INSTALL_ANDROID_EXAMPLES AND "${target}" MATCHES "^example-") - install(FILES "${OpenCV_BINARY_DIR}/bin/${target}.apk" DESTINATION "bin" COMPONENT main) + #apk + install(FILES "${OpenCV_BINARY_DIR}/bin/${target}.apk" DESTINATION "samples" COMPONENT main) + get_filename_component(sample_dir "${path}" NAME) + #java part + foreach(f ${android_proj_files} ${ANDROID_MANIFEST_FILE}) + get_filename_component(install_subdir "${f}" PATH) + install(FILES "${android_proj_bin_dir}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT main) + endforeach() + #jni part + eclipse files + file(GLOB_RECURSE jni_files RELATIVE "${path}" "${path}/jni/*") + ocv_list_filterout(jni_files "\\\\.svn") + foreach(f ${jni_files} ".classpath" ".project" ".settings/org.eclipse.jdt.core.prefs") + get_filename_component(install_subdir "${f}" PATH) + install(FILES "${path}/${f}" DESTINATION "samples/${sample_dir}/${install_subdir}" COMPONENT main) + endforeach() + #update proj + if(android_proj_lib_deps_commands) + set(inst_lib_opt " --library ../../sdk/java") + endif() + install(CODE "EXECUTE_PROCESS(COMMAND ${ANDROID_EXECUTABLE} --silent update project --path . --target \"${android_proj_sdk_target}\" --name \"${target}\" ${inst_lib_opt} + WORKING_DIRECTORY \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}\" + )" COMPONENT main) + #empty 'gen' + install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/samples/${sample_dir}/gen\")" COMPONENT main) endif() endif() endmacro() diff --git a/cmake/OpenCVGenAndroidMK.cmake b/cmake/OpenCVGenAndroidMK.cmake index 0056d86c00..b2206f500f 100644 --- a/cmake/OpenCVGenAndroidMK.cmake +++ b/cmake/OpenCVGenAndroidMK.cmake @@ -82,17 +82,19 @@ if(ANDROID) # ------------------------------------------------------------------------------------------- set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"") set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "\"${OpenCV_SOURCE_DIR}\"") - set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)") + set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/lib/\$(TARGET_ARCH_ABI)") + set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/3rdparty/lib/\$(TARGET_ARCH_ABI)") configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/OpenCV.mk" IMMEDIATE @ONLY) # ------------------------------------------------------------------------------------------- # Part 2/2: ${BIN_DIR}/unix-install/OpenCV.mk -> For use with "make install" # ------------------------------------------------------------------------------------------- - set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/../../include/opencv\" \"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/../../include\"") + set(OPENCV_INCLUDE_DIRS_CONFIGCMAKE "\"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/include/opencv\" \"\$(LOCAL_PATH)/\$(OPENCV_THIS_DIR)/include\"") set(OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE "") - set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../..") + set(OPENCV_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../libs/\$(TARGET_ARCH_ABI)") + set(OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE "\$(OPENCV_THIS_DIR)/../3rdparty/libs/\$(TARGET_ARCH_ABI)") configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCV.mk.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk" IMMEDIATE @ONLY) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION share/OpenCV/) + install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCV.mk DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}) endif(ANDROID) diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake index 0db9cdfe7c..7a38e4b4e1 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake @@ -29,6 +29,8 @@ else() set(OpenCV_ADD_DEBUG_RELEASE_CONFIGCMAKE FALSE) endif() + + if(WIN32) if(MINGW) set(OPENCV_LINK_LIBRARY_SUFFIX ".dll.a") @@ -85,7 +87,7 @@ ocv_generate_dependencies_map_configcmake(DBG Debug) # ------------------------------------------------------------------------------------------- set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"${OPENCV_CONFIG_FILE_INCLUDE_DIR}\" \"${OpenCV_SOURCE_DIR}/include\" \"${OpenCV_SOURCE_DIR}/include/opencv\"") set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"${LIBRARY_OUTPUT_PATH}\"") -set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"${CMAKE_BINARY_DIR}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") +set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"${3P_LIBRARY_OUTPUT_PATH}\"") set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "") foreach(m ${OPENCV_MODULES_BUILD}) @@ -107,18 +109,14 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake. # -------------------------------------------------------------------------------------------- # Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install" # ------------------------------------------------------------------------------------------- -set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_PREFIX}/opencv" "\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_PREFIX}\"") +set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}/opencv" "\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_INSTALL_PATH}\"") set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"") -if(ANDROID) - set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/libs/\${ANDROID_NDK_ABI_NAME}\"") - set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/libs/\${ANDROID_NDK_ABI_NAME}\"") -else() - set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"") - set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") - if(INSTALL_TO_MANGLED_PATHS) - set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/share/OpenCV-${OPENCV_VERSION}/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") - endif() +set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_LIB_INSTALL_PATH}\"") +set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"") +if(INSTALL_TO_MANGLED_PATHS) + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "${OPENCV_3P_LIB_INSTALL_PATH}") + set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE}\"") endif() configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY) @@ -131,24 +129,17 @@ if(UNIX) # /(share|lib)/cmake/*/ (U) # /(share|lib)/*/ (U) # /(share|lib)/*/(cmake|CMake)/ (U) - math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}") - if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX) - set(OPENCV_CONFIG_INSTALL_PREFIX lib${LIB_SUFFIX}/cmake/opencv) - else() - set(OPENCV_CONFIG_INSTALL_PREFIX share/OpenCV) - endif() - if(INSTALL_TO_MANGLED_PATHS) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PREFIX}-${OPENCV_VERSION}/) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PREFIX}-${OPENCV_VERSION}/) + install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/) + install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/) else() - install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PREFIX}/) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PREFIX}/) + install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/) + install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/) endif() endif() if(ANDROID) - install(FILES "${OpenCV_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PREFIX}/) + install(FILES "${OpenCV_SOURCE_DIR}/android/android.toolchain.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/) endif() # -------------------------------------------------------------------------------------------- @@ -158,7 +149,7 @@ if(WIN32) set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\"") set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"") set(OpenCV_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/${OPENCV_LIB_INSTALL_PATH}\"") - set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}\"") + set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"") exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL) configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/win-install/OpenCVConfig.cmake" IMMEDIATE @ONLY) diff --git a/cmake/OpenCVGenHeaders.cmake b/cmake/OpenCVGenHeaders.cmake index e37f43632e..d2d38c90a7 100644 --- a/cmake/OpenCVGenHeaders.cmake +++ b/cmake/OpenCVGenHeaders.cmake @@ -33,4 +33,4 @@ set(OPENCV_MODULE_DEFINITIONS_CONFIGMAKE "${OPENCV_MODULE_DEFINITIONS_CONFIGMAKE #endforeach() configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/opencv_modules.hpp.in" "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp") -install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2 COMPONENT main) +install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT main) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 045bbb4815..49d6707345 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -11,7 +11,7 @@ set(prefix "${CMAKE_INSTALL_PREFIX}") set(exec_prefix "\${prefix}") set(libdir "") #TODO: need link paths for OpenCV_EXTRA_COMPONENTS -set(includedir "\${prefix}/${OPENCV_INCLUDE_PREFIX}") +set(includedir "\${prefix}/${OPENCV_INCLUDE_INSTALL_PATH}") set(VERSION ${OPENCV_VERSION}) if(CMAKE_BUILD_TYPE MATCHES "Release") diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake index 573d7eb857..543f9970b6 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake @@ -496,7 +496,7 @@ macro(ocv_create_module) foreach(hdr ${OPENCV_MODULE_${the_module}_HEADERS}) string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}") if(hdr2 MATCHES "^(opencv2/.*)/[^/]+.h(..)?$") - install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_PREFIX}/${CMAKE_MATCH_1}" COMPONENT main) + install(FILES ${hdr} DESTINATION "${OPENCV_INCLUDE_INSTALL_PATH}/${CMAKE_MATCH_1}" COMPONENT main) endif() endforeach() endif() diff --git a/cmake/templates/OpenCV.mk.in b/cmake/templates/OpenCV.mk.in index 1120f206eb..e99b20e417 100644 --- a/cmake/templates/OpenCV.mk.in +++ b/cmake/templates/OpenCV.mk.in @@ -7,6 +7,7 @@ LOCAL_PATH:=$(subst ?,,$(firstword ?$(subst \, ,$(subst /, ,$(call my-dir))))) OPENCV_THIS_DIR:=$(patsubst $(LOCAL_PATH)\\%,%,$(patsubst $(LOCAL_PATH)/%,%,$(call my-dir))) OPENCV_MK_DIR:=$(dir $(lastword $(MAKEFILE_LIST))) OPENCV_LIBS_DIR:=@OPENCV_LIBS_DIR_CONFIGCMAKE@ +OPENCV_3RDPARTY_LIBS_DIR:=@OPENCV_3RDPARTY_LIBS_DIR_CONFIGCMAKE@ OPENCV_BASEDIR:=@OPENCV_BASE_INCLUDE_DIR_CONFIGCMAKE@ OPENCV_LOCAL_C_INCLUDES:=@OPENCV_INCLUDE_DIRS_CONFIGCMAKE@ OPENCV_MODULES:=@OPENCV_MODULES_CONFIGMAKE@ @@ -31,9 +32,7 @@ else OPENCV_EXTRA_COMPONENTS:=@OPENCV_EXTRA_COMPONENTS_CONFIGMAKE@ endif -ifeq (${OPENCV_CAMERA_MODULES},off) - OPENCV_CAMERA_MODULES:= -else +ifeq (${OPENCV_CAMERA_MODULES},on) ifeq ($(TARGET_ARCH_ABI),armeabi) OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_ARMEABI_CONFIGCMAKE@ endif @@ -43,6 +42,8 @@ else ifeq ($(TARGET_ARCH_ABI),x86) OPENCV_CAMERA_MODULES:=@OPENCV_CAMERA_LIBS_X86_CONFIGCMAKE@ endif +else + OPENCV_CAMERA_MODULES:= endif ifeq ($(OPENCV_LIB_TYPE),SHARED) @@ -55,21 +56,21 @@ endif define add_opencv_module include $(CLEAR_VARS) LOCAL_MODULE:=opencv_$1 - LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/libs/$(TARGET_ARCH_ABI)/libopencv_$1.$(OPENCV_LIB_SUFFIX) + LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/libopencv_$1.$(OPENCV_LIB_SUFFIX) include $(PREBUILT_$(OPENCV_LIB_TYPE)_LIBRARY) endef define add_opencv_3rdparty_component include $(CLEAR_VARS) LOCAL_MODULE:=$1 - LOCAL_SRC_FILES:=$(OPENCV_THIS_DIR)/3rdparty/libs/$(TARGET_ARCH_ABI)/lib$1.a + LOCAL_SRC_FILES:=$(OPENCV_3RDPARTY_LIBS_DIR)/lib$1.a include $(PREBUILT_STATIC_LIBRARY) endef define add_opencv_camera_module include $(CLEAR_VARS) LOCAL_MODULE:=$1 - LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/libs/$(TARGET_ARCH_ABI)/lib$1.so + LOCAL_SRC_FILES:=$(OPENCV_LIBS_DIR)/lib$1.so include $(PREBUILT_SHARED_LIBRARY) endef @@ -94,7 +95,7 @@ LOCAL_CFLAGS += $(OPENCV_LOCAL_CFLAGS) ifeq ($(OPENCV_INSTALL_MODULES),on) LOCAL_$(OPENCV_LIB_TYPE)_LIBRARIES += $(foreach mod, $(OPENCV_LIBS), opencv_$(mod)) else - LOCAL_LDLIBS += -L$(call host-path,$(LOCAL_PATH)/$(OPENCV_LIBS_DIR)/libs/$(TARGET_ARCH_ABI)) $(foreach lib, $(OPENCV_LIBS), -lopencv_$(lib)) + LOCAL_LDLIBS += -L$(call host-path,$(LOCAL_PATH)/$(OPENCV_LIBS_DIR)) $(foreach lib, $(OPENCV_LIBS), -lopencv_$(lib)) endif ifeq ($(OPENCV_LIB_TYPE),STATIC) diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 95e3ba253a..4ff3569122 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -52,12 +52,17 @@ set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE@) # Extract the directory where *this* file has been installed (determined at cmake run-time) get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE) -if(NOT WIN32) +if(NOT WIN32 OR OpenCV_ANDROID_NATIVE_API_LEVEL GREATER 0) + if(OpenCV_ANDROID_NATIVE_API_LEVEL GREATER 0) + set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../..") + else() + set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../..") + endif() # Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 2.8) - get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." ABSOLUTE) + get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" ABSOLUTE) else() - get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../.." REALPATH) + get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_INSTALL_PATH}" REALPATH) endif() endif() diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 4a7f0089e5..70efd6fd03 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,7 +1,10 @@ file(GLOB HAAR_CASCADES haarcascades/*.xml) file(GLOB LBP_CASCADES lbpcascades/*.xml) -if(NOT WIN32) +if(ANDROID) + install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT main) + install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT main) +elseif(NOT WIN32) install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT main) - install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT main) + install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT main) endif() diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index f95853f2b6..1d5909616a 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,9 +1,9 @@ file(GLOB old_hdrs "opencv/*.h*") install(FILES ${old_hdrs} - DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv + DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv COMPONENT main) install(FILES "opencv2/opencv.hpp" - DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2 + DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT main) diff --git a/modules/gpu/CMakeLists.txt b/modules/gpu/CMakeLists.txt index 55e6400fe6..6e7032052a 100644 --- a/modules/gpu/CMakeLists.txt +++ b/modules/gpu/CMakeLists.txt @@ -73,7 +73,7 @@ if(HAVE_CUDA) endif() install(FILES src/nvidia/NPP_staging/NPP_staging.hpp src/nvidia/core/NCV.hpp - DESTINATION ${OPENCV_INCLUDE_PREFIX}/opencv2/${name} + DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2/${name} COMPONENT main) endif() diff --git a/modules/highgui/src/window_gtk.cpp b/modules/highgui/src/window_gtk.cpp index 7b9169e1df..99b16d93c1 100644 --- a/modules/highgui/src/window_gtk.cpp +++ b/modules/highgui/src/window_gtk.cpp @@ -851,7 +851,7 @@ namespace __END__; } - void GlFuncTab_GTK::generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool underline, int start, int count, int base) const + void GlFuncTab_GTK::generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool /*underline*/, int start, int count, int base) const { PangoFontDescription* fontDecr; PangoFont* pangoFont; diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index af2b97a4a6..020abb2821 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -118,6 +118,8 @@ add_custom_command( # copy generated java files to the final location set(JAVA_OUTPUT_DIR "src/org/opencv") +set(JAVA_INSTALL_ROOT "sdk/java") +set(JNI_INSTALL_ROOT "sdk/native") # copy each documented header to the final destination set(java_files "") @@ -137,7 +139,7 @@ foreach(java_file ${documented_java_files} ${handwrittren_aidl_sources}) if(ANDROID) get_filename_component(install_subdir "${java_file_name}" PATH) - install(FILES "${OpenCV_BINARY_DIR}/${JAVA_OUTPUT_DIR}/${java_file_name}" DESTINATION ${JAVA_OUTPUT_DIR}/${install_subdir} COMPONENT main) + install(FILES "${OpenCV_BINARY_DIR}/${JAVA_OUTPUT_DIR}/${java_file_name}" DESTINATION ${JAVA_INSTALL_ROOT}/${JAVA_OUTPUT_DIR}/${install_subdir} COMPONENT main) endif() endforeach() @@ -199,7 +201,8 @@ if(ANDROID) list(APPEND lib_proj_files "${OpenCV_BINARY_DIR}/${f}") if(NOT f MATCHES "jni/.+") - install(FILES "${OpenCV_BINARY_DIR}/${f}" DESTINATION . COMPONENT main) + get_filename_component(install_subdir "${f}" PATH) + install(FILES "${OpenCV_BINARY_DIR}/${f}" DESTINATION "${JAVA_INSTALL_ROOT}/${install_subdir}" COMPONENT main) endif() endif() endforeach() @@ -235,8 +238,11 @@ if(ANDROID) DEPENDS ${lib_proj_files} COMMENT "Generating OpenCV Android library project. SDK target: ${lib_target_sdk_target}" ) - install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_PROJECT_PROPERTIES_FILE}" DESTINATION . COMPONENT main) - install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" DESTINATION . COMPONENT main) + install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_PROJECT_PROPERTIES_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT main) + install(FILES "${OpenCV_BINARY_DIR}/${ANDROID_MANIFEST_FILE}" DESTINATION ${JAVA_INSTALL_ROOT} COMPONENT main) + # creating empty 'gen' and 'res' folders + install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/sdk/java/gen\")" COMPONENT main) + install(CODE "MAKE_DIRECTORY(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/sdk/java/res\")" COMPONENT main) if(ANT_EXECUTABLE AND ANDROID_TOOLS_Pkg_Revision GREATER 13) # build the library project diff --git a/modules/java/android_test/CMakeLists.txt b/modules/java/android_test/CMakeLists.txt index d1790d34bb..1ac8719195 100644 --- a/modules/java/android_test/CMakeLists.txt +++ b/modules/java/android_test/CMakeLists.txt @@ -42,6 +42,7 @@ list(APPEND opencv_test_java_file_deps ${android_proj_target_files}) # build java part add_custom_command( OUTPUT "${opencv_test_java_bin_dir}/bin/OpenCVTest-debug.apk" + COMMAND ${CMAKE_COMMAND} -E copy "${OpenCV_BINARY_DIR}/lib/${ANDROID_NDK_ABI_NAME}/libopencv_java.so" "${opencv_test_java_bin_dir}/libs/${ANDROID_NDK_ABI_NAME}/libopencv_java.so" COMMAND ${ANT_EXECUTABLE} -q -noinput -k debug COMMAND ${CMAKE_COMMAND} -E touch "${opencv_test_java_bin_dir}/bin/OpenCVTest-debug.apk" # needed because ant does not update the timestamp of updated apk WORKING_DIRECTORY "${opencv_test_java_bin_dir}" diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index b7ec3a3bbb..505cd6e3a1 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -1,5 +1,5 @@ # ---------------------------------------------------------------------------- -# CMake file for samples. See root CMakeLists.txt +# CMake file for samples. See root CMakeLists.txt # # ---------------------------------------------------------------------------- diff --git a/samples/android/face-detection/jni/Android.mk b/samples/android/face-detection/jni/Android.mk index 190baf305e..93f5ca4191 100644 --- a/samples/android/face-detection/jni/Android.mk +++ b/samples/android/face-detection/jni/Android.mk @@ -2,15 +2,10 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -OPENCV_CAMERA_MODULES:=off - -include ../includeOpenCV.mk -ifeq ("$(wildcard $(OPENCV_MK_PATH))","") - #try to load OpenCV.mk from default install location - include $(TOOLCHAIN_PREBUILT_ROOT)/user/share/OpenCV/OpenCV.mk -else - include $(OPENCV_MK_PATH) -endif +#OPENCV_CAMERA_MODULES:=off +#OPENCV_INSTALL_MODULES:=off +#OPENCV_LIB_TYPE:=SHARED +include ../../sdk/native/jni/OpenCV.mk LOCAL_SRC_FILES := DetectionBasedTracker_jni.cpp LOCAL_C_INCLUDES += $(LOCAL_PATH) diff --git a/samples/android/tutorial-3-native/jni/Android.mk b/samples/android/tutorial-3-native/jni/Android.mk index 7429d65dad..372d65a1d0 100644 --- a/samples/android/tutorial-3-native/jni/Android.mk +++ b/samples/android/tutorial-3-native/jni/Android.mk @@ -2,16 +2,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -OPENCV_LIB_TYPE:=STATIC -OPENCV_INSTALL_MODULES:=on - -include ../includeOpenCV.mk -ifeq ("$(wildcard $(OPENCV_MK_PATH))","") - #try to load OpenCV.mk from default install location - include $(TOOLCHAIN_PREBUILT_ROOT)/user/share/OpenCV/OpenCV.mk -else - include $(OPENCV_MK_PATH) -endif +include ../../sdk/native/jni/OpenCV.mk LOCAL_MODULE := native_sample LOCAL_SRC_FILES := jni_part.cpp diff --git a/samples/android/tutorial-4-mixed/jni/Android.mk b/samples/android/tutorial-4-mixed/jni/Android.mk index bd06352e14..18dac1fb09 100644 --- a/samples/android/tutorial-4-mixed/jni/Android.mk +++ b/samples/android/tutorial-4-mixed/jni/Android.mk @@ -2,17 +2,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -OPENCV_CAMERA_MODULES:=off -OPENCV_INSTALL_MODULES:=on -#OPENCV_LIB_TYPE:=SHARED <- this is default - -include ../includeOpenCV.mk -ifeq ("$(wildcard $(OPENCV_MK_PATH))","") - #try to load OpenCV.mk from default install location - include $(TOOLCHAIN_PREBUILT_ROOT)/user/share/OpenCV/OpenCV.mk -else - include $(OPENCV_MK_PATH) -endif +include ../../sdk/native/jni/OpenCV.mk LOCAL_MODULE := mixed_sample LOCAL_SRC_FILES := jni_part.cpp diff --git a/samples/c/CMakeLists.txt b/samples/c/CMakeLists.txt index 13672e735b..8e7f29032b 100644 --- a/samples/c/CMakeLists.txt +++ b/samples/c/CMakeLists.txt @@ -15,7 +15,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") endif() - + ocv_include_modules(${OPENCV_C_SAMPLES_REQUIRED_DEPS}) # --------------------------------------------- @@ -42,9 +42,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) RUNTIME DESTINATION "samples/c" COMPONENT main) endif() ENDMACRO() - + file(GLOB cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp *.c) - + foreach(sample_filename ${cpp_samples}) get_filename_component(sample ${sample_filename} NAME_WE) OPENCV_DEFINE_C_EXAMPLE(${sample} ${sample_filename}) @@ -54,7 +54,7 @@ endif() if (INSTALL_C_EXAMPLES AND NOT WIN32) file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) install(FILES ${C_SAMPLES} - DESTINATION share/opencv/samples/c + DESTINATION share/OpenCV/samples/c PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) endif () diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt index 3f4bb6aa0c..c2b49a75ee 100644 --- a/samples/cpp/CMakeLists.txt +++ b/samples/cpp/CMakeLists.txt @@ -23,7 +23,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) if(CMAKE_COMPILER_IS_GNUCXX AND NOT ENABLE_NOISY_WARNINGS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function") endif() - + # --------------------------------------------- # Define executable targets # --------------------------------------------- @@ -39,7 +39,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) set_target_properties(${the_target} PROPERTIES OUTPUT_NAME "${name}" PROJECT_LABEL "(EXAMPLE) ${name}") - + if(ENABLE_SOLUTION_FOLDERS) set_target_properties(${the_target} PROPERTIES FOLDER "samples//cpp") endif() @@ -52,9 +52,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) RUNTIME DESTINATION "samples/cpp" COMPONENT main) endif() ENDMACRO() - + file(GLOB cpp_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) - + foreach(sample_filename ${cpp_samples}) get_filename_component(sample ${sample_filename} NAME_WE) OPENCV_DEFINE_CPP_EXAMPLE(${sample} ${sample_filename}) @@ -64,7 +64,7 @@ endif() if (INSTALL_C_EXAMPLES AND NOT WIN32) file(GLOB C_SAMPLES *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) install(FILES ${C_SAMPLES} - DESTINATION share/opencv/samples/cpp + DESTINATION share/OpenCV/samples/cpp PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) endif() diff --git a/samples/gpu/CMakeLists.txt b/samples/gpu/CMakeLists.txt index c1bf36b901..96cf949cce 100644 --- a/samples/gpu/CMakeLists.txt +++ b/samples/gpu/CMakeLists.txt @@ -8,7 +8,7 @@ ocv_check_dependencies(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS}) if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) set(project "gpu") string(TOUPPER "${project}" project_upper) - + project("${project}_samples") ocv_include_modules(${OPENCV_GPU_SAMPLES_REQUIRED_DEPS}) @@ -35,9 +35,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_REQUIRED_DEPS}) set_target_properties(${the_target} PROPERTIES - OUTPUT_NAME "${name}_${project}" + OUTPUT_NAME "${name}_${project}" PROJECT_LABEL "(EXAMPLE_${project_upper}) ${name}") - + if(ENABLE_SOLUTION_FOLDERS) set_target_properties(${the_target} PROPERTIES FOLDER "samples//${project}") endif() @@ -61,10 +61,10 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND) include("performance/CMakeLists.txt") endif() -if (NOT WIN32) +if (INSTALL_C_EXAMPLES AND NOT WIN32) file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd ) install(FILES ${install_list} - DESTINATION share/opencv/samples/${project} + DESTINATION share/OpenCV/samples/${project} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) endif() diff --git a/samples/gpu/performance/CMakeLists.txt b/samples/gpu/performance/CMakeLists.txt index 6ad99a1355..d775037057 100644 --- a/samples/gpu/performance/CMakeLists.txt +++ b/samples/gpu/performance/CMakeLists.txt @@ -9,18 +9,18 @@ target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_R set_target_properties(${the_target} PROPERTIES OUTPUT_NAME "performance_gpu" PROJECT_LABEL "(EXAMPLE_GPU) performance") - + if(ENABLE_SOLUTION_FOLDERS) set_target_properties(${the_target} PROPERTIES FOLDER "samples//gpu") -endif() +endif() if(WIN32) install(TARGETS ${the_target} RUNTIME DESTINATION "samples/gpu" COMPONENT main) endif() -if(NOT WIN32) +if(INSTALL_C_EXAMPLES AND NOT WIN32) file(GLOB GPU_FILES performance/*.cpp performance/*.h) install(FILES ${GPU_FILES} - DESTINATION share/opencv/samples/gpu/performance + DESTINATION share/OpenCV/samples/gpu/performance PERMISSIONS OWNER_READ GROUP_READ WORLD_READ) endif()