Conversation
Fixes the broken version of rapidjson
There was a problem hiding this comment.
Code Review
This pull request updates the rapidjson package definition by modifying source URLs, updating versions, and adjusting the CMake build configuration. Several issues were identified: the cmake dependency must be declared in the on_load block rather than on_install to ensure correct dependency resolution by xmake, and the removal of the archive URL and the submodules = false option negatively impacts download efficiency and includes unnecessary submodules.
| on_load(function (package) | ||
| if package:is_plat("windows") and package:is_arch("arm.*") then | ||
| package:add("defines", "RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN") | ||
| end | ||
| end) |
There was a problem hiding this comment.
The cmake dependency must be declared in on_load so that xmake's dependency solver can identify and install it before the on_install phase. Declaring it inside on_install is too late and will cause the build to fail if cmake is not already present on the system.
on_load(function (package)
if package:config("cmake") then
package:add("deps", "cmake")
end
if package:is_plat("windows") and package:is_arch("arm.*") then
package:add("defines", "RAPIDJSON_ENDIAN=RAPIDJSON_LITTLEENDIAN")
end
end)
| if package:config("cmake") then | ||
| package:add("deps", "cmake") | ||
| local configs = { |
|
|
||
| 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") |
There was a problem hiding this comment.
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})
Fixes the broken version of rapidjson