xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("wintoast")
  2. set_homepage("https://github.com/mohabouje/WinToast")
  3. set_description("WinToast is a lightly library written in C++ which brings a complete integration of the modern toast notifications of Windows 8, Windows 10 and Windows 11.")
  4. set_license("MIT")
  5. add_urls("https://github.com/mohabouje/WinToast/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/mohabouje/WinToast.git")
  7. add_versions("v1.3.1", "3e060d3376fdfd9cd092e324f5d50dde9632e9f544295f4613c8e22078653ff0")
  8. add_versions("v1.3.0", "998bd82fb2f49ee4b0df98774424d72c2bc18225188f251a9242af28bb80e6d4")
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. on_install("windows", function (package)
  11. io.writefile("xmake.lua", [[
  12. add_rules("mode.debug", "mode.release")
  13. set_languages("c++11")
  14. target("wintoast")
  15. set_kind("$(kind)")
  16. add_headerfiles("include/(wintoastlib.h)")
  17. add_files("src/wintoastlib.cpp")
  18. add_includedirs("include")
  19. ]])
  20. import("package.tools.xmake").install(package)
  21. end)
  22. on_test(function (package)
  23. assert(package:check_cxxsnippets({test = [[
  24. #include "wintoastlib.h"
  25. using namespace WinToastLib;
  26. void test() {
  27. if (WinToast::isCompatible()) {
  28. WinToastTemplate templ = WinToastTemplate(WinToastTemplate::Text01);
  29. templ.setTextField(L"Hello World", WinToastTemplate::FirstLine);
  30. } else {
  31. std::cout << "Error, your system in not supported!" << std::endl;
  32. }
  33. }
  34. ]]}, {configs = {languages = "c++11"}}))
  35. end)