From 632afe6ae3f95fc4228a0c3b92ce08eaed748183 Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Thu, 12 Mar 2015 19:14:14 +0300 Subject: [PATCH] Fixed mangled install layout on unix machines --- CMakeLists.txt | 20 ++++++++++++++++++-- cmake/OpenCVGenConfig.cmake | 23 +++++------------------ data/CMakeLists.txt | 11 +++-------- doc/CMakeLists.txt | 27 ++++----------------------- modules/java/CMakeLists.txt | 15 +++++---------- 5 files changed, 35 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc81d51cd0..20a1f6fd86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,8 +274,6 @@ endif() if(ANDROID OR WIN32) set(OPENCV_DOC_INSTALL_PATH doc) -elseif(INSTALL_TO_MANGLED_PATHS) - set(OPENCV_DOC_INSTALL_PATH share/OpenCV-${OPENCV_VERSION}/doc) else() set(OPENCV_DOC_INSTALL_PATH share/OpenCV/doc) endif() @@ -309,6 +307,10 @@ if(NOT OPENCV_TEST_INSTALL_PATH) set(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}") endif() +if (OPENCV_TEST_DATA_PATH) + get_filename_component(OPENCV_TEST_DATA_PATH ${OPENCV_TEST_DATA_PATH} ABSOLUTE) +endif() + if(OPENCV_TEST_DATA_PATH AND NOT OPENCV_TEST_DATA_INSTALL_PATH) if(ANDROID) set(OPENCV_TEST_DATA_INSTALL_PATH "sdk/etc/testdata") @@ -327,9 +329,11 @@ if(ANDROID) set(OPENCV_CONFIG_INSTALL_PATH sdk/native/jni) set(OPENCV_INCLUDE_INSTALL_PATH sdk/native/jni/include) set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native) + set(OPENCV_OTHER_INSTALL_PATH sdk/etc) else() set(LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/lib") set(3P_LIBRARY_OUTPUT_PATH "${OpenCV_BINARY_DIR}/3rdparty/lib${LIB_SUFFIX}") + if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) if(OpenCV_STATIC) set(OPENCV_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}") @@ -338,10 +342,14 @@ else() endif() set(OPENCV_3P_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}") set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native) + set(OPENCV_JAR_INSTALL_PATH java) + set(OPENCV_OTHER_INSTALL_PATH etc) else() set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) set(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}) set(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples) + set(OPENCV_JAR_INSTALL_PATH share/OpenCV/java) + set(OPENCV_OTHER_INSTALL_PATH share/OpenCV) endif() set(OPENCV_INCLUDE_INSTALL_PATH "include") @@ -358,8 +366,16 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) if(INSTALL_TO_MANGLED_PATHS) set(OPENCV_INCLUDE_INSTALL_PATH ${OPENCV_INCLUDE_INSTALL_PATH}/opencv-${OPENCV_VERSION}) + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_3P_LIB_INSTALL_PATH "${OPENCV_3P_LIB_INSTALL_PATH}") + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_SAMPLES_SRC_INSTALL_PATH "${OPENCV_SAMPLES_SRC_INSTALL_PATH}") + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_CONFIG_INSTALL_PATH "${OPENCV_CONFIG_INSTALL_PATH}") + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_DOC_INSTALL_PATH "${OPENCV_DOC_INSTALL_PATH}") + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_JAR_INSTALL_PATH "${OPENCV_JAR_INSTALL_PATH}") + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_TEST_DATA_INSTALL_PATH "${OPENCV_TEST_DATA_INSTALL_PATH}") + string(REPLACE "OpenCV" "OpenCV-${OPENCV_VERSION}" OPENCV_OTHER_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}") endif() + if(WIN32) # Postfix of DLLs: set(OPENCV_DLLVERSION "${OPENCV_VERSION_MAJOR}${OPENCV_VERSION_MINOR}${OPENCV_VERSION_PATCH}") diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake index 249479d39f..ae8fc89399 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake @@ -101,10 +101,7 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake. 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(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() +set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"") if(UNIX) # ANDROID configuration is created here also #http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference @@ -114,23 +111,13 @@ if(UNIX) # ANDROID configuration is created here also # /(share|lib)/*/ (U) # /(share|lib)/*/(cmake|CMake)/ (U) if(USE_IPPICV) - if(INSTALL_TO_MANGLED_PATHS) - file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/" ${IPPICV_INSTALL_PATH}) - else() - file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${IPPICV_INSTALL_PATH}) - endif() + file(RELATIVE_PATH INSTALL_PATH_RELATIVE_IPPICV "${CMAKE_INSTALL_PREFIX}/${OPENCV_CONFIG_INSTALL_PATH}/" ${IPPICV_INSTALL_PATH}) endif() configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" @ONLY) configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake" @ONLY) - if(INSTALL_TO_MANGLED_PATHS) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/ COMPONENT dev) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/ COMPONENT dev) - install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}-${OPENCV_VERSION}/ FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) - else() - install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev) - install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev) - install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) - endif() + install(FILES "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev) + install(FILES ${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig-version.cmake DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ COMPONENT dev) + install(EXPORT OpenCVModules DESTINATION ${OPENCV_CONFIG_INSTALL_PATH}/ FILE OpenCVModules${modules_file_suffix}.cmake COMPONENT dev) endif() if(ANDROID) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index bc5a0361a7..1f0d720084 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,14 +1,9 @@ file(GLOB HAAR_CASCADES haarcascades/*.xml) file(GLOB LBP_CASCADES lbpcascades/*.xml) -if(ANDROID) - install(FILES ${HAAR_CASCADES} DESTINATION sdk/etc/haarcascades COMPONENT libs) - install(FILES ${LBP_CASCADES} DESTINATION sdk/etc/lbpcascades COMPONENT libs) -else() - install(FILES ${HAAR_CASCADES} DESTINATION share/OpenCV/haarcascades COMPONENT libs) - install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs) -endif() +install(FILES ${HAAR_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/haarcascades COMPONENT libs) +install(FILES ${LBP_CASCADES} DESTINATION ${OPENCV_OTHER_INSTALL_PATH}/lbpcascades COMPONENT libs) if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests") -endif() \ No newline at end of file +endif() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 866134fe1b..a7f5372bfa 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -27,15 +27,6 @@ if(HAVE_DOC_GENERATOR) set(FIXED_ORDER_MODULES core imgproc imgcodecs videoio highgui video calib3d features2d objdetect ml flann photo stitching) list(REMOVE_ITEM BASE_MODULES ${FIXED_ORDER_MODULES}) set(BASE_MODULES ${FIXED_ORDER_MODULES} ${BASE_MODULES}) - - set(DOC_LIST - "${OpenCV_SOURCE_DIR}/doc/opencv-logo.png" - "${OpenCV_SOURCE_DIR}/doc/opencv-logo2.png" - "${OpenCV_SOURCE_DIR}/doc/opencv-logo-white.png" - "${OpenCV_SOURCE_DIR}/doc/opencv.ico" - "${OpenCV_SOURCE_DIR}/doc/pattern.png" - "${OpenCV_SOURCE_DIR}/doc/acircles_pattern.png") - set(OPTIONAL_DOC_LIST "") endif(HAVE_DOC_GENERATOR) # ========= Doxygen docs ========= @@ -160,18 +151,8 @@ if(BUILD_DOCS AND DOXYGEN_FOUND) COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} DEPENDS ${doxyfile} ${rootfile} ${bibfile} ${deps} ) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html + DESTINATION "${OPENCV_DOC_INSTALL_PATH}" + COMPONENT "docs" OPTIONAL + ) endif() - -if(HAVE_DOC_GENERATOR) - # installation - foreach(f ${DOC_LIST}) - install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" COMPONENT docs) - endforeach() - foreach(f ${OPTIONAL_DOC_LIST}) - install(FILES "${f}" DESTINATION "${OPENCV_DOC_INSTALL_PATH}" OPTIONAL COMPONENT docs) - endforeach() - - # dummy targets - add_custom_target(docs) - add_custom_target(html_docs) -endif(HAVE_DOC_GENERATOR) diff --git a/modules/java/CMakeLists.txt b/modules/java/CMakeLists.txt index e38ec1f198..38f410e64c 100644 --- a/modules/java/CMakeLists.txt +++ b/modules/java/CMakeLists.txt @@ -318,12 +318,7 @@ else(ANDROID) COMMENT "Generating ${JAR_NAME}" ) - if(WIN32) - set(JAR_INSTALL_DIR java) - else(WIN32) - set(JAR_INSTALL_DIR share/OpenCV/java) - endif(WIN32) - install(FILES ${JAR_FILE} OPTIONAL DESTINATION ${JAR_INSTALL_DIR} COMPONENT java) + install(FILES ${JAR_FILE} OPTIONAL DESTINATION ${OPENCV_JAR_INSTALL_PATH} COMPONENT java) endif(ANDROID) # step 5: build native part @@ -398,12 +393,12 @@ if(ANDROID) else() if(NOT INSTALL_CREATE_DISTRIB) ocv_install_target(${the_module} OPTIONAL EXPORT OpenCVModules - RUNTIME DESTINATION ${JAR_INSTALL_DIR} COMPONENT java - LIBRARY DESTINATION ${JAR_INSTALL_DIR} COMPONENT java) + RUNTIME DESTINATION ${OPENCV_JAR_INSTALL_PATH} COMPONENT java + LIBRARY DESTINATION ${OPENCV_JAR_INSTALL_PATH} COMPONENT java) else() ocv_install_target(${the_module} OPTIONAL EXPORT OpenCVModules - RUNTIME DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java - LIBRARY DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java) + RUNTIME DESTINATION ${OPENCV_JAR_INSTALL_PATH}/${OpenCV_ARCH} COMPONENT java + LIBRARY DESTINATION ${OPENCV_JAR_INSTALL_PATH}/${OpenCV_ARCH} COMPONENT java) endif() endif()