Przeglądaj źródła

wintoast: add package (#2739)

* wintoast: add package

* Change test to see if windows is compatible

* Add `NDEBUG` if not debug
Chi Huu Huynh 1 rok temu
rodzic
commit
0dbb97140c
1 zmienionych plików z 40 dodań i 0 usunięć
  1. 40 0
      packages/w/wintoast/xmake.lua

+ 40 - 0
packages/w/wintoast/xmake.lua

@@ -0,0 +1,40 @@
+package("wintoast")
+    set_homepage("https://github.com/mohabouje/WinToast")
+    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.")
+    set_license("MIT")
+
+    add_urls("https://github.com/mohabouje/WinToast/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/mohabouje/WinToast.git")
+    add_versions("v1.3.0", "998bd82fb2f49ee4b0df98774424d72c2bc18225188f251a9242af28bb80e6d4")
+
+    on_install("windows", function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            set_languages("c++11")
+            target("wintoast")
+                set_kind("$(kind)")
+                add_headerfiles("include/(wintoastlib.h)")
+                add_files("src/wintoastlib.cpp")
+                add_includedirs("include")
+                if not is_mode("debug") then
+                    add_defines("NDEBUG")
+                end
+        ]])
+        local configs = {}
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+        #include "wintoastlib.h"
+        using namespace WinToastLib;
+        void test() {
+            if (WinToast::isCompatible()) {
+                WinToastTemplate templ = WinToastTemplate(WinToastTemplate::Text01);
+                templ.setTextField(L"Hello World", WinToastTemplate::FirstLine);
+            } else {
+                std::cout << "Error, your system in not supported!" << std::endl;
+            }
+        }
+        ]]}, {configs = {languages = "c++11"}}))
+    end)