From 6ee33e69c7b3bba11e0d17a923a1a259f2972e0c Mon Sep 17 00:00:00 2001 From: Chi Huu Huynh <73843190+Chi-EEE@users.noreply.github.com> Date: Thu, 29 Feb 2024 09:32:02 +0000 Subject: [PATCH] daemonpp: add package (#3353) * daemonpp: add package * daemonpp: add `using namespace std::chrono_literals;` * daemonpp: change test method * daemonpp: return 0 * daemonpp: fix test * daemonpp: fix test * daemonpp: copy files to daemonpp dir * daemonpp: add all files to include dir * daemonpp: reduce test size --- packages/d/daemonpp/xmake.lua | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 packages/d/daemonpp/xmake.lua diff --git a/packages/d/daemonpp/xmake.lua b/packages/d/daemonpp/xmake.lua new file mode 100644 index 000000000..dcd5e161f --- /dev/null +++ b/packages/d/daemonpp/xmake.lua @@ -0,0 +1,43 @@ +package("daemonpp") + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/baderouaich/daemonpp") + set_description("Simple C++ header only template for creating Linux daemons") + set_license("MIT") + + add_urls("https://github.com/baderouaich/daemonpp.git") + add_versions("2023.05.01", "0989a8296e1f8b4075db7deb0c3474a5d3780954") + + on_install("linux", function (package) + os.cp("include/*", package:installdir("include/daemonpp")) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + + using namespace daemonpp; + + class my_daemon : public daemon + { + public: + void on_start(const dconfig& cfg) override { + } + void on_update() override { + } + void on_stop() override { + } + void on_reload(const dconfig& cfg) override { + } + }; + + int test(int argc, const char* argv[]) { + my_daemon dmn; + dmn.set_name("my_daemon"); + dmn.set_update_duration(std::chrono::seconds(3)); + dmn.set_cwd("/"); + dmn.run(argc, argv); + return 0; + } + ]]}, {configs = {languages = "cxx11"}})) + end)