aboutsummaryrefslogtreecommitdiff
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
parentebde8665851ca21ff00685eeaf5057ccec6eb05d (diff)
downloadmontis-50d91022f328c6f3dd7d166967732dec9734887c.tar.gz
montis-50d91022f328c6f3dd7d166967732dec9734887c.tar.bz2
montis-50d91022f328c6f3dd7d166967732dec9734887c.zip
Move the harness to its own CMake project.
-rw-r--r--.gitignore6
-rw-r--r--Setup.hs25
-rw-r--r--harness/CMakeLists.txt15
-rw-r--r--harness/src/main.c (renamed from src/harness/main.c)0
-rw-r--r--package.yaml7
5 files changed, 41 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 76467e6..e45a2cb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,8 @@
.stack-work/
*~
+harness/build
+wtr.so
+wtr_harness
+*.cabal
+*.lock
+*/**/.cache
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
diff --git a/harness/CMakeLists.txt b/harness/CMakeLists.txt
new file mode 100644
index 0000000..b38cb77
--- /dev/null
+++ b/harness/CMakeLists.txt
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.10)
+project (
+ wtr_harness
+ VERSION 0.1
+ LANGUAGES C)
+
+include_directories(include/)
+
+file (GLOB_RECURSE SOURCES src/*.c)
+
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+add_executable (wtr_harness ${SOURCES})
+
+target_link_libraries(wtr_harness dl)
diff --git a/src/harness/main.c b/harness/src/main.c
index 1580bd6..1580bd6 100644
--- a/src/harness/main.c
+++ b/harness/src/main.c
diff --git a/package.yaml b/package.yaml
index 4fd7277..73d5e50 100644
--- a/package.yaml
+++ b/package.yaml
@@ -57,13 +57,6 @@ executables:
- -g3
- -shared
- wtr_harness:
- main: src/harness/main.c
- cc-options:
- - -ldl
- - -ggdb
- - -g3
-
tests:
wetterhorn-test:
main: Spec.hs