xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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.3", "7d413b7950c82b54157b2a7f446e1e660bd718e542e2ffd3f8715e467ab2b825")
  8. add_versions("v1.3.1", "cf5af6af392df29c8fc61fcc5a8e452118f31f47d7aa92eb7d4f4183dea227c8")
  9. add_deps("cmake")
  10. add_deps("date")
  11. on_install(function (package)
  12. io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true})
  13. io.replace("CMakeLists.txt", "add_dependencies(cron_test libcron)", "", {plain = true})
  14. io.replace("CMakeLists.txt", "install(DIRECTORY libcron/externals/date/include/date DESTINATION include)", "", {plain = true})
  15. local configs = {}
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  17. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  18. local opt = {packagedeps = "date"}
  19. if package:is_plat("windows") then
  20. opt.cxflags = "-DWIN32"
  21. if package:config("shared") then
  22. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  23. end
  24. end
  25. import("package.tools.cmake").install(package, configs, opt)
  26. end)
  27. on_test(function (package)
  28. assert(package:check_cxxsnippets({test = [[
  29. void test() {
  30. libcron::CronData cron;
  31. cron.create("");
  32. }
  33. ]]}, {configs = {languages = "c++11"}, includes = "libcron/CronData.h"}))
  34. end)