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

{% set version = environ['RAPIDS_PACKAGE_VERSION'].lstrip('v') %}
{% set py_version = environ['CONDA_PY'] %}
{% set cuda_version = '.'.join(environ['RAPIDS_CUDA_VERSION'].split('.')[:2]) %}
{% set cuda_major = cuda_version.split('.')[0] %}
{% set date_string = environ['RAPIDS_DATE_STRING'] %}


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

source:
  path: ../../..

build:
  number: {{ GIT_DESCRIBE_NUMBER }}
  string: cuda{{ cuda_major }}_py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
  ignore_run_exports_from:
    {% if cuda_major == "11" %}
    - {{ compiler('cuda11') }}
    {% else %}
    - {{ compiler('cuda') }}
    - cuda-cudart-dev
    {% endif %}
  script_env:
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY
    - AWS_SESSION_TOKEN
    - 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]
    - SCCACHE_S3_USE_SSL
    - SCCACHE_S3_NO_CREDENTIALS

requirements:
  build:
    - {{ compiler("c") }}
    - {{ compiler("cxx") }}
    {% if cuda_major == "11" %}
    - {{ compiler('cuda11') }} ={{ cuda_version }}
    {% else %}
    - {{ compiler('cuda') }}
    {% endif %}
    - cuda-version ={{ cuda_version }}
    - cmake {{ cmake_version }}
    - make
    - ninja
    - {{ stdlib("c") }}
  host:
    - click
    - cuda-version ={{ cuda_version }}
    {% if cuda_major != "11" %}
    - cuda-cudart-dev
    {% endif %}
    - cupy >=12.0.0
    - libcucim ={{ version }}
    - python
    - rapids-build-backend >=0.3.0,<0.4.0.dev0
    - scikit-image >=0.19.0,<0.25.0a0
    - scipy >=1.6
    - setuptools >=24.2.0
  run:
    - {{ pin_compatible('cuda-version', max_pin='x', min_pin='x') }}
    {% if cuda_major != "11" %}
    - cuda-cudart
    {% endif %}
    - numpy >=1.23,<3.0a0
    - click
    - cupy >=12.0.0
    - lazy_loader >=0.1
    - libcucim ={{ version }}
    - python
    - scikit-image >=0.19.0,<0.25.0a0
    - scipy >=1.6
  run_constrained:
    - openslide-python >=1.3.0

tests:
  requirements:
    - cuda-version ={{ cuda_version }}
  imports:
    - cucim

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