# GPU variant, builds GPU variants of libxgboost and py-xgboost packages
{% set name = "xgboost" %}
{% set version = "0.80" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  git_url: https://github.com/dmlc/xgboost
  # corresponds to 0.80 tag
  git_tag: 6852d0afd5d7dde7613bb9b9c1fffab1ee60cfd6
  patches:
    # xgboost patches
    - 0001-conda-Unbundle-libxgboost.-dll-dylib-so.patch
    - 0002-Fix-R-package-PKGROOT.patch
    - 0003-Fix-R-package-mingw-w64-compiler-flags-remove-m64.patch
    - 0004-Fix-configure-check-for-OpenMP-on-macOS.patch
    - 0005-Add-ADD_-FLAGS-to-end-of-commandlines.patch

build:
  skip: true  # [not linux64 and not win64]

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake
    - git
    - make  # [linux]
  host:
    - cudatoolkit {{ cudatoolkit }}*

outputs:
  - name: libxgboost
    script: install-libxgboost.sh   # [linux]
    script: install-libxgboost.bat  # [win]
    requirements:
      build:
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
        - git
        - make
      host:
        - cudatoolkit {{ cudatoolkit }}*
      run:
        - cudatoolkit {{ cudatoolkit }}*

  - name: _py-xgboost-mutex
    version: 1.0
    build:
      string: gpu_0

  - name: py-xgboost
    script: install-py-xgboost.sh  # [linux]
    script: install-py-xgboost.sh  # [win]
    requirements:
      build:
        - {{ compiler('c') }}
        - {{ compiler('cxx') }}
      host:
        - {{ pin_subpackage('libxgboost', exact=True) }}
        - cudatoolkit {{ cudatoolkit }}*
        - python
        - setuptools
      run:
        - {{ pin_subpackage('libxgboost', exact=True) }}
        - {{ pin_subpackage('_py-xgboost-mutex', exact=True) }}
        - cudatoolkit {{ cudatoolkit }}*
        - python
        - numpy
        - scipy
        - scikit-learn
    test:
      script: test-py-xgboost.py

  - name: py-xgboost-gpu
    requirements:
      host:
        - python
      run:
        - python
        - {{ pin_subpackage('py-xgboost', exact=True) }}
    # present to include cuda version in hash
    extra:
      toolkitused: {{ cudatoolkit }}
