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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/osqp_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/osqp/osqp_{{ version }}.tar.gz
  sha256: 18543b329a42be0f419dff4aa42f4401c2afb18f46276ce359853494dd803244

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 }}sed               # [win]
    - {{ posix }}grep              # [win]
    - {{ posix }}autoconf
    - {{ posix }}automake          # [not win]
    - {{ posix }}automake-wrapper  # [win]
    - {{ posix }}pkg-config
    - {{ posix }}make
    - {{ posix }}coreutils         # [win]
    - {{ posix }}zip               # [win]
    - cross-r-base {{ r_base }}    # [build_platform != target_platform]
  host:
    - r-base
    - r-matrix >=1.6.1
    - r-r6
    - r-rcpp >=0.12.14
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-matrix >=1.6.1
    - r-r6
    - r-rcpp >=0.12.14

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

about:
  home: https://www.osqp.org
  license: Apache-2.0
  summary: Provides bindings to the 'OSQP' solver. The 'OSQP' solver is a numerical optimization package or solving convex quadratic programs written in 'C' and based on the alternating direction method of multipliers. See <arXiv:1711.08013> for details.
  license_family: APACHE
  license_file:
    - APACHE-2.0.txt
    - LICENSE

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