From f380f7aaf66d0fc39b9d47b93bd9ba3f69eef26e Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 27 Jun 2025 11:12:56 +0200 Subject: Create gemmalib and get ready with a guile test --- .gitignore | 2 ++ guix.scm | 7 ++++++- premake5.lua | 30 +++++++++++++++++++++++++++++- src/gemma_api.cpp | 21 +++++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 src/gemma_api.cpp 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 +#include +#include +#include + +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; +} -- cgit v1.2.3