Browse Source

msgpack-cxx: make headeronly and boost optional (#4648)

* msgpack-cxx: make option to not use boost

* msgpack-cxx: test remove limits

* msgpack-cxx: test with boost

* msgpack-cxx: move MSGPACK_NO_BOOST into on_load

* msgpack-cxx: make headeronly

* msgpack-cxx: remove cmake

* msgpack-cxx: add config header_only

* Revert "msgpack-cxx: add config header_only"

This reverts commit 6361a9fd83e197031cd702cf55304c9dff3bb138.

* Reapply "msgpack-cxx: add config header_only"

This reverts commit 32fb42d4116a54513aacaa0d21f58a1bd475f7e2.

* msgpack-cxx: add `set_kind("library", {headeronly = true})`

* msgpack-cxx: remove `package:set("kind", "library", {headeronly = true})`

* msgpack-cxx: disable boost for unsupported plats

* msgpack-cxx: on line boost config

* msgpack-cxx: add `package:set("kind", "library", {headeronly = true})`

* msgpack-cxx: add requested

* msgpack-cxx: remove header_only config
Chi Huu Huynh 1 year ago
parent
commit
7169f79cf3
1 changed files with 19 additions and 6 deletions
  1. 19 6
      packages/m/msgpack-cxx/xmake.lua

+ 19 - 6
packages/m/msgpack-cxx/xmake.lua

@@ -1,5 +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")
@@ -10,17 +10,30 @@ package("msgpack-cxx")
     add_versions("4.1.1", "8115c5edcf20bc1408c798a6bdaec16c1e52b1c34859d4982a0fb03300438f0b")
 
     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 = is_plat("macosx", "linux", "windows", "bsd", "mingw", "cross"), type = "boolean"})
+
+    add_deps("cmake")
+
+    on_load(function (package)
+        if package:config("boost") then
+            package:add("deps", "boost")
+        else
+            package:add("defines", "MSGPACK_NO_BOOST")
+        end
+    end)
 
-    add_deps("cmake", "boost")
-    on_install("windows", "macosx", "linux", "mingw", function (package)
-        local configs = {"-DMSGPACK_BUILD_EXAMPLES=OFF", "-DMSGPACK_BUILD_TESTS=OFF", "-DMSGPACK_BUILD_DOCS=OFF", "-DMSGPACK_USE_STATIC_BOOST=ON"}
+    on_install(function (package)
+        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:is_plat("windows") then
-            table.insert(configs, "-DBoost_USE_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
+        if package:config("boost") then
+            table.insert(configs, "-DMSGPACK_USE_STATIC_BOOST=ON")
+            table.insert(configs, "-DMSGPACK_USE_BOOST=ON")
+        else
+            table.insert(configs, "-DMSGPACK_USE_BOOST=OFF")
         end
         import("package.tools.cmake").install(package, configs)
     end)