aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2025-06-27 11:12:56 +0200
committerPjotr Prins2025-06-27 11:12:56 +0200
commitf380f7aaf66d0fc39b9d47b93bd9ba3f69eef26e (patch)
tree5bc549d8e52f9f187c4ff7d6911a2ba4c3336070
parentd7972ab1179cb051de99d67a5c907f201458cef6 (diff)
downloadpangemma-f380f7aaf66d0fc39b9d47b93bd9ba3f69eef26e.tar.gz
Create gemmalib and get ready with a guile test
-rw-r--r--.gitignore2
-rw-r--r--guix.scm7
-rw-r--r--premake5.lua30
-rw-r--r--src/gemma_api.cpp21
4 files changed, 58 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 8d137e6..d915f60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
build/
PanGemma.make
+gemma.make
+gemmalib.make
Makefile
*.o
*.tar.gz
diff --git a/guix.scm b/guix.scm
index e0259a2..a99d66c 100644
--- a/guix.scm
+++ b/guix.scm
@@ -59,6 +59,11 @@
ninja
ruby
zlib))
+ (propagated-inputs
+ (list
+ `("guile" ,guile-3.0-latest)
+ `("guile-debug" ,guile-3.0-latest "debug")))
+
;; ("gsl-static" ,gsl-static)
;; ("zlib:static" ,zlib "static")
(arguments
@@ -91,7 +96,7 @@ genome-wide association studies (GWAS).")
(build-system gnu-build-system)
(propagated-inputs
(modify-inputs (package-inputs pangemma-base-git)
- (append which binutils coreutils gcc-toolchain premake5 gnu-make ;; for the shell
+ (append which binutils coreutils gcc-toolchain premake5 gnu-make ;; for the shell
)))
(arguments
`(#:phases (modify-phases %standard-phases
diff --git a/premake5.lua b/premake5.lua
index b1bca78..4502e74 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -1,5 +1,9 @@
-- Build with
--
+-- premake5 gmake2 && make verbose=1 gemmalib -j 8
+--
+-- Including bin
+--
-- premake5 gmake2 && make verbose=1 config=debug
--
-- Or
@@ -13,7 +17,30 @@
workspace "PanGemma"
configurations { "Debug", "Release" }
-project "PanGemma"
+ project "gemmalib" -- library for interactive development
+ kind "SharedLib"
+ defines { "OPENBLAS" }
+ language "C++"
+ objdir "build/"
+ targetdir "build/bin/%{cfg.buildcfg}"
+
+ files { "src/*.h src/*.c src/**.hpp", "src/**.cpp" }
+ removefiles { "src/main.cpp" }
+ includedirs { "src/", os.getenv('GUIX_ENVIRONMENT') .. "/include/guile/3.0" }
+
+ links { "gsl", "z", "openblas" }
+
+ filter "configurations:Debug"
+ defines { "DEBUG" }
+ symbols "On"
+
+ filter "configurations:Release"
+ defines { "NDEBUG" }
+ optimize "On"
+
+
+
+project "gemma"
kind "ConsoleApp"
defines { "OPENBLAS" }
language "C++"
@@ -21,6 +48,7 @@ project "PanGemma"
targetdir "build/bin/%{cfg.buildcfg}"
files { "src/*.h src/*.c src/**.hpp", "src/**.cpp" }
+ removefiles { "src/gemma_api.cpp" }
includedirs { "src/" }
links { "gsl", "z", "openblas" }
diff --git a/src/gemma_api.cpp b/src/gemma_api.cpp
new file mode 100644
index 0000000..618f283
--- /dev/null
+++ b/src/gemma_api.cpp
@@ -0,0 +1,21 @@
+// Testing bindings, see README.md and
+// https://www.gnu.org/savannah-checkouts/gnu/guile/docs/docs-2.0/guile-ref/Dynamic-Types.html
+
+#include <stdio.h>
+#include <libguile.h>
+#include <libguile/boolean.h>
+#include <libguile/numbers.h>
+
+extern SCM my_incrementing_zig_function (SCM a, SCM flag);
+
+SCM my_incrementing_function (SCM a, SCM flag)
+{
+ SCM result;
+
+ if (scm_is_true (flag))
+ result = scm_sum (a, scm_from_int (1));
+ else
+ result = a;
+
+ return result;
+}