# Copyright (c) 2023, NVIDIA CORPORATION.

{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').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: kvikio
  version: {{ version }}

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

build:
  number: {{ GIT_DESCRIBE_NUMBER }}
  string: cuda{{ cuda_major }}_py{{ py_version }}_{{ date_string }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
  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=kvikio-aarch64 # [aarch64]
    - SCCACHE_S3_KEY_PREFIX=kvikio-linux64 # [linux64]
    - SCCACHE_S3_USE_SSL
    - SCCACHE_S3_NO_CREDENTIALS
  script:
    - cd python
    - python -m pip install . -vv
  ignore_run_exports_from:
    - {{ compiler('cuda') }}

requirements:
  build:
    - cmake >=3.23.1,!=3.25.0
    - ninja
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - {{ compiler('cuda') }} {{ cuda_version }}
    - sysroot_{{ target_platform }} {{ sysroot_version }}
  host:
    - python
    - setuptools
    - pip
    - cython >=0.29,<0.30
    - cudatoolkit {{ cuda_version }}.*
    - scikit-build >=0.13.1
    - libkvikio {{ version }}
  run:
    - python
    - numpy >=1.20
    - cupy >=12.0.0
    - zarr
    - {{ pin_compatible('cudatoolkit', max_pin='x', min_pin='x') }}

test:
  requires:
    - pytest
  imports:
    - kvikio

about:
  home: https://rapids.ai
  license: Apache-2.0
  license_family: Apache
  license_file: LICENSE
  summary: KvikIO - GPUDirect Storage
