aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Richardson <brichardson@structint.com>2020-04-11 16:44:16 -0500
committerBrad Richardson <brichardson@structint.com>2020-04-11 16:44:16 -0500
commitba4f284b66b23ba00bb7086203af1e9d7630a177 (patch)
tree5fbc47c5058d28142c4c26440cc6e7119a1bd308
parentaea00bcfebff593eb6661b01aa18ad3a91b60ffb (diff)
downloadfpm-ba4f284b66b23ba00bb7086203af1e9d7630a177.tar.gz
fpm-ba4f284b66b23ba00bb7086203af1e9d7630a177.zip
Build debug and release versions in different places
-rw-r--r--app/Main.hs10
1 files 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"