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

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

source:
  url:
    - {{ cran_mirror }}/src/contrib/CVXR_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/CVXR/CVXR_{{ version }}.tar.gz
  sha256: e92a9638f35f4909e2a29c3b7106081e3dae7ff88b14bb6466b87fbdc80b972a

build:
  merge_build_host: true  # [win]
  number: 1
  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-ecosolver >=0.5.4
    - r-matrix
    - r-r6
    - r-rcpp >=0.12.12
    - r-rcppeigen
    - r-rmpfr
    - r-bit64
    - r-gmp
    - r-osqp
    - r-scs >=3.0
  run:
    - r-base
    - {{ native }}gcc-libs         # [win]
    - r-ecosolver >=0.5.4
    - r-matrix
    - r-r6
    - r-rcpp >=0.12.12
    - r-rcppeigen
    - r-rmpfr
    - r-bit64
    - r-gmp
    - r-osqp
    - r-scs >=3.0

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

about:
  home: https://cvxr.rbind.io, https://www.cvxgrp.org/CVXR/
  license: Apache-2.0
  summary: An object-oriented modeling language for disciplined convex programming (DCP) as described in Fu, Narasimhan, and Boyd (2020, <doi:10.18637/jss.v094.i14>). It allows the user to formulate convex optimization problems in a natural way following mathematical convention and DCP rules. The system analyzes the problem,
    verifies its convexity, converts it into a canonical form, and hands it off to an appropriate solver to obtain the solution. Interfaces to solvers on CRAN and elsewhere are provided, both commercial and open source.
  license_family: APACHE
  license_file:
    - APACHE-2.0.txt
    - LICENSE

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