{% set name = "lerc" %}
{% set version = "4.0.0" %}

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

source:
  url: https://github.com/Esri/lerc/archive/v{{ version }}.tar.gz
  sha256: 91431c2b16d0e3de6cbaea188603359f87caed08259a645fd5a3805784ee30a0
  # CMakeLists.txt taken from master, and adapted for better compatibility
  # PR made: https://github.com/Esri/lerc/pull/128

build:
  number: 0
  run_exports:
    # No real information, keep conda-forge defaults
    - {{ pin_subpackage('lerc', max_pin='x') }}

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake
    - make  # [unix]
    - ninja  # [win]
  #host:
    # TODO: add support for
    # gdal
    # geotiff

test:
  commands:
    - if not exist %LIBRARY_INC%\Lerc_types.h exit 1  # [win]
    - if not exist %LIBRARY_BIN%\Lerc.dll exit 1      # [win]
    - if not exist %LIBRARY_LIB%\Lerc.lib exit 1      # [win]
    - test -f ${PREFIX}/lib/libLerc${SHLIB_EXT}       # [unix]
    - test -f ${PREFIX}/include/Lerc_types.h          # [unix]

about:
  home: https://github.com/Esri/lerc
  license: Apache-2.0
  license_family: Apache
  license_file: LICENSE
  summary: LERC - Limited Error Raster Compression

  description: |
    LERC is an open-source image or raster format which
    supports rapid encoding and decoding for any pixel type
    (not just RGB or Byte). Users set the maximum compression
    error per pixel while encoding, so the precision of the
    original input image is preserved (within user defined
    error bounds).

extra:
  recipe-maintainers:
    - hmaarrfk