From 17cf3031281657c403774b4fcfb18219049e7d04 Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Mon, 13 Jan 2025 12:42:58 +0800 Subject: [PATCH 1/3] Add microsoft gltf-sdk --- packages/g/gltf-sdk/xmake.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 packages/g/gltf-sdk/xmake.lua diff --git a/packages/g/gltf-sdk/xmake.lua b/packages/g/gltf-sdk/xmake.lua new file mode 100644 index 00000000000..3e03c6dd617 --- /dev/null +++ b/packages/g/gltf-sdk/xmake.lua @@ -0,0 +1,34 @@ +package("gltf-sdk") + set_homepage("https://github.com/microsoft/glTF-SDK") + set_description("glTF-SDK is a C++ Software Development Kit for glTF (GL Transmission Format -https://github.com/KhronosGroup/glTF).") + set_license("MIT") + + add_urls("https://github.com/microsoft/glTF-SDK/archive/refs/tags/$(version).tar.gz", + "https://github.com/microsoft/glTF-SDK.git") + + add_versions("r1.9.6.0", "f3049d2b8ecebb914f634496918ab645f7ce452a67a5b4210e7354dc7c0059ab") + + add_deps("cmake") + + on_install(function (package) + local configs = { + "-DENABLE_UNIT_TESTS=OFF", + "-DENABLE_SAMPLES=OFF", + "-DRAPIDJSON_BUILD_DOC=OFF", + "-DRAPIDJSON_BUILD_EXAMPLES=OFF", + "-DRAPIDJSON_BUILD_TESTS=OFF", + } + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_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) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test() { + using namespace Microsoft::glTF; + const Color3 c1 = { 0.0f, 0.0f, 0.0f }; + Color3 c = c1.ToGamma(); + } + ]]}, {configs = {languages = "c++14"}, includes = {"GLTFSDK/Color.h"}})) + end) From 9ece9c43ddf208b3ca8a0a7e8fe44eae89ec5e63 Mon Sep 17 00:00:00 2001 From: star9029 Date: Mon, 13 Jan 2025 15:46:56 +0800 Subject: [PATCH 2/3] Fix version --- packages/g/gltf-sdk/xmake.lua | 50 +++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/packages/g/gltf-sdk/xmake.lua b/packages/g/gltf-sdk/xmake.lua index 3e03c6dd617..203735fd549 100644 --- a/packages/g/gltf-sdk/xmake.lua +++ b/packages/g/gltf-sdk/xmake.lua @@ -1,34 +1,38 @@ -package("gltf-sdk") - set_homepage("https://github.com/microsoft/glTF-SDK") - set_description("glTF-SDK is a C++ Software Development Kit for glTF (GL Transmission Format -https://github.com/KhronosGroup/glTF).") +package("rapidjson") + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/Tencent/rapidjson") + set_description("RapidJSON is a JSON parser and generator for C++.") set_license("MIT") - add_urls("https://github.com/microsoft/glTF-SDK/archive/refs/tags/$(version).tar.gz", - "https://github.com/microsoft/glTF-SDK.git") + set_urls("https://github.com/Tencent/rapidjson/archive/$(version).zip", + "https://github.com/Tencent/rapidjson.git") - add_versions("r1.9.6.0", "f3049d2b8ecebb914f634496918ab645f7ce452a67a5b4210e7354dc7c0059ab") - - add_deps("cmake") + add_versions("2024.08.16", "7c73dd7de7c4f14379b781418c6e947ad464c818") + add_versions("2023.12.6", "6089180ecb704cb2b136777798fa1be303618975") + add_versions("2022.7.20", "27c3a8dc0e2c9218fe94986d249a12b5ed838f1d") + add_versions("v1.1.0", "8e00c38829d6785a2dfb951bb87c6974fa07dfe488aa5b25deec4b8bc0f6a3ab") + -- This commit is used in arrow 7.0.0 https://github.com/apache/arrow/blob/release-7.0.0/cpp/thirdparty/versions.txt#L80 + add_versions("v1.1.0-arrow", "1a803826f1197b5e30703afe4b9c0e7dd48074f5") on_install(function (package) - local configs = { - "-DENABLE_UNIT_TESTS=OFF", - "-DENABLE_SAMPLES=OFF", - "-DRAPIDJSON_BUILD_DOC=OFF", - "-DRAPIDJSON_BUILD_EXAMPLES=OFF", - "-DRAPIDJSON_BUILD_TESTS=OFF", - } - table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_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) + if package:is_plat("windows") and package:is_arch("arm.*") then + package:add("defines", "RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN") + end + + os.cp(path.join("include", "*"), package:installdir("include")) end) on_test(function (package) assert(package:check_cxxsnippets({test = [[ - void test() { - using namespace Microsoft::glTF; - const Color3 c1 = { 0.0f, 0.0f, 0.0f }; - Color3 c = c1.ToGamma(); + void test() + { + const char* json = "{\"project\":\"rapidjson\",\"stars\":10}"; + rapidjson::Document d; + d.Parse(json); + + rapidjson::StringBuffer buffer; + rapidjson::Writer writer(buffer); + d.Accept(writer); } - ]]}, {configs = {languages = "c++14"}, includes = {"GLTFSDK/Color.h"}})) + ]]}, {configs = {languages = "c++11"}, includes = { "rapidjson/document.h", "rapidjson/stringbuffer.h", "rapidjson/writer.h"} })) end) From f5deb3f88dd7d7ab32cd3d603ce98ac1a4391146 Mon Sep 17 00:00:00 2001 From: star9029 Date: Mon, 13 Jan 2025 15:50:15 +0800 Subject: [PATCH 3/3] Update xmake.lua --- packages/g/gltf-sdk/xmake.lua | 55 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/packages/g/gltf-sdk/xmake.lua b/packages/g/gltf-sdk/xmake.lua index 203735fd549..76f08bfdb43 100644 --- a/packages/g/gltf-sdk/xmake.lua +++ b/packages/g/gltf-sdk/xmake.lua @@ -1,38 +1,39 @@ -package("rapidjson") - set_kind("library", {headeronly = true}) - set_homepage("https://github.com/Tencent/rapidjson") - set_description("RapidJSON is a JSON parser and generator for C++.") +package("gltf-sdk") + set_homepage("https://github.com/microsoft/glTF-SDK") + set_description("glTF-SDK is a C++ Software Development Kit for glTF (GL Transmission Format -https://github.com/KhronosGroup/glTF).") set_license("MIT") - set_urls("https://github.com/Tencent/rapidjson/archive/$(version).zip", - "https://github.com/Tencent/rapidjson.git") + add_urls("https://github.com/microsoft/glTF-SDK/archive/refs/tags/$(version).tar.gz", + "https://github.com/microsoft/glTF-SDK.git", { + version = function (version) + return "r" .. version:gsub("+", ".") + end + }) - add_versions("2024.08.16", "7c73dd7de7c4f14379b781418c6e947ad464c818") - add_versions("2023.12.6", "6089180ecb704cb2b136777798fa1be303618975") - add_versions("2022.7.20", "27c3a8dc0e2c9218fe94986d249a12b5ed838f1d") - add_versions("v1.1.0", "8e00c38829d6785a2dfb951bb87c6974fa07dfe488aa5b25deec4b8bc0f6a3ab") - -- This commit is used in arrow 7.0.0 https://github.com/apache/arrow/blob/release-7.0.0/cpp/thirdparty/versions.txt#L80 - add_versions("v1.1.0-arrow", "1a803826f1197b5e30703afe4b9c0e7dd48074f5") + add_versions("1.9.6+0", "f3049d2b8ecebb914f634496918ab645f7ce452a67a5b4210e7354dc7c0059ab") - on_install(function (package) - if package:is_plat("windows") and package:is_arch("arm.*") then - package:add("defines", "RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN") - end + add_deps("cmake") + add_deps("rapidjson") - os.cp(path.join("include", "*"), package:installdir("include")) + on_install(function (package) + local configs = { + "-DENABLE_UNIT_TESTS=OFF", + "-DENABLE_SAMPLES=OFF", + "-DRAPIDJSON_BUILD_DOC=OFF", + "-DRAPIDJSON_BUILD_EXAMPLES=OFF", + "-DRAPIDJSON_BUILD_TESTS=OFF", + } + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_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) on_test(function (package) assert(package:check_cxxsnippets({test = [[ - void test() - { - const char* json = "{\"project\":\"rapidjson\",\"stars\":10}"; - rapidjson::Document d; - d.Parse(json); - - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - d.Accept(writer); + void test() { + using namespace Microsoft::glTF; + const Color3 c1 = { 0.0f, 0.0f, 0.0f }; + Color3 c = c1.ToGamma(); } - ]]}, {configs = {languages = "c++11"}, includes = { "rapidjson/document.h", "rapidjson/stringbuffer.h", "rapidjson/writer.h"} })) + ]]}, {configs = {languages = "c++14"}, includes = {"GLTFSDK/Color.h"}})) end)