{% set version = "3.1.0" %}
{% set buildnumber = 8 %}

package:
  name: opencv
  version: {{version}}

source:
  fn: opencv-{{ version }}.tar.gz
  url: https://github.com/opencv/opencv/archive/{{ version }}.tar.gz
  sha256: f3b160b9213dd17aa15ddd45f6fb06017fe205359dbd1f7219aad59c98899f15
  patches:
    - intel_use_ipp.patch

build:
    number: {{buildnumber}}
    features:
      - intel

requirements:
  build:
    - python
    - icc_rt
    - openssl 1.0.*         # [unix]
    - cmake
    - ipp-devel 2018.*
    - tbb-devel 2018.*
    - numpy x.x
    - hdf5 1.10.1           # [unix]
    - zlib 1.2.*
    - jpeg
    - libtiff 4.0.*
    - libpng >=1.6.21,<1.7
    - msinttypes            # [win and py<35]
    - protobuf              # [unix]

  run:
    - intelpython
    - python
    - icc_rt
    - numpy x.x
    - hdf5 1.10.1           # [unix]
    - zlib 1.2.*
    - jpeg
    - libtiff 4.0.*
    - libpng >=1.6.21,<1.7
    - ipp 2018.*
    - tbb 2018.*
    - protobuf              # [unix]

test:
    imports:
      - cv2
      - cv2.xfeatures2d

    commands:
        # Verify dynamic libraries.
        # "bioinspired", Not working in 3.1.0
        {% set opencv_libs = [
             "xfeatures2d",
             "ximgproc",
             "xobjdetect",
             "xphoto",
             "aruco",
             "bgsegm",
             "calib3d",
             "ccalib",
             "core",
             "datasets",
             "dnn",
             "dpm",
             "face",
             "features2d",
             "flann",
             "fuzzy",
             "highgui",
             "imgcodecs",
             "imgproc",
             "line_descriptor",
             "ml",
             "objdetect",
             "optflow",
             "photo",
             "plot",
             "reg",
             "rgbd",
             "saliency",
             "shape",
             "stereo",
             "stitching",
             "structured_light",
             "superres",
             "surface_matching",
             "text",
             "tracking",
             "video",
             "videoio",
             "videostab"
        ] %}
        {% for each_opencv_lib in opencv_libs %}
        - test -f $PREFIX/lib/libopencv_{{ each_opencv_lib }}.dylib                        # [osx]
        - test -f $PREFIX/lib/libopencv_{{ each_opencv_lib }}.so                           # [linux]
        - if not exist %PREFIX%\\Library\\bin\\opencv_{{ each_opencv_lib }}310.dll exit 1  # [win]
        {% endfor %}

about:
  home: http://opencv.org/
  license: BSD 3-clause
  summary: Computer vision and machine learning software library.

extra:
  recipe-maintainers:
    - jakirkham
    - msarahan
    - patricksnape
