From e8aaddf42cba753c68f8fa64e6457da7b07ead37 Mon Sep 17 00:00:00 2001 From: heheda123123 Date: Sat, 7 Sep 2024 10:19:52 +0800 Subject: [PATCH 1/5] add duilib_ultimate --- packages/d/duilib_ultimate/xmake.lua | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 packages/d/duilib_ultimate/xmake.lua diff --git a/packages/d/duilib_ultimate/xmake.lua b/packages/d/duilib_ultimate/xmake.lua new file mode 100644 index 00000000000..9a010f3899d --- /dev/null +++ b/packages/d/duilib_ultimate/xmake.lua @@ -0,0 +1,48 @@ +package("duilib_ultimate") + + set_homepage("https://github.com/qdtroy/DuiLib_Ultimate") + set_description("DuiLib_Ultimate是duilib库的增强拓展版") + + add_urls("https://github.com/qdtroy/DuiLib_Ultimate/archive/refs/tags/$(version).tar.gz") + add_versions("0.3", "4a650267e98d8b19818bdeb7675dcf1403017732b961620678e1d2d81f81db91") + + add_configs("shared", {description = "Download shared binaries.", default = false, type = "boolean", readonly=true}) + + on_install("windows", function (package) + package:add("defines", "UILIB_STATIC") + package:add("syslinks", "gdi32") + + io.writefile("add_defines.props", [[ + + + + + + %(PreprocessorDefinitions);UILIB_STATIC + + + + + ]]) + local configs = {"DuiLib.sln"} + table.insert(configs, "/p:Configuration=" .. (package:debug() and "SDebug" or "SRelease")) + table.insert(configs, "/p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32")) + table.insert(configs, "-t:DuiLib") + table.insert(configs, '/p:ForceImportBeforeCppTargets="add_defines.props"') + import("package.tools.msbuild").build(package, configs, {upgrade = {"DuiLib.sln"}}) + os.cp("Lib/*", package:installdir("lib")) + os.cp("bin", package:installdir()) + os.cp ("DuiLib/**.h", package:installdir("include"), {rootdir="DuiLib"}) + os.cp ("DuiLib/Utils/Flash11.tlb", package:installdir("include") .. "/Utils/") + os.cp ("DuiLib/Utils/flash11.tlh", package:installdir("include") .. "/Utils/") + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include "UIlib.h" + using namespace DuiLib; + void test() { + CButtonUI *pButton = new CButtonUI(); + } + ]]})) + end) From 5dbc9e006ffe7a526a6c8c13fac8c1be8e7d93a1 Mon Sep 17 00:00:00 2001 From: xpxz <97490782+heheda123123@users.noreply.github.com> Date: Sat, 7 Sep 2024 12:09:15 +0800 Subject: [PATCH 2/5] Update xmake.lua --- packages/d/duilib_ultimate/xmake.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/d/duilib_ultimate/xmake.lua b/packages/d/duilib_ultimate/xmake.lua index 9a010f3899d..2dfbba84092 100644 --- a/packages/d/duilib_ultimate/xmake.lua +++ b/packages/d/duilib_ultimate/xmake.lua @@ -7,8 +7,9 @@ package("duilib_ultimate") add_versions("0.3", "4a650267e98d8b19818bdeb7675dcf1403017732b961620678e1d2d81f81db91") add_configs("shared", {description = "Download shared binaries.", default = false, type = "boolean", readonly=true}) + add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MT", type = "string", readonly = true}) - on_install("windows", function (package) + on_install("windows|!arm64", function (package) package:add("defines", "UILIB_STATIC") package:add("syslinks", "gdi32") From 00dc51975da5d9c6fe33217155701c31da5ee8d3 Mon Sep 17 00:00:00 2001 From: xpxz <97490782+heheda123123@users.noreply.github.com> Date: Sat, 7 Sep 2024 13:29:04 +0800 Subject: [PATCH 3/5] Update xmake.lua --- packages/d/duilib_ultimate/xmake.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/d/duilib_ultimate/xmake.lua b/packages/d/duilib_ultimate/xmake.lua index 2dfbba84092..6043866879a 100644 --- a/packages/d/duilib_ultimate/xmake.lua +++ b/packages/d/duilib_ultimate/xmake.lua @@ -1,13 +1,13 @@ package("duilib_ultimate") set_homepage("https://github.com/qdtroy/DuiLib_Ultimate") - set_description("DuiLib_Ultimate是duilib库的增强拓展版") + set_description("DuiLib_Ultimate is the Optimized version for duilib library") add_urls("https://github.com/qdtroy/DuiLib_Ultimate/archive/refs/tags/$(version).tar.gz") add_versions("0.3", "4a650267e98d8b19818bdeb7675dcf1403017732b961620678e1d2d81f81db91") - add_configs("shared", {description = "Download shared binaries.", default = false, type = "boolean", readonly=true}) - add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MT", type = "string", readonly = true}) + add_configs("shared", {description = "Download shared binaries.", default = false, type = "boolean", readonly = true}) + add_configs("runtimes", {description = "Set vs compiler runtime.", default = "MT", type = "string", readonly = true}) on_install("windows|!arm64", function (package) package:add("defines", "UILIB_STATIC") From 5a46823a9dd0eabe1b769f689453a2fe723d89ff Mon Sep 17 00:00:00 2001 From: star9029 Date: Sat, 7 Sep 2024 17:43:42 +0800 Subject: [PATCH 4/5] Update xmake.lua --- packages/d/duilib_ultimate/xmake.lua | 41 +++++++++++++--------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/packages/d/duilib_ultimate/xmake.lua b/packages/d/duilib_ultimate/xmake.lua index 6043866879a..34dd9628dcb 100644 --- a/packages/d/duilib_ultimate/xmake.lua +++ b/packages/d/duilib_ultimate/xmake.lua @@ -1,36 +1,33 @@ package("duilib_ultimate") - set_homepage("https://github.com/qdtroy/DuiLib_Ultimate") set_description("DuiLib_Ultimate is the Optimized version for duilib library") + set_license("MIT") + + add_urls("https://github.com/qdtroy/DuiLib_Ultimate/archive/refs/tags/$(version).tar.gz", + "https://github.com/qdtroy/DuiLib_Ultimate.git") - add_urls("https://github.com/qdtroy/DuiLib_Ultimate/archive/refs/tags/$(version).tar.gz") add_versions("0.3", "4a650267e98d8b19818bdeb7675dcf1403017732b961620678e1d2d81f81db91") - add_configs("shared", {description = "Download shared binaries.", default = false, type = "boolean", readonly = true}) + add_configs("shared", {description = "Build shared binaries.", default = false, type = "boolean", readonly = true}) add_configs("runtimes", {description = "Set vs compiler runtime.", default = "MT", type = "string", readonly = true}) + add_syslinks("gdi32", "comctl32", "imm32", "uuid", "winmm") + on_install("windows|!arm64", function (package) - package:add("defines", "UILIB_STATIC") - package:add("syslinks", "gdi32") - - io.writefile("add_defines.props", [[ - - - - - - %(PreprocessorDefinitions);UILIB_STATIC - - - - - ]]) - local configs = {"DuiLib.sln"} - table.insert(configs, "/p:Configuration=" .. (package:debug() and "SDebug" or "SRelease")) + if not package:config("shared") then + package:add("defines", "UILIB_STATIC") + end + + local configs = {"DuiLib.sln", "-t:DuiLib"} + table.insert(configs, "/p:Configuration=" .. (package:is_debug() and "SDebug" or "SRelease")) table.insert(configs, "/p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32")) - table.insert(configs, "-t:DuiLib") - table.insert(configs, '/p:ForceImportBeforeCppTargets="add_defines.props"') import("package.tools.msbuild").build(package, configs, {upgrade = {"DuiLib.sln"}}) + + io.replace("DuiLib/Utils/downloadmgr.h", [[#pragma comment(lib,"uuid.lib")]], "", {plain = true}) + io.replace("DuiLib/UIlib.h", [[#pragma comment( lib, "comctl32.lib" )]], "", {plain = true}) + io.replace("DuiLib/UIlib.h", [[#pragma comment( lib, "GdiPlus.lib" )]], "", {plain = true}) + io.replace("DuiLib/UIlib.h", [[#pragma comment( lib, "Imm32.lib" )]], "", {plain = true}) + os.cp("Lib/*", package:installdir("lib")) os.cp("bin", package:installdir()) os.cp ("DuiLib/**.h", package:installdir("include"), {rootdir="DuiLib"}) From 66411fa17e0647001c8f4303471264ff190af2ce Mon Sep 17 00:00:00 2001 From: star9029 Date: Sun, 8 Sep 2024 01:18:28 +0800 Subject: [PATCH 5/5] port xmake --- packages/d/duilib_ultimate/port/xmake.lua | 29 +++++++++++++++++++++++ packages/d/duilib_ultimate/xmake.lua | 23 ++++++------------ 2 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 packages/d/duilib_ultimate/port/xmake.lua diff --git a/packages/d/duilib_ultimate/port/xmake.lua b/packages/d/duilib_ultimate/port/xmake.lua new file mode 100644 index 00000000000..a9be3733f5b --- /dev/null +++ b/packages/d/duilib_ultimate/port/xmake.lua @@ -0,0 +1,29 @@ +option("unicode", {default = true}) + +add_rules("mode.debug", "mode.release") + +set_languages("c++11") + +target("DuiLib") + set_kind("$(kind)") + add_files("DuiLib/**.cpp|DuiLib/StdAfx.cpp") + add_includedirs("DuiLib") + set_pcxxheader("DuiLib/StdAfx.h") + + if is_kind("shared") then + add_defines("UILIB_EXPORTS") + elseif is_kind("static") then + add_defines("UILIB_STATIC", {public = true}) + end + + if has_config("unicode") then + add_defines("UNICODE", "_UNICODE", {public = true}) + end + + if is_plat("windows") then + add_syslinks("gdi32", "comctl32", "imm32", "uuid", "winmm") + end + + add_headerfiles("DuiLib/(**.h)") + add_installfiles("DuiLib/Utils/Flash11.tlb", {prefixdir = "include/Utils"}) + add_installfiles("DuiLib/Utils/flash11.tlh", {prefixdir = "include/Utils"}) diff --git a/packages/d/duilib_ultimate/xmake.lua b/packages/d/duilib_ultimate/xmake.lua index 34dd9628dcb..78969479503 100644 --- a/packages/d/duilib_ultimate/xmake.lua +++ b/packages/d/duilib_ultimate/xmake.lua @@ -8,31 +8,22 @@ package("duilib_ultimate") add_versions("0.3", "4a650267e98d8b19818bdeb7675dcf1403017732b961620678e1d2d81f81db91") - add_configs("shared", {description = "Build shared binaries.", default = false, type = "boolean", readonly = true}) - add_configs("runtimes", {description = "Set vs compiler runtime.", default = "MT", type = "string", readonly = true}) + add_configs("unicode", {description = "Enable Unicode support.", default = true, type = "boolean"}) add_syslinks("gdi32", "comctl32", "imm32", "uuid", "winmm") on_install("windows|!arm64", function (package) + local configs = {unicode = package:config("unicode")} if not package:config("shared") then package:add("defines", "UILIB_STATIC") end + if configs.unicode then + package:add("defines", "UNICODE", "_UNICODE") + end - local configs = {"DuiLib.sln", "-t:DuiLib"} - table.insert(configs, "/p:Configuration=" .. (package:is_debug() and "SDebug" or "SRelease")) - table.insert(configs, "/p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32")) - import("package.tools.msbuild").build(package, configs, {upgrade = {"DuiLib.sln"}}) - - io.replace("DuiLib/Utils/downloadmgr.h", [[#pragma comment(lib,"uuid.lib")]], "", {plain = true}) - io.replace("DuiLib/UIlib.h", [[#pragma comment( lib, "comctl32.lib" )]], "", {plain = true}) - io.replace("DuiLib/UIlib.h", [[#pragma comment( lib, "GdiPlus.lib" )]], "", {plain = true}) - io.replace("DuiLib/UIlib.h", [[#pragma comment( lib, "Imm32.lib" )]], "", {plain = true}) - - os.cp("Lib/*", package:installdir("lib")) + os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") + import("package.tools.xmake").install(package, configs) os.cp("bin", package:installdir()) - os.cp ("DuiLib/**.h", package:installdir("include"), {rootdir="DuiLib"}) - os.cp ("DuiLib/Utils/Flash11.tlb", package:installdir("include") .. "/Utils/") - os.cp ("DuiLib/Utils/flash11.tlh", package:installdir("include") .. "/Utils/") end) on_test(function (package)