{% set build_number = "1" %}

package:
  name: libmxnet
  version: {{ mxnet_version }}

source:
  git_url: https://github.com/apache/incubator-mxnet.git
  git_rev: {{ mxnet_version }}
  patches:
    - patches/0001-Relax-constraints-on-requests-make-graphviz-optional.patch
    - patches/0002-OpenCV-Libs-Specify-explicitly.patch
#    - patches/0003-Also-attempt-pkg-config-for-jemalloc.patch
    - patches/0004-Check-if-HOME_MKL-is-empty-before-using-it.patch
    - patches/0005-Make-choice-of-archiver-configurable.patch
    - patches/0006-Fix-library-name-of-Intel-OMP-library.patch
    - patches/0007-Also-build-libmxnet_static-on-Windows.patch  # ['gpu' not in str(mxnet_variant_str)]
    - patches/0008-Add-workaround-for-broken-opencv-cmake-files.patch
    - patches/0009-Add-MKLDNNROOT-lib-to-RPATH.patch
    - patches/0010-Don-t-change-rpath-to-loader_path.patch
    - patches/0011-Add-path_suffixes-for-finding-cudnn.lib.patch

build:
  string: {{ mxnet_variant_str }}_h{{PKG_HASH}}_{{ build_number }}
  number: {{ build_number }}
  skip: True              # [win and vc<14]
  missing_dso_whitelist:  # [linux]
    - libcuda.so.1        # [linux]

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - pkg-config  # [not win]
    - make        # [not win]
    - cmake       # [win]
    - python 2.7
  host:
#    - jemalloc                               # [linux]
    - mkl-dnn                                # [unix and (mxnet_blas_impl == 'mkl')]
    - mklml                                  # [unix and (mxnet_blas_impl == 'mkl')]
    - mkl-devel                              # [win and (mxnet_blas_impl == 'mkl')]
    - intel-openmp                           # [mxnet_blas_impl == 'mkl']
    - openblas-devel                         # [mxnet_blas_impl == 'openblas']
    - libopencv                              # [unix]
    - opencv                                 # [win]
    - cudatoolkit {{ cudatoolkit_version }}  # ['gpu' in str(mxnet_variant_str)]
    - cudnn {{ cudnn_version }}              # ['gpu' in str(mxnet_variant_str)]
  run:
    - _mutex_mxnet {{ mxnet_variant_version }} {{ mxnet_variant_str }}
    - cudatoolkit {{ cudatoolkit_version }}  # ['gpu' in str(mxnet_variant_str)]
    - cudnn {{ cudnn_version }}              # ['gpu' in str(mxnet_variant_str)]
    - {{ pin_compatible('mkl-dnn') }}        # [unix and (mxnet_blas_impl == 'mkl')]
    - {{ pin_compatible('intel-openmp') }}   # [mxnet_blas_impl == 'mkl']

test:
  commands:
    - im2rec -h   # [not win]
  requires:       # [x86 and mxnet_blas_impl != 'mkl']
    - nomkl       # [x86 and mxnet_blas_impl != 'mkl']

about:
  home: http://mxnet.io
  license: Apache-2
  license_file: LICENSE
  license_family: Apache
  summary: MXNet is a deep learning framework designed for both efficiency and flexibility
  description: |
    Apache MXNet (incubating) is a deep learning framework designed for both
    efficiency and flexibility. It allows you to mix symbolic and imperative
    programming to maximize efficiency and productivity. At its core, MXNet
    contains a dynamic dependency scheduler that automatically parallelizes both
    symbolic and imperative operations on the fly. A graph optimization layer on
    top of that makes symbolic execution fast and memory efficient. MXNet is
    portable and lightweight, scaling effectively to multiple GPUs and multiple
    machines. MXNet is also more than a deep learning project. It is also a
    collection of blue prints and guidelines for building deep learning systems,
    and interesting insights of DL systems for hackers.
  dev_url: https://github.com/apache/incubator-mxnet
  doc_url: https://mxnet.incubator.apache.org/

extra:
  recipe-maintainers:
    - nehaljwani
