1 ocv_cmake_hook(INIT_CPACK)
2 if(NOT EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
3 message(STATUS "CPack is not found. SKIP")
7 set(CPACK_set_DESTDIR "on")
9 if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
10 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Open Computer Vision Library")
11 set(CPACK_PACKAGE_DESCRIPTION
12 "OpenCV (Open Source Computer Vision Library) is an open source computer vision
13 and machine learning software library. OpenCV was built to provide a common
14 infrastructure for computer vision applications and to accelerate the use of
15 machine perception in the commercial products. Being a BSD-licensed product,
16 OpenCV makes it easy for businesses to utilize and modify the code.")
17 set(CPACK_PACKAGE_VENDOR "OpenCV Foundation")
18 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
19 set(CPACK_PACKAGE_CONTACT "admin@opencv.org")
20 set(CPACK_PACKAGE_VERSION_MAJOR "${OPENCV_VERSION_MAJOR}")
21 set(CPACK_PACKAGE_VERSION_MINOR "${OPENCV_VERSION_MINOR}")
22 set(CPACK_PACKAGE_VERSION_PATCH "${OPENCV_VERSION_PATCH}")
23 set(CPACK_PACKAGE_VERSION "${OPENCV_VCSVERSION}")
24 endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
28 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
29 set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
31 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
32 set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
34 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf")
35 set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf")
37 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
38 set(CPACK_RPM_PACKAGE_ARCHITECTURE "aarch64")
40 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "ppc64el")
41 set(CPACK_RPM_PACKAGE_ARCHITECTURE "ppc64le")
43 set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
44 set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
47 if(CPACK_GENERATOR STREQUAL "DEB")
48 set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
49 elseif(CPACK_GENERATOR STREQUAL "RPM")
50 set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE})
52 set(OPENCV_PACKAGE_ARCH_SUFFIX ${CMAKE_SYSTEM_PROCESSOR})
55 set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
56 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
59 set(CPACK_RPM_COMPONENT_INSTALL TRUE)
60 set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
61 set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
62 set(CPACK_RPM_PACKAGE_URL "http://opencv.org")
63 set(CPACK_RPM_PACKAGE_LICENSE "BSD")
66 set(CPACK_DEB_COMPONENT_INSTALL TRUE)
67 set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
68 set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
69 set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
72 set(CPACK_COMPONENT_DEV_DISPLAY_NAME "Development files")
73 set(CPACK_COMPONENT_DOCS_DISPLAY_NAME "Documentation")
74 set(CPACK_COMPONENT_JAVA_DISPLAY_NAME "Java bindings")
75 set(CPACK_COMPONENT_LIBS_DISPLAY_NAME "Libraries and data")
76 set(CPACK_COMPONENT_PYTHON_DISPLAY_NAME "Python bindings")
77 set(CPACK_COMPONENT_SAMPLES_DISPLAY_NAME "Samples")
78 set(CPACK_COMPONENT_TESTS_DISPLAY_NAME "Tests")
81 set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
82 set(CPACK_COMPONENT_LIBS_REQUIRED TRUE)
83 set(CPACK_COMPONENT_SAMPLES_DEPENDS libs)
84 set(CPACK_COMPONENT_DEV_DEPENDS libs)
85 set(CPACK_COMPONENT_DOCS_DEPENDS libs)
86 set(CPACK_COMPONENT_JAVA_DEPENDS libs)
87 set(CPACK_COMPONENT_PYTHON_DEPENDS libs)
88 set(CPACK_COMPONENT_TESTS_DEPENDS libs)
91 string(REPLACE "." "-" cuda_version_suffix ${CUDA_VERSION})
92 if(${CUDA_VERSION} VERSION_LESS "6.5")
93 set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-core-libs-${cuda_version_suffix}, cuda-extra-libs-${cuda_version_suffix}")
94 set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-headers-${cuda_version_suffix}")
96 set(CPACK_DEB_libs_PACKAGE_DEPENDS "cuda-cudart-${cuda_version_suffix}, cuda-npp-${cuda_version_suffix}")
97 set(CPACK_DEB_dev_PACKAGE_DEPENDS "cuda-cudart-dev-${cuda_version_suffix}, cuda-npp-dev-${cuda_version_suffix}")
99 set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cufft-${cuda_version_suffix}")
100 set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cufft-dev-${cuda_version_suffix}")
103 set(CPACK_DEB_libs_PACKAGE_DEPENDS "${CPACK_DEB_libs_PACKAGE_DEPENDS}, cuda-cublas-${cuda_version_suffix}")
104 set(CPACK_DEB_dev_PACKAGE_DEPENDS "${CPACK_DEB_dev_PACKAGE_DEPENDS}, cuda-cublas-dev-${cuda_version_suffix}")
107 set(CPACK_COMPONENT_dev_DEPENDS libs)
110 if(HAVE_TBB AND NOT BUILD_TBB)
111 if(CPACK_DEB_DEV_PACKAGE_DEPENDS)
112 set(CPACK_DEB_DEV_PACKAGE_DEPENDS "${CPACK_DEB_DEV_PACKAGE_DEPENDS}, libtbb-dev")
114 set(CPACK_DEB_DEV_PACKAGE_DEPENDS "libtbb-dev")
118 set(STD_OPENCV_LIBS opencv-data)
119 set(STD_OPENCV_DEV libopencv-dev)
121 foreach(module calib3d core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters
122 cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping
123 cudev features2d flann hal highgui imgcodecs imgproc ml objdetect ocl
124 photo shape stitching superres ts video videoio videostab viz)
125 if(HAVE_opencv_${module})
126 list(APPEND STD_OPENCV_LIBS "libopencv-${module}3.0")
127 list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
131 string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_CONFLICTS "${STD_OPENCV_LIBS}")
132 string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_PROVIDES "${STD_OPENCV_LIBS}")
133 string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_REPLACES "${STD_OPENCV_LIBS}")
135 string(REPLACE ";" ", " CPACK_COMPONENT_DEV_CONFLICTS "${STD_OPENCV_DEV}")
136 string(REPLACE ";" ", " CPACK_COMPONENT_DEV_PROVIDES "${STD_OPENCV_DEV}")
137 string(REPLACE ";" ", " CPACK_COMPONENT_DEV_REPLACES "${STD_OPENCV_DEV}")
139 set(CPACK_COMPONENT_PYTHON_CONFLICTS python-opencv)
140 set(CPACK_COMPONENT_PYTHON_PROVIDES python-opencv)
141 set(CPACK_COMPONENT_PYTHON_REPLACES python-opencv)
143 set(CPACK_COMPONENT_JAVA_CONFLICTS "libopencv3.0-java, libopencv3.0-jni")
144 set(CPACK_COMPONENT_JAVA_PROVIDES "libopencv3.0-java, libopencv3.0-jni")
145 set(CPACK_COMPONENT_JAVA_REPLACES "libopencv3.0-java, libopencv3.0-jni")
147 set(CPACK_COMPONENT_DOCS_CONFLICTS opencv-doc)
148 set(CPACK_COMPONENT_SAMPLES_CONFLICTS opencv-doc)
150 if(NOT OPENCV_CUSTOM_PACKAGE_INFO)
151 set(CPACK_COMPONENT_LIBS_DESCRIPTION "Open Computer Vision Library")
152 set(CPACK_DEBIAN_COMPONENT_LIBS_NAME "lib${CMAKE_PROJECT_NAME}")
154 set(CPACK_COMPONENT_PYTHON_DESCRIPTION "Python bindings for Open Source Computer Vision Library")
155 set(CPACK_DEBIAN_COMPONENT_PYTHON_NAME "lib${CMAKE_PROJECT_NAME}-python")
157 set(CPACK_COMPONENT_JAVA_DESCRIPTION "Java bindings for Open Source Computer Vision Library")
158 set(CPACK_DEBIAN_COMPONENT_JAVA_NAME "lib${CMAKE_PROJECT_NAME}-java")
160 set(CPACK_COMPONENT_DEV_DESCRIPTION "Development files for Open Source Computer Vision Library")
161 set(CPACK_DEBIAN_COMPONENT_DEV_NAME "lib${CMAKE_PROJECT_NAME}-dev")
163 set(CPACK_COMPONENT_DOCS_DESCRIPTION "Documentation for Open Source Computer Vision Library")
164 set(CPACK_DEBIAN_COMPONENT_DOCS_NAME "lib${CMAKE_PROJECT_NAME}-docs")
166 set(CPACK_COMPONENT_SAMPLES_DESCRIPTION "Samples for Open Source Computer Vision Library")
167 set(CPACK_DEBIAN_COMPONENT_SAMPLES_NAME "lib${CMAKE_PROJECT_NAME}-samples")
169 set(CPACK_COMPONENT_TESTS_DESCRIPTION "Accuracy and performance tests for Open Source Computer Vision Library")
170 set(CPACK_DEBIAN_COMPONENT_TESTS_NAME "lib${CMAKE_PROJECT_NAME}-tests")
171 endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
173 ocv_cmake_hook(PRE_CPACK)
175 ocv_cmake_hook(POST_CPACK)