-- Initial generic-storable-plugin.cabal generated by cabal init.  For 
-- further documentation, see http://haskell.org/cabal/users-guide/

name:                derive-storable-plugin
version:             0.2.3.5
synopsis:            GHC core plugin supporting the derive-storable package.
description:         The package helps derive-storable package in forcing compile time evaluation of
                     sizes, alignments and offsets.
homepage:            https://www.github.com/mkloczko/derive-storable-plugin/
license:             MIT
license-file:        LICENSE
author:              Mateusz Kłoczko
maintainer:          mateusz.p.kloczko@gmail.com
-- copyright:           
category:            Foreign
build-type:          Simple
extra-source-files:  ChangeLog.md README.md
cabal-version:       >=1.10
tested-with:         GHC==8.2.2, GHC==8.4.2, GHC==8.6.5, GHC==8.8.1, GHC==8.10.7, GHC==9.0.2, GHC==9.2.2

Flag sumtypes
  Description:   Use sumtypes within benchmark and tests.
  Default:       False

library
  exposed-modules:       Foreign.Storable.Generic.Plugin
                       , Foreign.Storable.Generic.Plugin.Internal
                       , Foreign.Storable.Generic.Plugin.Internal.Error
                       , Foreign.Storable.Generic.Plugin.Internal.Compile
                       , Foreign.Storable.Generic.Plugin.Internal.GroupTypes
                       , Foreign.Storable.Generic.Plugin.Internal.Helpers
                       , Foreign.Storable.Generic.Plugin.Internal.Predicates
                       , Foreign.Storable.Generic.Plugin.Internal.Types
  other-extensions:    DeriveGeneric, DeriveAnyClass, PatternGuards
  build-depends:       base >=4.10 && <5, ghc >= 8.2 && < 9.3, ghci >= 8.2 && < 9.3, derive-storable >= 0.3 && < 0.4
  hs-source-dirs:      src
  default-language:    Haskell2010

benchmark plugin-benchmark
  type:                exitcode-stdio-1.0
  hs-source-dirs:      benchmark/
  default-language:    Haskell2010
  other-modules:       TestCases, TestCasesOptimized
  Main-is:             Main.hs
  build-depends:       base >= 4.10 && < 5, deepseq, criterion >= 1.1.0
                    ,  derive-storable, derive-storable-plugin

  if flag(sumtypes)
    cpp-options: -DGSTORABLE_SUMTYPES

  if impl(ghc < 8.4)
    build-depends: text < 1.2.5.0

test-suite c_alignment
  type:                exitcode-stdio-1.0
  
  hs-source-dirs:      test/Basic, test/Basic/cbits
  c-sources:           test/Basic/cbits/TestCases.c 
  main-is:             MemoryCSpec.hs
  other-modules:       TestCases 
  build-depends:       base >= 4.10 && < 5, derive-storable, derive-storable-plugin
                     , hspec >= 2.4, QuickCheck >= 2.10
                     , ghc >= 8.2 && < 9.3, ghci >= 8.2 && < 9.3
  
  default-language:    Haskell2010
  if flag(sumtypes)
    cpp-options: -DGSTORABLE_SUMTYPES