Home | History | Annotate | Download | only in cmake
      1 if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
      2 set(CPACK_set_DESTDIR "on")
      3 
      4 if(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
      8 and machine learning software library. OpenCV was built to provide a common
      9 infrastructure for computer vision applications and to accelerate the use of
     10 machine perception in the commercial products. Being a BSD-licensed product,
     11 OpenCV 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 (a] 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}")
     19 endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
     20 
     21 #arch
     22 if(X86)
     23   set(CPACK_DEBIAN_ARCHITECTURE "i386")
     24   set(CPACK_RPM_PACKAGE_ARCHITECTURE "i686")
     25 elseif(X86_64)
     26   set(CPACK_DEBIAN_ARCHITECTURE "amd64")
     27   set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64")
     28 elseif(ARM)
     29   set(CPACK_DEBIAN_ARCHITECTURE "armhf")
     30   set(CPACK_RPM_PACKAGE_ARCHITECTURE "armhf")
     31 else()
     32   set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
     33   set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
     34 endif()
     35 
     36 if(CPACK_GENERATOR STREQUAL "DEB")
     37   set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_DEBIAN_ARCHITECTURE})
     38 elseif(CPACK_GENERATOR STREQUAL "RPM")
     39   set(OPENCV_PACKAGE_ARCH_SUFFIX ${CPACK_RPM_PACKAGE_ARCHITECTURE})
     40 else()
     41   set(OPENCV_PACKAGE_ARCH_SUFFIX ${CMAKE_SYSTEM_PROCESSOR})
     42 endif()
     43 
     44 set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
     45 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${OPENCV_VCSVERSION}-${OPENCV_PACKAGE_ARCH_SUFFIX}")
     46 
     47 #rpm options
     48 set(CPACK_RPM_COMPONENT_INSTALL TRUE)
     49 set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
     50 set(CPACK_RPM_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})
     51 set(CPACK_RPM_PACKAGE_URL "http://opencv.org")
     52 set(CPACK_RPM_PACKAGE_LICENSE "BSD")
     53 
     54 #deb options
     55 set(CPACK_DEB_COMPONENT_INSTALL TRUE)
     56 set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
     57 set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
     58 set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org")
     59 
     60 #display names
     61 set(CPACK_COMPONENT_DEV_DISPLAY_NAME     "Development files")
     62 set(CPACK_COMPONENT_DOCS_DISPLAY_NAME    "Documentation")
     63 set(CPACK_COMPONENT_JAVA_DISPLAY_NAME    "Java bindings")
     64 set(CPACK_COMPONENT_LIBS_DISPLAY_NAME    "Libraries and data")
     65 set(CPACK_COMPONENT_PYTHON_DISPLAY_NAME  "Python bindings")
     66 set(CPACK_COMPONENT_SAMPLES_DISPLAY_NAME "Samples")
     67 set(CPACK_COMPONENT_TESTS_DISPLAY_NAME   "Tests")
     68 
     69 #depencencies
     70 set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
     71 set(CPACK_COMPONENT_LIBS_REQUIRED TRUE)
     72 set(CPACK_COMPONENT_SAMPLES_DEPENDS libs)
     73 set(CPACK_COMPONENT_DEV_DEPENDS libs)
     74 set(CPACK_COMPONENT_DOCS_DEPENDS libs)
     75 set(CPACK_COMPONENT_JAVA_DEPENDS libs)
     76 set(CPACK_COMPONENT_PYTHON_DEPENDS libs)
     77 set(CPACK_COMPONENT_TESTS_DEPENDS libs)
     78 
     79 if(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)
     97 endif()
     98 
     99 if(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")
    120 endif(NOT OPENCV_CUSTOM_PACKAGE_INFO)
    121 
    122 include(CPack)
    123 
    124 ENDif(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")