Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spdlog: improve fmt_external build version dependency #5465

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 17 additions & 1 deletion packages/s/spdlog/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,23 @@ package("spdlog")
package:add("defines", "SPDLOG_USE_STD_FORMAT")
elseif package:config("fmt_external") or package:config("fmt_external_ho") then
package:add("defines", "SPDLOG_FMT_EXTERNAL")
package:add("deps", "fmt", {configs = {header_only = package:config("header_only")}})
local fmt_version = {
["v1.14.1"] = "10.2.1",
["v1.14.0"] = "10.2.1",
["v1.13.0"] = "10.0.0",
["v1.12.0"] = "10.0.0",
["v1.11.0"] = "9.1.0",
["v1.10.0"] = "8.1.1",
["v1.9.2"] = "8.0.0",
["v1.9.1"] = "8.0.0",
["v1.9.0"] = "8.0.0",
default = "7.1.3",
["v1.5.0"] = "6.1.2",
["v1.4.2"] = "6.0.0",
["v1.3.1"] = "5.3.0",
}
local fmt_ver = fmt_version[tostring(package:version())] or fmt_version.default
Copy link
Member

@waruqi waruqi Oct 10, 2024

Choose a reason for hiding this comment

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

We should not hardcode a specific version number in the package. This can easily lead to various dependency conflict issues.

you can use add_requireconfs("spdlog.fmt", {version = "7.1.3", override = true}) to modify it's version in project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

在另一个package里面 add_deps 也能用这个来 modify么

Copy link
Contributor Author

Choose a reason for hiding this comment

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

还有就是 本身spdlog 每个版本雀食要对应 fmt的版本,不然编不过,这个包目前好像没有做这个处理 都是默认dep了最新的fmt

Copy link
Member

Choose a reason for hiding this comment

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

在另一个package里面 add_deps 也能用这个来 modify么

add_requireconfs 自己随意改。

Copy link
Member

Choose a reason for hiding this comment

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

还有就是 本身spdlog 每个版本雀食要对应 fmt的版本,不然编不过,这个包目前好像没有做这个处理 都是默认dep了最新的fmt

用户侧 自己走 add_requireconfs 改,要是每个都 deps 里面写死。。依赖一多,各种版本冲突

package:add("deps", "fmt " .. fmt_ver, {configs = {header_only = package:config("header_only")}})
end
if not package:config("header_only") and package:config("fmt_external_ho") then
package:add("defines", "FMT_HEADER_ONLY=1")
Expand Down
Loading