1if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
2set(CPACK_set_DESTDIR "on")
3
4if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
5  set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Computer Vision Library")
6  set(CPACK_PACKAGE_DESCRIPTION
7"OpenCV (Open Source Computer Vision Library) is an open source computer vision
8and machine learning software library. OpenCV was built to provide a common
9infrastructure for computer vision applications and to accelerate the use of
10machine perception in the commercial products. Being a BSD-licensed product,
11OpenCV makes it easy for businesses to utilize and modify the code.")
12  set(CPACK_PACKAGE_VENDOR "OpenCV Foundation")
13  set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
14  set(CPACK_PACKAGE_CONTACT "admin@opencv.org")
15  set(CPACK_PACKAGE_VERSION_MAJOR "${OPENCV_VERSION_MAJOR}")
16  set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}")
17  set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
18  set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
19endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
20
21#arch
22if(X86)
23  set(CPACK_DEBIAN_ARCHITECTURE "i386")
24  set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
25elseif(X86_64)
26  set(CPACK_DEBIAN_ARCHITECTURE "amd64")
27  set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
28elseif(ARM)
29  set(CPACK_DEBIAN_ARCHITECTURE "armhf")
30  set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf")
31else()
32  set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
33  set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
34endif()
35
36if(CPACK_GENERATOR STREQUAL "DEB")
37  set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_ARCHITECTURE})
38elseif(CPACK_GENERATOR STREQUAL "RPM")
39  set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE})
40else()
41  set(OPENCV_PACKAGE_ARCH_SUFFIX ${CMAKE_SYSTEM_PROCESSOR})
42endif()
43
44set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
45set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
46
47#rpm options
48set(CPACK_RPM_COMPONENT_INSTALL TRUE)
49set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
50set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
51set(CPACK_RPM_PACKAGE_URL "http://opencv.org")
52set(CPACK_RPM_PACKAGE_LICENSE "BSD")
53
54#deb options
55set(CPACK_DEB_COMPONENT_INSTALL TRUE)
56set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
57set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
58set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
59
60#display names
61set(CPACK_COMPONENT_DEV_DISPLAY_NAME     "Development files")
62set(CPACK_COMPONENT_DOCS_DISPLAY_NAME    "Documentation")
63set(CPACK_COMPONENT_JAVA_DISPLAY_NAME    "Java bindings")
64set(CPACK_COMPONENT_LIBS_DISPLAY_NAME    "Libraries and data")
65set(CPACK_COMPONENT_PYTHON_DISPLAY_NAME  "Python bindings")
66set(CPACK_COMPONENT_SAMPLES_DISPLAY_NAME "Samples")
67set(CPACK_COMPONENT_TESTS_DISPLAY_NAME   "Tests")
68
69#depencencies
70set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
71set(CPACK_COMPONENT_LIBS_REQUIRED TRUE)
72set(CPACK_COMPONENT_SAMPLES_DEPENDS libs)
73set(CPACK_COMPONENT_DEV_DEPENDS libs)
74set(CPACK_COMPONENT_DOCS_DEPENDS libs)
75set(CPACK_COMPONENT_JAVA_DEPENDS libs)
76set(CPACK_COMPONENT_PYTHON_DEPENDS libs)
77set(CPACK_COMPONENT_TESTS_DEPENDS libs)
78
79if(HAVE_CUDA)
80  string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
81  if(${CUDA_VERSION} VERSION_LESS "6.5")
82    set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
83    set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
84  else()
85    set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-cudart-${cuda_version_suffix}, cuda-npp-${cuda_version_suffix}")
86    set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-cudart-dev-${cuda_version_suffix}, cuda-npp-dev-${cuda_version_suffix}")
87    if(HAVE_CUFFT)
88      set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cufft-${cuda_version_suffix}")
89      set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cufft-dev-${cuda_version_suffix}")
90    endif()
91    if(HAVE_HAVE_CUBLAS)
92      set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cublas-${cuda_version_suffix}")
93      set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cublas-dev-${cuda_version_suffix}")
94    endif()
95  endif()
96  set(CPACK_COMPONENT_dev_DEPENDS libs)
97endif()
98
99if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
100  set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library")
101  set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "lib${CMAKE_PROJECT_NAME}")
102
103  set(CPACK_COMPONENT_PYTHON_DESCRIPTION "Python bindings for Open Source Computer Vision Library")
104  set(CPACK_DEBIAN_COMPONENT_PYTHON_NAME "lib${CMAKE_PROJECT_NAME}-python")
105
106  set(CPACK_COMPONENT_JAVA_DESCRIPTION "Java bindings for Open Source Computer Vision Library")
107  set(CPACK_DEBIAN_COMPONENT_JAVA_NAME "lib${CMAKE_PROJECT_NAME}-java")
108
109  set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for Open Source Computer Vision Library")
110  set(CPACK_DEBIAN_COMPONENT_DEV_NAME "lib${CMAKE_PROJECT_NAME}-dev")
111
112  set(CPACK_COMPONENT_DOCS_DESCRIPTION "Documentation for Open Source Computer Vision Library")
113  set(CPACK_DEBIAN_COMPONENT_DOCS_NAME "lib${CMAKE_PROJECT_NAME}-docs")
114
115  set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Samples for Open Source Computer Vision Library")
116  set(CPACK_DEBIAN_COMPONENT_SAMPLES_NAME "lib${CMAKE_PROJECT_NAME}-samples")
117
118  set(CPACK_COMPONENT_TESTS_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library")
119  set(CPACK_DEBIAN_COMPONENT_TESTS_NAME "lib${CMAKE_PROJECT_NAME}-tests")
120endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
121
122include(CPack)
123
124ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")