diff --git a/packages/c/collada-dom/patches/v2.5.0/uriparser.patch b/packages/c/collada-dom/patches/v2.5.0/uriparser.patch new file mode 100644 index 000000000..627ea740d --- /dev/null +++ b/packages/c/collada-dom/patches/v2.5.0/uriparser.patch @@ -0,0 +1,13 @@ +diff --git a/dom/src/dae/daeURI.cpp b/dom/src/dae/daeURI.cpp +index 3a8f815..1623753 100644 +--- a/dom/src/dae/daeURI.cpp ++++ b/dom/src/dae/daeURI.cpp +@@ -790,7 +790,7 @@ + scheme = fromRange(uri.scheme); + authority = fromRange(uri.hostText); + path = fromList(uri.pathHead, "/"); +- if (uri.absolutePath != URI_TRUE and uri.hostText.first == NULL) ++ if (uri.absolutePath != URI_TRUE && uri.hostText.first == NULL) + path = path.erase(0, 1); + query = fromRange(uri.query); + fragment = fromRange(uri.fragment); diff --git a/packages/c/collada-dom/port/xmake.lua b/packages/c/collada-dom/port/xmake.lua new file mode 100644 index 000000000..731f9056f --- /dev/null +++ b/packages/c/collada-dom/port/xmake.lua @@ -0,0 +1,43 @@ +add_rules("mode.debug", "mode.release") +add_requires("boost", {configs = {filesystem = true}}) +add_requires("libxml2", "minizip", "pcre", "uriparser") + +option("common") + set_default(true) + if is_plat("windows") then + add_defines("WIN32") + if is_kind("shared") then + add_defines("DOM_DYNAMIC", "DOM_EXPORT") + end + end + set_languages("cxx11") + add_defines("DOM_INCLUDE_LIBXML", "USE_URIPARSER") + +target("collada-dom") + set_kind("$(kind)") + add_files("src/dae/*.cpp") + add_files("src/modules/*/*.cpp") + add_includedirs("include") + add_headerfiles("include/(*.h)") + add_headerfiles("include/(dae/*.h)") + add_headerfiles("include/(modules/*.h)") + add_options("common") + add_packages("pcre", "boost", "libxml2", "minizip", "uriparser") + +target("colladadom141") + set_kind("static") + add_deps("collada-dom") + add_files("src/1.4/dom/*.cpp") + add_includedirs("include") + add_headerfiles("include/(1.4/dom/*.h)") + add_options("common") + add_packages("pcre", "boost") + +target("colladadom150") + set_kind("static") + add_deps("collada-dom") + add_files("src/1.5/dom/*.cpp") + add_includedirs("include") + add_headerfiles("include/(1.5/dom/*.h)") + add_options("common") + add_packages("pcre", "boost") diff --git a/packages/c/collada-dom/xmake.lua b/packages/c/collada-dom/xmake.lua new file mode 100644 index 000000000..17e5dcdd6 --- /dev/null +++ b/packages/c/collada-dom/xmake.lua @@ -0,0 +1,34 @@ +package("collada-dom") + + set_homepage("https://github.com/rdiankov/collada-dom/") + set_description("COLLADA Document Object Model (DOM) C++ Library") + + add_urls("https://github.com/rdiankov/collada-dom/archive/refs/tags/$(version).tar.gz", + "https://github.com/rdiankov/collada-dom.git") + add_versions("v2.5.0", "3be672407a7aef60b64ce4b39704b32816b0b28f61ebffd4fbd02c8012901e0d") + + add_patches("v2.5.0", path.join(os.scriptdir(), "patches", "v2.5.0", "uriparser.patch"), "b3ab281d5f4498531ff387992f731f94c64d7f8ea07674f66ad74ba455f650ef") + + add_deps("cmake", "libxml2", "minizip", "pcre", "uriparser") + add_deps("boost", {configs = {filesystem = true}}) + on_load("windows", function (package) + if package:config("shared") then + package:add("defines", "DOM_DYNAMIC") + end + end) + + on_install("windows", "linux", "macosx", function (package) + os.cd("dom") + os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua") + local configs = {} + if package:config("shared") then + configs.kind = "shared" + elseif package:is_plat("linux") and package:config("pic") ~= false then + configs.cxflags = "-fPIC" + end + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cxxtypes("DAE", {configs = {languages = "c++11"}, includes = "dae.h"})) + end) diff --git a/packages/p/pcre/xmake.lua b/packages/p/pcre/xmake.lua index 7124716fa..b6a19d03c 100644 --- a/packages/p/pcre/xmake.lua +++ b/packages/p/pcre/xmake.lua @@ -12,13 +12,12 @@ package("pcre") if is_host("windows") and not is_plat("mingw") then add_deps("cmake") end + add_deps("zlib") add_configs("jit", {description = "Enable jit.", default = true, type = "boolean"}) add_configs("bitwidth", {description = "Set the code unit width.", default = "8", values = {"8", "16", "32"}}) - on_load(function (package) - local bitwidth = package:config("bitwidth") or "8" - package:add("links", "pcre" .. (bitwidth ~= "8" and bitwidth or "")) + on_load("windows", "mingw", function (package) if not package:config("shared") then package:add("defines", "PCRE_STATIC") end diff --git a/packages/t/tinyxml/xmake.lua b/packages/t/tinyxml/xmake.lua new file mode 100644 index 000000000..6042d4bf3 --- /dev/null +++ b/packages/t/tinyxml/xmake.lua @@ -0,0 +1,29 @@ +package("tinyxml") + + set_homepage("https://sourceforge.net/projects/tinyxml/") + set_description("TinyXML is a simple, small, minimal, C++ XML parser that can be easily integrating into other programs.") + set_license("zlib") + + add_urls("https://jaist.dl.sourceforge.net/project/tinyxml/tinyxml/$(version).zip", {version = function (version) return version .. "/tinyxml_" .. version:gsub("%.", "_") end}) + add_versions("2.6.2", "ac6bb9501c6f50cc922d22f26b02fab168db47521be5e845b83d3451a3e1d512") + + on_install(function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + target("tinyxml") + set_kind("$(kind)") + add_files("tinyxml.cpp", "tinystr.cpp", "tinyxmlerror.cpp", "tinyxmlparser.cpp") + add_headerfiles("tinyxml.h", "tinystr.h") + ]]) + local configs = {} + if not package:is_plat("windows") and package:config("shared") then + configs.kind = "shared" + elseif package:is_plat("linux") and package:config("pic") ~= false then + configs.cxflags = "-fPIC" + end + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cxxtypes("TiXmlDocument", {includes = "tinyxml.h"})) + end) diff --git a/packages/t/tinyxml2/xmake.lua b/packages/t/tinyxml2/xmake.lua index 949f1782d..07894cb95 100644 --- a/packages/t/tinyxml2/xmake.lua +++ b/packages/t/tinyxml2/xmake.lua @@ -3,7 +3,7 @@ package("tinyxml2") set_homepage("http://www.grinninglizard.com/tinyxml2/") set_description("simple, small, efficient, C++ XML parser that can be easily integrating into other programs.") - add_urls("https://github.com/leethomason/tinyxml2/archive/8.0.0.tar.gz") + add_urls("https://github.com/leethomason/tinyxml2/archive/$(version).tar.gz") add_urls("https://github.com/leethomason/tinyxml2.git") add_versions("8.0.0", "6ce574fbb46751842d23089485ae73d3db12c1b6639cda7721bf3a7ee862012c") @@ -13,7 +13,8 @@ package("tinyxml2") on_install("linux", "macosx", "windows", function (package) local configs = {"-DBUILD_TESTS=OFF"} - table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:configs("shared") and "ON" or "OFF")) + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) import("package.tools.cmake").install(package, configs) end)