cabal-version:   3.0
name:            halide-haskell
version:         0.0.2.0
synopsis:        Haskell bindings to Halide
description:
  Halide is a programming language designed to make it easier to write
  high-performance image and array processing code on modern machines. Rather
  than being a standalone programming language, Halide is embedded in C++. This
  means you write C++ code that builds an in-memory representation of a Halide
  pipeline using Halide's C++ API. You can then compile this representation to
  an object file, or JIT-compile it and run it in the same process.
  .
  This package provides Haskell bindings that allow to write Halide embedded in
  Haskell without C++.
  .
  The best way to learn Halide is to have a look at the
  [tutorials](https://github.com/twesterhout/halide-haskell/tree/master/tutorials).
  Reference documentation is provided by the haddocks of the 'Language.Halide'
  module.

homepage:        https://github.com/twesterhout/halide-haskell
bug-reports:     https://github.com/twesterhout/halide-haskell/issues
license:         BSD-3-Clause
license-file:    LICENSE
author:          Tom Westerhout
maintainer:
  Tom Westerhout <14264576+twesterhout@users.noreply.github.com>

category:        Language
copyright:       2022-2023 Tom Westerhout
build-type:      Simple
extra-doc-files:
  construction.png
  README.md

tested-with:     GHC ==9.2.7 || ==9.4.4 || ==9.4.5

source-repository head
  type:     git
  location: https://github.com/twesterhout/halide-haskell.git

common common-options
  build-depends:      base >=4.16.0.0 && <5
  ghc-options:
    -W -Wall -Wcompat -Widentities -Wincomplete-uni-patterns
    -Wincomplete-record-updates -Wredundant-constraints
    -fhide-source-paths -Wmissing-export-lists -Wpartial-fields
    -Wmissing-deriving-strategies

  default-language:   GHC2021
  default-extensions:
    DataKinds
    DerivingStrategies
    FunctionalDependencies
    LambdaCase
    OverloadedRecordDot
    OverloadedStrings
    TypeFamilies
    ViewPatterns

library
  import:          common-options
  hs-source-dirs:  src
  exposed-modules: Language.Halide
  other-modules:
    Language.Halide.BoundaryConditions
    Language.Halide.Buffer
    Language.Halide.Context
    Language.Halide.Dimension
    Language.Halide.Expr
    Language.Halide.Func
    Language.Halide.Kernel
    Language.Halide.LoopLevel
    Language.Halide.RedundantConstraints
    Language.Halide.Schedule
    Language.Halide.Target
    Language.Halide.Trace
    Language.Halide.Type
    Language.Halide.Utils

  -- Language.Halide.Prelude
  build-depends:
    , bytestring        >=0.11.1.0 && <0.12
    , constraints       >=0.13.4   && <0.14
    , filepath          >=1.4.2.1  && <2.0
    , inline-c          >=0.9.1.6  && <0.10
    , inline-c-cpp      >=0.5.0.0  && <0.6
    , primitive         >=0.7.3.0  && <0.8
    , template-haskell  >=2.18.0.0 && <3.0
    , temporary         >=1.3      && <2.0
    , text              >=1.2.5.0  && <3.0
    , vector            >=0.12.3.0 && <0.13

  if os(windows)
    cpp-options:   -DUSE_DLOPEN=0
    build-depends: Win32

  else
    cpp-options:   -DUSE_DLOPEN=1
    build-depends: unix >=2.7.2.2 && <3.0

  extra-libraries: Halide

  -- if os(linux)
  --   extra-libraries: stdc++

  -- if os(osx)
  --   extra-libraries: iconv

  cxx-options:     -std=c++17 -Wall
  ghc-options:     -optcxx-std=c++17 -optcxx-Wall

executable halide-haskell
  import:         common-options
  hs-source-dirs: example
  main-is:        Example01.hs
  build-depends:
    , halide-haskell
    , vector

executable getting-started
  import:         common-options
  hs-source-dirs: example
  main-is:        GettingStarted.hs
  build-depends:
    , halide-haskell
    , vector

executable halide-minimal-gpu
  import:         common-options
  hs-source-dirs: example
  main-is:        MinimalGPU.hs
  build-depends:
    , halide-haskell
    , vector

test-suite halide-haskell-test
  import:         common-options
  type:           exitcode-stdio-1.0
  hs-source-dirs: test
  main-is:        Spec.hs
  other-modules:
    Language.Halide.BoundaryConditionsSpec
    Language.Halide.BufferSpec
    Language.Halide.ExprSpec
    Language.Halide.FuncSpec
    Language.Halide.KernelSpec
    Language.Halide.LoopLevelSpec
    Language.Halide.ScheduleSpec
    Language.Halide.TargetSpec
    Utils

  build-depends:
    , halide-haskell
    , hspec           >=2.9.7   && <3
    , HUnit           >=1.6.2.0 && <1.7
    , inline-c
    , inline-c-cpp
    , QuickCheck      >=2.14.2  && <3
    , text
    , vector

  cxx-options:    -std=c++17 -Wall
  ghc-options:
    -threaded -rtsopts -with-rtsopts=-N -optcxx-std=c++17 -optcxx-Wall
    -Wno-missing-export-lists

-- build-tools-depends: hspec-discover:hspec-discover