aboutsummaryrefslogtreecommitdiff
path: root/adapters/template_defs.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-04 14:32:22 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-04 14:32:22 -0500
commitf90a14d5d723c5d2b87f2eaa19f441dec33bb9b2 (patch)
treee0abd76b6ebd9adcc60732d532cb68c512b0c2d1 /adapters/template_defs.go
parenta0b020a78eb0b33965c59460fc093c6959216e44 (diff)
downloadplanr-f90a14d5d723c5d2b87f2eaa19f441dec33bb9b2.tar.xz
planr-f90a14d5d723c5d2b87f2eaa19f441dec33bb9b2.zip
Prototyped build pipeline
Diffstat (limited to 'adapters/template_defs.go')
-rw-r--r--adapters/template_defs.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/adapters/template_defs.go b/adapters/template_defs.go
new file mode 100644
index 0000000..54f2840
--- /dev/null
+++ b/adapters/template_defs.go
@@ -0,0 +1,50 @@
+package adapters
+
+import (
+ "io"
+ "log"
+ "text/template"
+)
+
+
+func UnitTemplate() *template.Template {
+ tmpl, err := template.New("gtest_unit").Parse(`
+add_executable(
+ {{.Cname}}
+ {{.File}}
+ {{.Srcs}}
+)
+
+target_link_libraries(
+ {{.Cname}}
+ gtest_main
+)
+
+gtest_discover_tests(
+ {{.Cname}}
+)
+`)
+
+ if err != nil {
+ log.Fatalf("Cannot load Gtest Unit Template %v", err)
+ }
+
+ return tmpl
+}
+
+func WriteCMakeBoiler(w io.Writer) {
+ w.Write([]byte(`
+cmake_minimum_required (VERSION 3.1.0)
+
+project(PlanRGtestAdapter)
+
+include(FetchContent)
+FetchContent_Declare(
+ googletest
+ URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
+)
+
+include(GoogleTest)
+FetchContent_MakeAvailable(googletest)
+`))
+}