浏览代码

graaf: add package (#5085)

* graaf: add package

* add check
star9029 1 年之前
父节点
当前提交
b5d3822de8
共有 1 个文件被更改,包括 37 次插入0 次删除
  1. 37 0
      packages/g/graaf/xmake.lua

+ 37 - 0
packages/g/graaf/xmake.lua

@@ -0,0 +1,37 @@
+package("graaf")
+    set_kind("library", {headeronly = true})
+    set_homepage("https://bobluppes.github.io/graaf/")
+    set_description("A general-purpose lightweight C++ graph library")
+    set_license("MIT")
+
+    add_urls("https://github.com/bobluppes/graaf/releases/download/$(version)/header-only.tar.gz",
+             "https://github.com/bobluppes/graaf.git")
+
+    add_versions("v1.1.1", "86a95e14aa18f81ea31ec0764ef8b12d1fe42396da3be0046e0dbbb562fb3c89")
+
+    if on_check then
+        on_check(function (package)
+            assert(package:check_cxxsnippets({test = [[
+                enum class fruit { orange, apple };
+                void test() {
+                    using enum fruit;
+                }
+            ]]}, {configs = {languages = "c++20"}}), "package(graaf) Require at least C++20.")
+        end)
+    end
+
+    on_install(function (package)
+        if package:gitref() then
+            os.cp("include", package:installdir())
+        else
+            os.cp("graaflib", package:installdir("include"))
+        end
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                graaf::directed_graph<int, int> graph{};
+            }
+        ]]}, {configs = {languages = "c++20"}, includes = "graaflib/graph.h"}))
+    end)