xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package("date")
  2. set_homepage("https://github.com/HowardHinnant/date")
  3. set_description("A date and time library for use with C++11 and C++14.")
  4. set_license("MIT")
  5. add_urls("https://github.com/HowardHinnant/date/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/HowardHinnant/date.git")
  7. add_versions("v3.0.4", "56e05531ee8994124eeb498d0e6a5e1c3b9d4fccbecdf555fe266631368fb55f")
  8. add_versions("v3.0.3", "30de45a34a2605cca33a993a9ea54e8f140f23b1caf1acf3c2fd436c42c7d942")
  9. add_versions("v3.0.1", "7a390f200f0ccd207e8cff6757e04817c1a0aec3e327b006b7eb451c57ee3538")
  10. if is_plat("windows", "mingw") then
  11. add_syslinks("ole32", "shell32")
  12. elseif is_plat("macosx", "iphoneos") then
  13. add_frameworks("Foundation")
  14. end
  15. add_deps("cmake")
  16. if is_plat("macosx", "iphoneos") then
  17. add_deps("zlib")
  18. end
  19. on_install(function (package)
  20. local configs = {"-DBUILD_TZ_LIB=ON",
  21. "-DUSE_SYSTEM_TZ_DB=ON"}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. #include <date/date.h>
  29. void test() {
  30. using namespace date;
  31. year_month_weekday_last{year{2015}, month{3u}, weekday_last{weekday{0u}}};
  32. }
  33. ]]}, {configs = {languages = "c++11"}}))
  34. assert(package:check_cxxsnippets({test = [[
  35. #include <date/tz.h>
  36. void test() {
  37. using namespace date;
  38. using namespace std::chrono;
  39. make_zoned(current_zone(), system_clock::now());
  40. }
  41. ]]}, {configs = {languages = "c++11"}}))
  42. end)