Build executables conditionally on features (#41)

* Build executables conditionally on features

* Put away examples under a flag
This commit is contained in:
Alexander Bondarenko 2021-03-12 01:59:57 +03:00 committed by GitHub
parent 2eddbdfa04
commit ebd5286e1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,3 @@
packages: *.cabal
package dear-imgui
flags: +sdl2 +glfw +opengl2 +opengl3 +vulkan
flags: +sdl2 +glfw +opengl2 +opengl3 +vulkan +examples

View File

@ -45,6 +45,14 @@ flag glfw
manual:
True
flag examples
description:
Build executable examples.
default:
False
manual:
True
common common
build-depends:
base
@ -204,6 +212,8 @@ executable test
default-language: Haskell2010
build-depends: base, sdl2, gl, dear-imgui
ghc-options: -Wall
if (!flag(examples) || !flag(sdl) || !flag(opengl2))
buildable: False
executable glfw
main-is: Main.hs
@ -211,12 +221,16 @@ executable glfw
default-language: Haskell2010
build-depends: base, GLFW-b, gl, dear-imgui, managed
ghc-options: -Wall
if (!flag(examples) || !flag(glfw) || !flag(opengl2))
buildable: False
executable readme
import: common
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 vulkan
import: common
@ -251,3 +265,5 @@ executable vulkan
, vulkan-utils
^>= 0.4.1
ghc-options: -Wall
if (!flag(examples) || !flag(sdl) || !flag(vulkan))
buildable: False