From b5d3822de818d6a3e7bef8bca1576b574484e023 Mon Sep 17 00:00:00 2001 From: star9029 Date: Fri, 30 Aug 2024 10:40:59 +0800 Subject: [PATCH] graaf: add package (#5085) * graaf: add package * add check --- packages/g/graaf/xmake.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 packages/g/graaf/xmake.lua diff --git a/packages/g/graaf/xmake.lua b/packages/g/graaf/xmake.lua new file mode 100644 index 000000000..ab8ee363a --- /dev/null +++ b/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 graph{}; + } + ]]}, {configs = {languages = "c++20"}, includes = "graaflib/graph.h"})) + end)