|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
package("msgpack-cxx") |
|
|
|
|
set_kind("library", {headeronly = true}) |
|
|
|
|
set_homepage("https://msgpack.org/") |
|
|
|
|
set_description("MessagePack implementation for C++") |
|
|
|
|
set_license("BSL-1.0") |
|
|
|
@ -8,16 +9,9 @@ package("msgpack-cxx") |
|
|
|
|
add_versions("6.1.0", "23ede7e93c8efee343ad8c6514c28f3708207e5106af3b3e4969b3a9ed7039e7") |
|
|
|
|
add_versions("4.1.1", "8115c5edcf20bc1408c798a6bdaec16c1e52b1c34859d4982a0fb03300438f0b") |
|
|
|
|
|
|
|
|
|
add_configs("header_only", {description = "Use header only version.", default = false, type = "boolean"}) |
|
|
|
|
add_configs("std", {description = "Choose C++ standard version.", default = "cxx17", type = "string", values = {"cxx98", "cxx11", "cxx14", "cxx17", "cxx20"}}) |
|
|
|
|
add_configs("boost", {description = "Use Boost", default = false, type = "boolean"}) |
|
|
|
|
|
|
|
|
|
on_load(function (package) |
|
|
|
|
if package:config("header_only") then |
|
|
|
|
package:set("kind", "library", {headeronly = true}) |
|
|
|
|
else |
|
|
|
|
package:add("deps", "cmake") |
|
|
|
|
end |
|
|
|
|
if package:config("boost") then |
|
|
|
|
package:add("deps", "boost") |
|
|
|
|
else |
|
|
|
@ -26,26 +20,7 @@ package("msgpack-cxx") |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
on_install(function (package) |
|
|
|
|
if package:config("header_only") then |
|
|
|
|
os.cp("include", package:installdir()) |
|
|
|
|
else |
|
|
|
|
local configs = {"-DMSGPACK_BUILD_EXAMPLES=OFF", "-DMSGPACK_BUILD_TESTS=OFF", "-DMSGPACK_BUILD_DOCS=OFF"} |
|
|
|
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
|
|
|
|
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
|
|
|
|
if package:config("std") ~= "cxx98" then |
|
|
|
|
table.insert(configs, "-DMSGPACK_" .. package:config("std"):upper() .. "=ON") |
|
|
|
|
end |
|
|
|
|
if package:config("boost") then |
|
|
|
|
table.insert(configs, "-DMSGPACK_USE_STATIC_BOOST=ON") |
|
|
|
|
table.insert(configs, "-DMSGPACK_USE_BOOST=ON") |
|
|
|
|
if is_plat("windows") then |
|
|
|
|
table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF")) |
|
|
|
|
end |
|
|
|
|
else |
|
|
|
|
table.insert(configs, "-DMSGPACK_USE_BOOST=OFF") |
|
|
|
|
end |
|
|
|
|
import("package.tools.cmake").install(package, configs) |
|
|
|
|
end |
|
|
|
|
os.cp("include", package:installdir()) |
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
on_test(function (package) |
|
|
|
@ -56,5 +31,5 @@ package("msgpack-cxx") |
|
|
|
|
std::stringstream buffer; |
|
|
|
|
msgpack::pack(buffer, src); |
|
|
|
|
} |
|
|
|
|
]], {configs = {languages = package:config("std")}, includes = "msgpack.hpp"})) |
|
|
|
|
]], {configs = {languages = "cxx11"}, includes = "msgpack.hpp"})) |
|
|
|
|
end) |
|
|
|
|