{% set version = '0.1.6' %}
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: r-rcppde
  version: {{ version|replace("-", "_") }}

source:
  url:
    - {{ cran_mirror }}/src/contrib/RcppDE_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/RcppDE/RcppDE_{{ version }}.tar.gz
  sha256: c9386709f72cdc33505b3ac675c173013fe098434b7c21bc09eb625b529132c5

build:
  merge_build_host: True  # [win]
  number: 0
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}              # [not win]
    - {{ compiler('m2w64_c') }}        # [win]
    - {{ compiler('cxx') }}            # [not win]
    - {{ compiler('m2w64_cxx') }}      # [win]
    - {{ posix }}filesystem        # [win]
    - {{ posix }}make
    - {{ posix }}sed               # [win]
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
    - cross-r-base {{ r_base }}    # [build_platform != target_platform]
  host:
    - r-base
    - r-rcpp
    - r-rcpparmadillo
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-rcpp
    - r-rcpparmadillo

test:
  commands:
    - $R -e "library('RcppDE')"           # [not win]
    - "\"%R%\" -e \"library('RcppDE')\""  # [win]

about:
  home: https://CRAN.R-project.org/package=RcppDE
  license: GPL-2.0-or-later
  summary: 'An efficient C++ based implementation of the ''DEoptim'' function which performs
    global optimization by differential evolution. Its creation was motivated by trying
    to see if the old approximation "easier, shorter, faster: pick any two" could in
    fact be extended to achieving all three goals while moving the code from plain old
    C to modern C++.  The initial version did in fact do so, but a good part of the
    gain was due to an implicit code review which eliminated a few inefficiencies which
    have since been eliminated in ''DEoptim''.'
  license_family: GPL2
  license_file:
    - {{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2

extra:
  recipe-maintainers:
    - conda-forge/r
