Skip to content

Commit

Permalink
Update xmake.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
star-hengxing authored Jan 13, 2025
1 parent 9ece9c4 commit f5deb3f
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions packages/g/gltf-sdk/xmake.lua
Original file line number Diff line number Diff line change
@@ -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<rapidjson::StringBuffer> 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)

0 comments on commit f5deb3f

Please sign in to comment.