# Copyright (c) 2021-2022, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[2] %}
{% set py_version = environ['CONDA_PY'] %}
{% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %}
{% set cuda_major = cuda_version.split('.')[0] %}

package:
  name: cucim
  version: {{ version }}

source:
  git_url: ../../..

build:
  number: {{ GIT_DESCRIBE_NUMBER }}
  string: cuda_{{ cuda_major }}_py{{ py_version }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
  script_env:
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY
    - CMAKE_C_COMPILER_LAUNCHER
    - CMAKE_CUDA_COMPILER_LAUNCHER
    - CMAKE_CXX_COMPILER_LAUNCHER
    - CMAKE_GENERATOR
    - PARALLEL_LEVEL
    - SCCACHE_BUCKET
    - SCCACHE_IDLE_TIMEOUT
    - SCCACHE_REGION
    - SCCACHE_S3_KEY_PREFIX=cucim-aarch64 # [aarch64]
    - SCCACHE_S3_KEY_PREFIX=cucim-linux64 # [linux64]

requirements:
  build:
    - {{ compiler("c") }}
    - {{ compiler("cxx") }}
    - cmake >=3.23.1,!=3.25.0
    - make
    - ninja
    - sysroot_{{ target_platform }} {{ sysroot_version }}
  host:
    - click
    - cudatoolkit ={{ cuda_version }}
    - cupy >=10,<12.0.0a0
    - libcucim ={{ version }}
    - numpy 1.21
    - python
    - scikit-image >=0.19.0,<0.20.0a0
    - scipy
  run:
    - {{ pin_compatible('cudatoolkit', max_pin='x', min_pin='x') }}
    - {{ pin_compatible('numpy') }}
    - click
    - cupy >=10,<12.0.0a0
    - libcucim ={{ version }}
    # - openslide # skipping here but benchmark binary would need openslide library
    - python
    - scikit-image >=0.19.0,<0.20.0a0
    - scipy

# TODO: Remove the linux64 tags on tests after disabling gpuCI / Jenkins
tests:                                 # [linux64]
  requirements:                        # [linux64]
    - cudatoolkit ={{ cuda_version }}  # [linux64]
  imports:                             # [linux64]
    - cucim                            # [linux64]

about:
  home: https://developer.nvidia.com/multidimensional-image-processing
  summary: cucim Python package
  license: Apache-2.0
  license_family: Apache
  license_file: LICENSE
  doc_url: https://docs.rapids.ai/api/cucim/stable/
  dev_url: https://github.com/rapidsai/cucim
