aboutsummaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-02-09 13:17:43 -0700
committerJosh Rahm <rahm@google.com>2024-02-09 13:17:43 -0700
commit50d91022f328c6f3dd7d166967732dec9734887c (patch)
treea88b5ae0485db6caf811b569162773ffa15ebc4d /Setup.hs
parentebde8665851ca21ff00685eeaf5057ccec6eb05d (diff)
downloadmontis-50d91022f328c6f3dd7d166967732dec9734887c.tar.gz
montis-50d91022f328c6f3dd7d166967732dec9734887c.tar.bz2
montis-50d91022f328c6f3dd7d166967732dec9734887c.zip
Move the harness to its own CMake project.
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs25
1 files changed, 20 insertions, 5 deletions
diff --git a/Setup.hs b/Setup.hs
index 6fc3581..648d5a2 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -14,26 +14,41 @@ main = do
defaultMainWithHooks $
simpleUserHooks
{ preConf = \_ conf -> do
- let path = fromJust (flagToMaybe $ configDistPref conf)
+ let buildPath = fromJust (flagToMaybe $ configDistPref conf)
+
+ callCommand $
+ printf "cd wlroots && meson setup %s -Dexamples=false --reconfigure" (wlrootsDir buildPath)
+
callCommand $
- printf "cd wlroots && meson setup %s -Dexamples=false --reconfigure" (wlrootsDir path)
+ printf "cmake -B %s -S harness" (harnessDir buildPath)
+
+ lnF ("../" ++ harnessDir buildPath) "harness/build"
+
return emptyHookedBuildInfo,
preBuild = \_ conf -> do
let path = fromJust (flagToMaybe $ buildDistPref conf)
+
callCommand $ printf "cd wlroots && ninja -C %s" (wlrootsDir path)
+
+ callCommand $
+ printf "make -C %s" (harnessDir path)
+
+ lnF (printf "%s/wtr_harness" (harnessDir path)) "wtr_harness"
+
return emptyHookedBuildInfo,
postCopy = \a f pd _ -> do
forM_ (flagToMaybe (copyDistPref f)) $ \copyDest -> do
- let harnessFile = copyDest </> "build" </> "wtr_harness" </> "wtr_harness"
- let pluginFile = copyDest </> "build" </> "wtr.so" </> "wtr.so"
- lnF harnessFile "wtr_harness"
+ let pluginFile = copyDest </> "build" </> "wtr.so" </> "wtr.so"
lnF pluginFile "wtr.so"
}
where
wlrootsDir :: String -> String
wlrootsDir = printf "../%s/build/wlroots"
+ harnessDir :: String -> String
+ harnessDir = printf "%s/build/wtr_harness"
+
lnF from to = do
printf "%s -> %s\n" from to
flip when (removeLink to) =<< doesFileExist to