
Hi Sven,
Maybe your examples can be imported into a single module that cabal
can build/run with cabal test? I mean something like:
examples/Ex1.hs:
module Ex1 (main) where main = ...
examples/importAll.hs:
module Main where
import Ex1
import Ex2
...
main = return ()
Then in the cabal file have something like:
test-suite build_examples
type: exitcode-stdio-1.0
main-is: examples/importAll.hs
hs-source-dirs: examples
<those other settings repeated once only>
--
Adam
On Wed, Oct 16, 2013 at 10:23 AM, Sven Panne
2013/10/16 Heinrich Apfelmus
: I usually declare an "Executable" for each example and add a flag "buildExamples" that controls whether the examples are built or not. Here an example .cabal file.
http://hackage.haskell.org/package/threepenny-gui-0.3.0.0/threepenny-gui.cab...
I tried something similar in the past, but that didn't really work out:
* Things get *extremely* verbose and repetitive in the .cabal file. Currently there are roughly 90 GLUT examples, and I expect to have much more in the future. This would lead to more than 1000 lines of boilerplate .cabal stuff. OK, Emacs macros and copy-n-paste are your friends, but... :-P
* Can Cabal build the executables in parallel? Doing a parallel build of all examples via my make hack takes about 5 seconds, a non-parallel build takes 75 seconds, and I expect that gap to widen even more when I add more examples.
* How does one handle common parts in the examples? (e.g. https://github.com/haskell-opengl/GLUT/tree/master/examples/RedBook8/common, more to come there) Conditionally build helper libraries just for the examples?
I can't believe that I'm the only package maintainer who has such a problem, so I really hope that there is some hidden solution out there I simply can't see... _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe