From 5ba4a4be37d2aa99d27ae5761d23b655c9be5e8b Mon Sep 17 00:00:00 2001 From: Chi Huu Huynh <73843190+Chi-EEE@users.noreply.github.com> Date: Thu, 11 Jul 2024 02:45:49 +0100 Subject: [PATCH] date: fix links, change versioning (#4618) * date: fix package Links were missing to run this package * date: change versioning https://github.com/HowardHinnant/date/issues/828#issuecomment-2184283807 * date: use c++11 for test * date: add_syslinks("z") for macosx * date: add_deps("zlib") for macosx * date: add_frameworks("Foundation") for macosx & iphoneos --- packages/d/date/xmake.lua | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/d/date/xmake.lua b/packages/d/date/xmake.lua index 287e060c5..fdb876f81 100644 --- a/packages/d/date/xmake.lua +++ b/packages/d/date/xmake.lua @@ -4,12 +4,21 @@ package("date") set_description("A date and time library for use with C++11 and C++14.") set_license("MIT") - add_urls("https://github.com/HowardHinnant/date/archive/refs/tags/$(version).zip", - "https://github.com/HowardHinnant/date.git") + add_urls("https://github.com/HowardHinnant/date.git") - add_versions("v3.0.1", "f4300b96f7a304d4ef9bf6e0fa3ded72159f7f2d0f605bdde3e030a0dba7cf9f") + add_versions("2024.05.14", "1ead6715dec030d340a316c927c877a3c4e5a00c") + add_versions("2021.04.17", "6e921e1b1d21e84a5c82416ba7ecd98e33a436d0") + + if is_plat("windows", "mingw") then + add_syslinks("ole32", "shell32") + elseif is_plat("macosx", "iphoneos") then + add_frameworks("Foundation") + end add_deps("cmake") + if is_plat("macosx", "iphoneos") then + add_deps("zlib") + end on_install(function (package) local configs = {"-DBUILD_TZ_LIB=ON", @@ -20,6 +29,19 @@ package("date") end) on_test(function (package) - assert(package:has_cxxtypes("date::sys_days", {configs = {languages = "c++11"}, includes = "date/date.h"})) - assert(package:has_cxxtypes("date::time_zone", {configs = {languages = "c++11"}, includes = "date/tz.h"})) + assert(package:check_cxxsnippets({test = [[ + #include + void test() { + using namespace date; + year_month_weekday_last{year{2015}, month{3u}, weekday_last{weekday{0u}}}; + } + ]]}, {configs = {languages = "c++11"}})) + assert(package:check_cxxsnippets({test = [[ + #include + void test() { + using namespace date; + using namespace std::chrono; + make_zoned(current_zone(), system_clock::now()); + } + ]]}, {configs = {languages = "c++11"}})) end)