Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions packages/r/rapidjson/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
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")

set_urls("https://github.com/Tencent/rapidjson/archive/refs/tags/$(version).zip",
"https://github.com/Tencent/rapidjson.git", {submodules = false})
set_urls("https://github.com/Tencent/rapidjson.git")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Removing the archive URL and the {submodules = false} option makes the installation process less efficient. For header-only libraries, downloading a ZIP archive is significantly faster than cloning the entire Git repository. Additionally, disabling submodules prevents downloading unnecessary test dependencies like gtest. xmake will automatically fall back to the Git URL if a specific version's ZIP is not found (e.g., for the new date-based versions).

    set_urls("https://github.com/Tencent/rapidjson/archive/refs/tags/$(version).zip",
             "https://github.com/Tencent/rapidjson.git", {submodules = false})


add_versions("2025.02.05", "24b5e7a8b27f42fa16b96fc70aade9106cf7102f")
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_configs("cmake", {description = "Use cmake build system", default = true, type = "boolean"})
add_versions("git:2025.02.05", "24b5e7a8b27f42fa16b96fc70aade9106cf7102f")

add_configs("cmake", {description = "Use cmake build system", default = false, type = "boolean"})

on_load(function (package)
if package:config("cmake") then
Expand All @@ -33,8 +32,9 @@ package("rapidjson")
"-DRAPIDJSON_BUILD_DOC=OFF",
"-DRAPIDJSON_BUILD_EXAMPLES=OFF",
"-DRAPIDJSON_BUILD_TESTS=OFF",
"-DRAPIDJSON_BUILD_THIRDPARTY_GTEST=OFF",
"-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")
}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
import("package.tools.cmake").install(package, configs)
else
os.cp("include/*", package:installdir("include"))
Expand All @@ -43,8 +43,7 @@ package("rapidjson")

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test()
{
void test() {
const char* json = "{\"project\":\"rapidjson\",\"stars\":10}";
rapidjson::Document d;
d.Parse(json);
Expand All @@ -53,5 +52,12 @@ package("rapidjson")
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
d.Accept(writer);
}
]]}, {configs = {languages = "c++11"}, includes = { "rapidjson/document.h", "rapidjson/stringbuffer.h", "rapidjson/writer.h"} }))
]]}, {
configs = {languages = "c++11"},
includes = {
"rapidjson/document.h",
"rapidjson/stringbuffer.h",
"rapidjson/writer.h"
}
}))
end)
Loading