packages feed

dear-imgui-1.2.2: dear-imgui.cabal

cabal-version: 3.0

name: dear-imgui
version: 1.2.2
author: Oliver Charles
maintainer: ollie@ocharles.org.uk, aenor.realm@gmail.com
license: BSD-3-Clause

category: Graphics
synopsis: Haskell bindings for Dear ImGui.
description:
  The package supports multiple rendering backends.
  Set package flags according to your needs.

build-type: Simple
extra-source-files:
  README.md,
  ChangeLog.md

extra-source-files:
  imgui/*.h,
  imgui/backends/*.h,
  imgui/backends/*.mm,
  imgui/imconfig.h,
  imgui/LICENSE.txt

common build-flags
  if flag(debug)
    if os(linux)
      ghc-options: -Wall -g -rtsopts -dcore-lint -debug
      cc-options: -g -O0 -fsanitize=address -fno-omit-frame-pointer
      cxx-options: -g -O0 -fsanitize=address -fno-omit-frame-pointer -std=c++11
    if os(darwin)
      ghc-options: -Wall -g -rtsopts -dcore-lint -debug
      cc-options: -g -O0 -fsanitize=address -fno-omit-frame-pointer
      cxx-options: -g -O0 -fsanitize=address -fno-omit-frame-pointer -std=c++11
    if os(windows)
      ghc-options: -Wall -g -rtsopts -dcore-lint -debug
      cc-options: -g -O0
      cxx-options: -g -O0 -std=c++11
  else
    if os(linux)
      ghc-options: -Wall -O2
      cc-options: -O2
      cxx-options: -std=c++11 -O2
    if os(darwin)
      ghc-options: -Wall -O2
      cc-options: -O2
    if os(windows)
      ghc-options: -Wall -O2
      cc-options: -O2


source-repository head
  type: git
  location: https://github.com/haskell-game/dear-imgui.hs

flag debug
  description:
    Enable debug mode.
  default:
    False
  manual:
    True

flag opengl2
  description:
    Enable OpenGL 2 backend.
  default:
    False
  manual:
    True

flag opengl3
  description:
    Enable OpenGL 3 backend.
  default:
    True
  manual:
    True

flag vulkan
  description:
    Enable Vulkan backend.
  default:
    False
  manual:
    True

flag sdl
  description:
    Enable SDL backend.
  default:
    True
  manual:
    True

flag glfw
  description:
    Enable GLFW backend.
  default:
    False
  manual:
    True

flag examples
  description:
    Build executable examples.
  default:
    False
  manual:
    True

common common
  build-depends:
      base
        >= 4.12 && < 4.17
  default-language:
      Haskell2010

library
  import: common
  hs-source-dirs:
    src
  exposed-modules:
    DearImGui
    DearImGui.Raw
    DearImGui.Raw.DrawList
    DearImGui.Raw.ListClipper
    DearImGui.Raw.IO
  other-modules:
    DearImGui.Context
    DearImGui.Enums
    DearImGui.Structs
  cxx-options: -std=c++11
  cxx-sources:
    imgui/imgui.cpp
    imgui/imgui_demo.cpp
    imgui/imgui_draw.cpp
    imgui/imgui_tables.cpp
    imgui/imgui_widgets.cpp
  extra-libraries:
    stdc++
  include-dirs:
    imgui
  build-depends:
      dear-imgui-generator
    , containers
    , managed
    , inline-c
    , inline-c-cpp
    , StateVar
    , unliftio
    , vector

  if flag(opengl2)
    exposed-modules:
      DearImGui.OpenGL2
    cxx-sources:
      imgui/backends/imgui_impl_opengl2.cpp
    build-depends:
      gl

  if flag(opengl3)
    exposed-modules:
      DearImGui.OpenGL3
    cxx-sources:
      imgui/backends/imgui_impl_opengl3.cpp
    pkgconfig-depends:
      glew

  if flag(vulkan)
    exposed-modules:
      DearImGui.Vulkan
    other-modules:
      DearImGui.Vulkan.Types
    build-depends:
        vulkan
      , unliftio
    cxx-sources:
      imgui/backends/imgui_impl_vulkan.cpp
    if os(windows)
      extra-libraries:
        vulkan-1
    else
      if os(darwin)
        extra-libraries:
          vulkan
      else
        pkgconfig-depends:
          vulkan

  if flag(sdl)
    exposed-modules:
      DearImGui.SDL
    build-depends:
      sdl2
    cxx-sources:
      imgui/backends/imgui_impl_sdl.cpp

    if os(windows) || os(darwin)
      extra-libraries:
        SDL2
    else
      pkgconfig-depends:
        sdl2

    if flag(opengl2) || flag(opengl3)
      exposed-modules:
        DearImGui.SDL.OpenGL

    if flag(vulkan)
      exposed-modules:
        DearImGui.SDL.Vulkan

  if flag(glfw)
    exposed-modules:
      DearImGui.GLFW
    build-depends:
      GLFW-b,
      bindings-GLFW
    cxx-sources:
      imgui/backends/imgui_impl_glfw.cpp

    if os(linux) || os(darwin)
      pkgconfig-depends:
        glfw3

    if flag(opengl2) || flag(opengl3)
      exposed-modules:
        DearImGui.GLFW.OpenGL

    if flag(vulkan)
      exposed-modules:
        DearImGui.GLFW.Vulkan

library dear-imgui-generator
  import: common
  hs-source-dirs: generator
  exposed-modules:
      DearImGui.Generator
    , DearImGui.Generator.Parser
    , DearImGui.Generator.Tokeniser
    , DearImGui.Generator.Types
  build-depends:
      template-haskell
        >= 2.15 && < 2.19
    , containers
       ^>= 0.6.2.1
    , directory
        >= 1.3 && < 1.4
    , filepath
        >= 1.4 && < 1.5
    , inline-c
        >= 0.9.0.0 && < 0.10
    , megaparsec
        >= 9.0 && < 9.3
    , parser-combinators
        >= 1.2.0 && < 1.4
    , scientific
        >= 0.3.6.2 && < 0.3.8
    , text
        >= 1.2.4 && < 1.3
    , th-lift
        >= 0.7 && < 0.9
    , transformers
        >= 0.5.6 && < 0.6
    , unordered-containers
        >= 0.2.11 && < 0.2.15

executable test
  import: common, build-flags
  main-is: Main.hs
  default-language: Haskell2010
  if (!flag(examples) || !flag(sdl) || !flag(opengl2))
    buildable: False
  else
    build-depends: base, sdl2, gl, dear-imgui, vector

executable glfw
  import: common, build-flags
  main-is: Main.hs
  hs-source-dirs: examples/glfw
  default-language: Haskell2010
  if (!flag(examples) || !flag(glfw) || !flag(opengl2))
    buildable: False
  else
    build-depends: base, GLFW-b, gl, dear-imgui, managed

executable readme
  import: common, build-flags
  main-is: Readme.hs
  hs-source-dirs: examples
  build-depends: sdl2, gl, dear-imgui, managed
  if (!flag(examples) || !flag(sdl) || !flag(opengl2))
    buildable: False

executable image
  import: common, build-flags
  main-is: Image.hs
  hs-source-dirs: examples/sdl
  build-depends: sdl2, gl, dear-imgui, managed, vector
  if (!flag(examples) || !flag(sdl) || !flag(opengl2))
    buildable: False

executable vulkan
  import: common, build-flags
  main-is: Main.hs
  other-modules: Attachments, Backend, Input, Util
  hs-source-dirs: examples/vulkan
  default-language: Haskell2010
  if (!flag(examples) || !flag(sdl) || !flag(vulkan))
    buildable: False
  else
    build-depends:
        dear-imgui
      , bytestring
          >= 0.10.10.0 && < 0.12
      , containers
         ^>= 0.6.2.1
      , logging-effect
         ^>= 1.3.12
      , resourcet
         ^>= 1.2.4.2
      , sdl2
         ^>= 2.5.3.0
      , text-short
         ^>= 0.1.3
      , transformers
         ^>= 0.5.6.2
      , unliftio
          >= 0.2.13 && < 0.2.19
      , unliftio-core
         ^>= 0.2.0.1
      , vector
         ^>= 0.12.1.2
      , vulkan
         ^>= 3.9
      , vulkan-utils
         ^>= 0.4.1