|
@@ -19,6 +19,7 @@ package("spdlog")
|
|
|
add_versions("v1.3.1", "db6986d0141546d4fba5220944cc1f251bd8afdfc434bda173b4b0b6406e3cd0")
|
|
|
|
|
|
add_configs("header_only", {description = "Use header only version.", default = true, type = "boolean"})
|
|
|
+ add_configs("std_format", {description = "Use std::format instead of fmt library.", default = false, type = "boolean"})
|
|
|
add_configs("fmt_external", {description = "Use external fmt library instead of bundled.", default = false, type = "boolean"})
|
|
|
add_configs("fmt_external_ho", {description = "Use external fmt header-only library instead of bundled.", default = false, type = "boolean"})
|
|
|
add_configs("noexcept", {description = "Compile with -fno-exceptions. Call abort() on any spdlog exceptions.", default = false, type = "boolean"})
|
|
@@ -34,7 +35,9 @@ package("spdlog")
|
|
|
package:add("deps", "cmake")
|
|
|
end
|
|
|
assert(not (package:config("fmt_external") and package:config("fmt_external_ho")), "fmt_external and fmt_external_ho are mutually exclusive")
|
|
|
- if package:config("fmt_external") then
|
|
|
+ if package:config("std_format") then
|
|
|
+ package:add("defines", "SPDLOG_USE_STD_FORMAT")
|
|
|
+ elseif package:config("fmt_external") then
|
|
|
package:add("defines", "SPDLOG_FMT_EXTERNAL")
|
|
|
package:add("deps", "fmt")
|
|
|
elseif package:config("fmt_external_ho") then
|
|
@@ -57,6 +60,7 @@ package("spdlog")
|
|
|
|
|
|
local configs = {"-DSPDLOG_BUILD_TESTS=OFF", "-DSPDLOG_BUILD_EXAMPLE=OFF"}
|
|
|
table.insert(configs, "-DSPDLOG_BUILD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
|
|
|
+ table.insert(configs, "-DSPDLOG_USE_STD_FORMAT=" .. (package:config("std_format") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSPDLOG_FMT_EXTERNAL=" .. (package:config("fmt_external") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSPDLOG_FMT_EXTERNAL_HO=" .. (package:config("fmt_external_ho") and "ON" or "OFF"))
|
|
|
table.insert(configs, "-DSPDLOG_NO_EXCEPTIONS=" .. (package:config("noexcept") and "ON" or "OFF"))
|
|
@@ -65,5 +69,9 @@ package("spdlog")
|
|
|
end)
|
|
|
|
|
|
on_test(function (package)
|
|
|
- assert(package:has_cxxfuncs("spdlog::info(\"\")", {includes = "spdlog/spdlog.h", configs = {languages = "c++14"}}))
|
|
|
+ if package:config("std_format") then
|
|
|
+ assert(package:has_cxxfuncs("spdlog::info(\"\")", {includes = "spdlog/spdlog.h", configs = {languages = "c++20"}}))
|
|
|
+ else
|
|
|
+ assert(package:has_cxxfuncs("spdlog::info(\"\")", {includes = "spdlog/spdlog.h", configs = {languages = "c++14"}}))
|
|
|
+ end
|
|
|
end)
|