OpenCVInstallLayout.cmake 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. # message(STATUS "Initial install layout:")
  2. # ocv_cmake_dump_vars("OPENCV_.*_INSTALL_PATH")
  3. if(ANDROID)
  4. ocv_update(OPENCV_BIN_INSTALL_PATH "sdk/native/bin/${ANDROID_NDK_ABI_NAME}")
  5. ocv_update(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
  6. ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "sdk/native/samples/${ANDROID_NDK_ABI_NAME}")
  7. ocv_update(OPENCV_LIB_INSTALL_PATH "sdk/native/libs/${ANDROID_NDK_ABI_NAME}")
  8. ocv_update(OPENCV_LIB_ARCHIVE_INSTALL_PATH "sdk/native/staticlibs/${ANDROID_NDK_ABI_NAME}")
  9. ocv_update(OPENCV_3P_LIB_INSTALL_PATH "sdk/native/3rdparty/libs/${ANDROID_NDK_ABI_NAME}")
  10. ocv_update(OPENCV_CONFIG_INSTALL_PATH "sdk/native/jni")
  11. ocv_update(OPENCV_INCLUDE_INSTALL_PATH "sdk/native/jni/include")
  12. ocv_update(OPENCV_OTHER_INSTALL_PATH "sdk/etc")
  13. ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH "samples/native")
  14. ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
  15. ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/testdata")
  16. ocv_update(OPENCV_DOC_INSTALL_PATH "doc")
  17. ocv_update(OPENCV_JAR_INSTALL_PATH ".")
  18. ocv_update(OPENCV_JNI_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}")
  19. ocv_update(OPENCV_JNI_BIN_INSTALL_PATH "${OPENCV_JNI_INSTALL_PATH}")
  20. elseif(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
  21. if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH)
  22. ocv_update(OPENCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/")
  23. else()
  24. message(STATUS "Can't detect runtime and/or arch")
  25. ocv_update(OPENCV_INSTALL_BINARIES_PREFIX "")
  26. endif()
  27. if(OpenCV_STATIC)
  28. ocv_update(OPENCV_INSTALL_BINARIES_SUFFIX "staticlib")
  29. else()
  30. ocv_update(OPENCV_INSTALL_BINARIES_SUFFIX "lib")
  31. endif()
  32. if(INSTALL_CREATE_DISTRIB)
  33. set(_jni_suffix "/${OpenCV_ARCH}")
  34. else()
  35. set(_jni_suffix "")
  36. endif()
  37. ocv_update(OPENCV_BIN_INSTALL_PATH "${OPENCV_INSTALL_BINARIES_PREFIX}bin")
  38. ocv_update(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
  39. ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OPENCV_INSTALL_BINARIES_PREFIX}samples")
  40. ocv_update(OPENCV_LIB_INSTALL_PATH "${OPENCV_INSTALL_BINARIES_PREFIX}${OPENCV_INSTALL_BINARIES_SUFFIX}")
  41. ocv_update(OPENCV_LIB_ARCHIVE_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}")
  42. ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${OPENCV_INSTALL_BINARIES_PREFIX}staticlib")
  43. ocv_update(OPENCV_CONFIG_INSTALL_PATH ".")
  44. ocv_update(OPENCV_INCLUDE_INSTALL_PATH "include")
  45. ocv_update(OPENCV_OTHER_INSTALL_PATH "etc")
  46. ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH "samples")
  47. ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
  48. ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "testdata")
  49. ocv_update(OPENCV_DOC_INSTALL_PATH "doc")
  50. ocv_update(OPENCV_JAR_INSTALL_PATH "java")
  51. ocv_update(OPENCV_JNI_INSTALL_PATH "java${_jni_suffix}")
  52. ocv_update(OPENCV_JNI_BIN_INSTALL_PATH "${OPENCV_JNI_INSTALL_PATH}")
  53. else() # UNIX
  54. include(GNUInstallDirs)
  55. ocv_update(OPENCV_BIN_INSTALL_PATH "bin")
  56. ocv_update(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
  57. ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
  58. ocv_update(OPENCV_LIB_INSTALL_PATH "${CMAKE_INSTALL_LIBDIR}")
  59. ocv_update(OPENCV_LIB_ARCHIVE_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}")
  60. ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/opencv4/3rdparty")
  61. ocv_update(OPENCV_CONFIG_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}/cmake/opencv4")
  62. ocv_update(OPENCV_INCLUDE_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/opencv4")
  63. ocv_update(OPENCV_OTHER_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/opencv4")
  64. ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/samples")
  65. ocv_update(OPENCV_LICENSES_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/licenses/opencv4")
  66. ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/testdata")
  67. ocv_update(OPENCV_DOC_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/doc/opencv4")
  68. ocv_update(OPENCV_JAR_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/java/opencv4")
  69. ocv_update(OPENCV_JNI_INSTALL_PATH "${OPENCV_JAR_INSTALL_PATH}")
  70. ocv_update(OPENCV_JNI_BIN_INSTALL_PATH "${OPENCV_JNI_INSTALL_PATH}")
  71. endif()
  72. ocv_update(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}")
  73. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
  74. if(INSTALL_TO_MANGLED_PATHS)
  75. foreach(v
  76. OPENCV_INCLUDE_INSTALL_PATH
  77. # file names include version (.so/.dll): OPENCV_LIB_INSTALL_PATH
  78. OPENCV_CONFIG_INSTALL_PATH
  79. OPENCV_3P_LIB_INSTALL_PATH
  80. OPENCV_SAMPLES_SRC_INSTALL_PATH
  81. OPENCV_DOC_INSTALL_PATH
  82. # JAR file name includes version: OPENCV_JAR_INSTALL_PATH
  83. OPENCV_TEST_DATA_INSTALL_PATH
  84. OPENCV_OTHER_INSTALL_PATH
  85. )
  86. string(REGEX REPLACE "opencv[0-9]*" "opencv-${OPENCV_VERSION}" ${v} "${${v}}")
  87. endforeach()
  88. endif()
  89. # message(STATUS "Final install layout:")
  90. # ocv_cmake_dump_vars("OPENCV_.*_INSTALL_PATH")