-- Copyright 2016 Evan Laforge
-- This program is distributed under the terms of the GNU General Public
-- License 3.0, see COPYING or http://www.gnu.org/licenses/gpl-3.0.txt

-- | Shakefile config which is likely to be different on each system.
-- Customize this in Local.ShakeConfig.
module Shake.Config where
import qualified Shake.C as C


type Flag = String

data Config = Config {
    -- switches

    -- | If true, link in the EKG library for realtime monitoring.  But it
    -- requires the ekg package with a giant set of dependencies so it's
    -- disabled by default.
    Config -> Bool
enableEkg :: Bool
    -- | Link with the -eventlog RTS, for threadscope.  Presumably it hurts
    -- performance, so it's off by default.
    , Config -> Bool
enableEventLog :: Bool
    -- | If True, compile the im offline synthesizers and PlayCache VST from
    -- the Synth hierarchy.  This requires a bunch of extra dependencies.
    , Config -> Bool
enableIm :: Bool
    -- | Extra flags passed to both C++ and Haskell compiles.  I use them
    -- to enable some purely local hacks, e.g. hacked version of libfltk.
    , Config -> [Flag]
extraDefines :: [Flag]
    -- | C++ links get these via -F and ghc via -framework-path.
    -- It's just to work around https://github.com/NixOS/nixpkgs/issues/24237
    , Config -> [Flag]
extraFrameworkPaths :: [FilePath]

    -- paths

    -- | Path to the fltk installation.  If you @make install@ then it'll
    -- probably be in /usr/local/bin.
    , Config -> Flag
fltkConfig :: FilePath
    , Config -> ExternalLibrary
libsamplerate :: C.ExternalLibrary
    , Config -> ExternalLibrary
rubberband :: C.ExternalLibrary
    -- | Extra -I flags that all compiles get, including haskell cpp and
    -- hsc2hs.  Without the -I:  ["/Users/me/homebrew/include"]
    , Config -> [Flag]
globalIncludes :: [FilePath]
    -- | Extra -L flags for the C++ link, without the leading -L:
    -- ["/Users/me/homebrew/lib"]
    , Config -> [Flag]
globalLibDirs :: [FilePath]
    } deriving (Int -> Config -> ShowS
[Config] -> ShowS
Config -> Flag
(Int -> Config -> ShowS)
-> (Config -> Flag) -> ([Config] -> ShowS) -> Show Config
forall a.
(Int -> a -> ShowS) -> (a -> Flag) -> ([a] -> ShowS) -> Show a
showList :: [Config] -> ShowS
$cshowList :: [Config] -> ShowS
show :: Config -> Flag
$cshow :: Config -> Flag
showsPrec :: Int -> Config -> ShowS
$cshowsPrec :: Int -> Config -> ShowS
Show)


defaultConfig :: Config
defaultConfig :: Config
defaultConfig = Config
    { enableEkg :: Bool
enableEkg = Bool
False
    , enableEventLog :: Bool
enableEventLog = Bool
False
    , enableIm :: Bool
enableIm = Bool
False
    , extraDefines :: [Flag]
extraDefines = []
    , extraFrameworkPaths :: [Flag]
extraFrameworkPaths = []
    , fltkConfig :: Flag
fltkConfig = Flag
"fltk-config"
    , libsamplerate :: ExternalLibrary
libsamplerate = Flag -> ExternalLibrary
C.library Flag
"samplerate"
    , rubberband :: ExternalLibrary
rubberband = Flag -> ExternalLibrary
C.library Flag
"rubberband"
    , globalIncludes :: [Flag]
globalIncludes = []
    , globalLibDirs :: [Flag]
globalLibDirs = []
    }