From ba4f284b66b23ba00bb7086203af1e9d7630a177 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Sat, 11 Apr 2020 16:44:16 -0500 Subject: Build debug and release versions in different places --- app/Main.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 23030e2..9438eb2 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -45,6 +45,7 @@ data TomlSettings = TomlSettings { data AppSettings = AppSettings { appSettingsCompiler :: String , appSettingsProjectName :: String + , appSettingsBuildPrefix :: String , appSettingsFlags :: [String] , appSettingsLibrary :: (Maybe Library) , appSettingsExecutables :: [Executable] @@ -82,6 +83,7 @@ build settings = do putStrLn "Building" let compiler = appSettingsCompiler settings let projectName = appSettingsProjectName settings + let buildPrefix = appSettingsBuildPrefix settings let flags = appSettingsFlags settings let executables = appSettingsExecutables settings executableDepends <- case appSettingsLibrary settings of @@ -89,12 +91,12 @@ build settings = do let librarySourceDir' = librarySourceDir librarySettings buildLibrary librarySourceDir' [".f90", ".f", ".F", ".F90", ".f95", ".f03"] - ("build" "library") + (buildPrefix "library") compiler flags projectName [] - return ["build" "library"] + return [buildPrefix "library"] Nothing -> do return [] mapM_ @@ -103,7 +105,7 @@ build settings = do buildProgram sourceDir executableDepends [".f90", ".f", ".F", ".F90", ".f95", ".f03"] - ("build" sourceDir) + (buildPrefix sourceDir) compiler flags name @@ -181,6 +183,8 @@ toml2AppSettings tomlSettings release = do return AppSettings { appSettingsCompiler = tomlSettingsCompiler tomlSettings , appSettingsProjectName = projectName + , appSettingsBuildPrefix = "build" + if release then "release" else "debug" , appSettingsFlags = if release then [ "-Wall" -- cgit v1.2.3