about summary refs log tree commit diff
path: root/premake5.lua
diff options
context:
space:
mode:
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua78
1 files changed, 78 insertions, 0 deletions
diff --git a/premake5.lua b/premake5.lua
new file mode 100644
index 0000000..9229800
--- /dev/null
+++ b/premake5.lua
@@ -0,0 +1,78 @@
+-- Build with
+--
+--   make clean && rm build -rf
+--   premake5 gmake && make verbose=1 gemmalib -j 8
+--
+-- Including bin
+--
+--   premake5 gmake && make verbose=1 config=debug gemma -j 8 && time LD_LIBRARY_PATH=$GUIX_ENVIRONMENT/lib ./test/runner
+--
+-- Or
+--
+--   premake5 gmake && make verbose=1 config=release -j 8 gemma && LD_LIBRARY_PATH=$GUIX_ENVIRONMENT/lib ./build/bin/Release/gemma
+--
+-- Run
+--
+--   LD_LIBRARY_PATH=$GUIX_ENVIRONMENT/lib ./build/bin/Debug/gemma
+--
+-- Next we start using the API from guile with
+--
+--   env LD_LIBRARY_PATH=./build/bin/Debug/:$GUIX_ENVIRONMENT/lib guile
+--   (load-extension "libgemmalib" "init_module")
+
+local pkg_cpp_flags = os.outputof("pkg-config --cflags openblas guile-3.0 gsl zlib")
+local pkg_linker_flags = os.outputof("pkg-config --libs openblas guile-3.0 gsl zlib")
+
+workspace "PanGemma"
+   configurations { "Debug", "Release" }
+
+   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/" }
+
+   filter "configurations:Debug"
+      defines { "DEBUG" }
+      buildoptions { pkg_cpp_flags }
+      linkoptions { pkg_linker_flags }
+      symbols "On"
+
+   filter "configurations:Release"
+      defines { "NDEBUG", "HAVE_INLINE" }
+      buildoptions { pkg_cpp_flags }
+      linkoptions { pkg_linker_flags }
+      buildoptions { "-pthread", "-Wall" }
+      optimize "Speed"
+
+project "gemma"
+   kind "ConsoleApp"
+   defines { "OPENBLAS" }
+   language "C++"
+   buildoptions { "-Wfatal-errors" }
+   objdir "build/"
+   targetdir "build/bin/%{cfg.buildcfg}"
+
+   files { "src/*.h src/*.c src/**.hpp", "src/**.cpp" }
+   removefiles { "src/gemma_api.cpp" }
+   includedirs { "src/" }
+   links { "lmdb" }
+
+   filter "configurations:Debug"
+      defines { "DEBUG" }
+      buildoptions { pkg_cpp_flags }
+      linkoptions { pkg_linker_flags }
+      links { "profiler" }
+      symbols "On"
+
+   filter "configurations:Release"
+      defines { "NDEBUG", "HAVE_INLINE" }
+      buildoptions { "-pthread", "-Wall" }
+      buildoptions { pkg_cpp_flags }
+      linkoptions { pkg_linker_flags }
+      optimize "Speed"