xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("libcron")
  2. set_homepage("https://github.com/PerMalmberg/libcron")
  3. set_description("A C++ scheduling library using cron formatting.")
  4. set_license("MIT")
  5. add_urls("https://github.com/PerMalmberg/libcron/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/PerMalmberg/libcron.git")
  7. add_versions("v1.3.1", "cf5af6af392df29c8fc61fcc5a8e452118f31f47d7aa92eb7d4f4183dea227c8")
  8. add_deps("cmake")
  9. add_deps("date")
  10. on_install(function (package)
  11. io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true})
  12. io.replace("CMakeLists.txt", "add_dependencies(cron_test libcron)", "", {plain = true})
  13. io.replace("CMakeLists.txt", "install(DIRECTORY libcron/externals/date/include/date DESTINATION include)", "", {plain = true})
  14. local configs = {}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. local opt = {packagedeps = "date"}
  18. if package:is_plat("windows") then
  19. opt.cxflags = "-DWIN32"
  20. if package:config("shared") then
  21. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  22. end
  23. end
  24. import("package.tools.cmake").install(package, configs, opt)
  25. end)
  26. on_test(function (package)
  27. assert(package:check_cxxsnippets({test = [[
  28. void test() {
  29. libcron::CronData cron;
  30. cron.create("");
  31. }
  32. ]]}, {configs = {languages = "c++11"}, includes = "libcron/CronData.h"}))
  33. end)