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