Преглед на файлове

webui: add new config (#6743)

* Try resolve https://github.com/xmake-io/xmake-repo/pull/6727

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
Saikari преди 5 месеца
родител
ревизия
94551aa707
променени са 2 файла, в които са добавени 20 реда и са изтрити 17 реда
  1. 17 0
      packages/w/webui/port/xmake.lua
  2. 3 17
      packages/w/webui/xmake.lua

+ 17 - 0
packages/w/webui/port/xmake.lua

@@ -0,0 +1,17 @@
+add_rules("mode.debug", "mode.release")
+
+option("log", {showmenu = true,  default = true})
+
+target("webui")
+    set_kind("$(kind)")
+    add_files("src/civetweb/civetweb.c", {defines = {"NO_CACHING", "NO_CGI", "NO_SSL", "USE_WEBSOCKET"}})
+    add_files("src/webui.c", (has_config("log") and {defines = "WEBUI_LOG"} or {}))
+    add_headerfiles("include/webui.h", "include/webui.hpp")
+    add_includedirs("include", "src/civetweb")
+    if is_plat("windows") then
+        add_syslinks("user32", "advapi32", "shell32", "ws2_32", "ole32")
+    elseif is_plat("mingw") then
+        add_syslinks("ws2_32")
+    elseif is_plat("linux") then
+        add_syslinks("pthread", "dl")
+    end

+ 3 - 17
packages/w/webui/xmake.lua

@@ -9,6 +9,8 @@ package("webui")
     add_versions("2.4.2", "c51967bbab472655d04e28ce1668ee4adda1f320e05f98c14f071b2cdf61228b")
     add_versions("2.3.0", "14be57405b12cf434daade2310178534240866e3169c7213a6fa0e4a6c6f9f27")
 
+    add_configs("log", {description = "Enable log", default = true, type = "boolean"})
+
     if is_plat("windows") then
         add_syslinks("user32", "advapi32", "shell32", "ws2_32", "ole32")
     elseif is_plat("mingw") then
@@ -28,23 +30,7 @@ package("webui")
                 io.replace("src/civetweb/civetweb.c", "fseeko", "fseek", {plain = true})
             end
         end
-
-        io.writefile("xmake.lua", [[
-            add_rules("mode.debug", "mode.release")
-            target("webui")
-                set_kind("$(kind)")
-                add_files("src/civetweb/civetweb.c", {defines = {"NO_CACHING", "NO_CGI", "NO_SSL", "USE_WEBSOCKET"}})
-                add_files("src/webui.c", {defines = "WEBUI_LOG"})
-                add_headerfiles("include/webui.h", "include/webui.hpp")
-                add_includedirs("include", "src/civetweb")
-                if is_plat("windows") then
-                    add_syslinks("user32", "advapi32", "shell32", "ws2_32", "ole32")
-                elseif is_plat("mingw") then
-                    add_syslinks("ws2_32")
-                elseif is_plat("linux") then
-                    add_syslinks("pthread", "dl")
-                end
-        ]])
+        os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
         import("package.tools.xmake").install(package)
     end)