From 7a54dc447466bae140ce7338e2372bef7d76f79f Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 3 Aug 2024 20:13:13 +0800 Subject: [PATCH] libcron: add package (#4835) --- packages/l/libcron/xmake.lua | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 packages/l/libcron/xmake.lua diff --git a/packages/l/libcron/xmake.lua b/packages/l/libcron/xmake.lua new file mode 100644 index 000000000..ae37b9b84 --- /dev/null +++ b/packages/l/libcron/xmake.lua @@ -0,0 +1,40 @@ +package("libcron") + set_homepage("https://github.com/PerMalmberg/libcron") + set_description("A C++ scheduling library using cron formatting.") + set_license("MIT") + + add_urls("https://github.com/PerMalmberg/libcron/archive/refs/tags/$(version).tar.gz", + "https://github.com/PerMalmberg/libcron.git") + + add_versions("v1.3.1", "cf5af6af392df29c8fc61fcc5a8e452118f31f47d7aa92eb7d4f4183dea227c8") + + add_deps("cmake") + add_deps("date") + + on_install(function (package) + io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true}) + io.replace("CMakeLists.txt", "add_dependencies(cron_test libcron)", "", {plain = true}) + io.replace("CMakeLists.txt", "install(DIRECTORY libcron/externals/date/include/date DESTINATION include)", "", {plain = true}) + + local configs = {} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + + local opt = {packagedeps = "date"} + if package:is_plat("windows") then + opt.cxflags = "-DWIN32" + if package:config("shared") then + table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON") + end + end + import("package.tools.cmake").install(package, configs, opt) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + libcron::CronData cron; + cron.create(""); + } + ]]}, {configs = {languages = "c++11"}, includes = "libcron/CronData.h"})) + end)