cabal-version:       2.2

name:                libBF
version:             0.6.1
synopsis:            A binding to the libBF library.
description:         LibBF is a C library for working with arbitray precision
                     IEEE 754 floating point numbers.
bug-reports:         https://github.com/GaloisInc/libBF-hs/issues
license:             MIT
license-file:        LICENSE
author:              Iavor Diatchki
maintainer:          iavor.diatchki@gmail.com
-- copyright:
category:            Data
extra-source-files:  CHANGELOG.md

source-repository head
  type:     git
  location: https://github.com/GaloisInc/libBF-hs.git

flag system-libbf
  default:     False
  description: Use system libbf instead

library
  exposed-modules:
    LibBF,
    LibBF.Opts,
    LibBF.Mutable

  build-depends:
    base >=4.12.0.0 && < 5,
    deepseq,
    hashable >= 1.3

  build-tool-depends:
    hsc2hs:hsc2hs

  hs-source-dirs:      src

  if os(windows)
    extra-libraries: gcc_s

  if flag(system-libbf)
    extra-libraries: bf
    c-sources:
      cbits/libbf-hs.c
  else
    include-dirs:
      libbf-2020-01-19

    includes:
      libbf-2020-01-19/libbf.h

    install-includes:
      libbf-2020-01-19/libbf.h
      libbf-2020-01-19/cutils.h

    c-sources:
      libbf-2020-01-19/cutils.c
      libbf-2020-01-19/libbf.c
      cbits/libbf-hs.c

  ghc-options:         -Wall
  default-language:    Haskell2010

executable bf-test
  main-is:            RunUnitTests.hs
  hs-source-dirs:     tests
  build-depends:      base, libBF
  default-language:   Haskell2010


test-suite libBF-tests
  type:               exitcode-stdio-1.0
  hs-source-dirs:     tests
  main-is:            RunUnitTests.hs
  default-language:   Haskell2010
  build-depends:      base, libBF