xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.git")
  6. add_versions("2024.05.14", "1ead6715dec030d340a316c927c877a3c4e5a00c")
  7. add_versions("2021.04.17", "6e921e1b1d21e84a5c82416ba7ecd98e33a436d0")
  8. if is_plat("windows", "mingw") then
  9. add_syslinks("ole32", "shell32")
  10. elseif is_plat("macosx", "iphoneos") then
  11. add_frameworks("Foundation")
  12. end
  13. add_deps("cmake")
  14. if is_plat("macosx", "iphoneos") then
  15. add_deps("zlib")
  16. end
  17. on_install(function (package)
  18. local configs = {"-DBUILD_TZ_LIB=ON",
  19. "-DUSE_SYSTEM_TZ_DB=ON"}
  20. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  21. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  22. import("package.tools.cmake").install(package, configs)
  23. end)
  24. on_test(function (package)
  25. assert(package:check_cxxsnippets({test = [[
  26. #include <date/date.h>
  27. void test() {
  28. using namespace date;
  29. year_month_weekday_last{year{2015}, month{3u}, weekday_last{weekday{0u}}};
  30. }
  31. ]]}, {configs = {languages = "c++11"}}))
  32. assert(package:check_cxxsnippets({test = [[
  33. #include <date/tz.h>
  34. void test() {
  35. using namespace date;
  36. using namespace std::chrono;
  37. make_zoned(current_zone(), system_clock::now());
  38. }
  39. ]]}, {configs = {languages = "c++11"}}))
  40. end)