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

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

source:
  url: https://github.com/Esri/lerc/archive/v{{ version }}.tar.gz
  sha256: c1525c407db91e858f5870075c5f1566d2845863d39690eb4cff46ec7a7ad116
  # 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
