Selaa lähdekoodia

add protobuf-cpp

ruki 6 vuotta sitten
vanhempi
commit
f2068e7018
2 muutettua tiedostoa jossa 52 lisäystä ja 1 poistoa
  1. 41 0
      packages/p/protobuf-cpp/xmake.lua
  2. 11 1
      packages/t/tbox/xmake.lua

+ 41 - 0
packages/p/protobuf-cpp/xmake.lua

@@ -0,0 +1,41 @@
+package("protobuf-cpp")
+
+    set_homepage("https://developers.google.com/protocol-buffers/")
+    set_description("Google's data interchange format")
+
+    add_urls("https://github.com/protocolbuffers/protobuf/releases/download/v$(version)/protobuf-cpp-$(version).zip")
+    add_versions("3.8.0", "91ea92a8c37825bd502d96af9054064694899c5c7ecea21b8d11b1b5e7e993b5")
+
+    if is_plat("windows") then
+        add_deps("cmake")
+    end
+
+    add_links("protobuf")
+
+    on_load(function (package)
+        package:addenv("PATH", "bin")
+    end)
+
+    on_install("windows", function (package)
+        os.cd("cmake")
+        import("package.tools.cmake").install(package)
+    end)
+
+    on_install("linux", "macosx", function (package)
+        import("package.tools.autoconf").install(package)
+    end)
+
+    on_test(function (package)
+        io.writefile("test.proto", [[
+            syntax = "proto3";
+            package test;
+            message TestCase {
+                string name = 4;
+            }
+            message Test {
+                repeated TestCase case = 1;
+            }
+        ]])
+        os.vrun("protoc test.proto --cpp_out=.")
+        assert(package:check_cxxsnippets({test = io.readfile("test.pb.cc")}, {configs = {includedirs = {".", package:installdir("include")}, languages = "c++11"}}))
+    end)

+ 11 - 1
packages/t/tbox/xmake.lua

@@ -11,7 +11,9 @@ package("tbox")
     add_versions("v1.6.2", "5236090b80374b812c136c7fe6b8c694418cbfc9c0a820ec2ba35ff553078c7b")
     add_versions("v1.6.3", "bc5a957cdb1610c19f0cf94497ad114a0e01fd7d569777e9cb2133c513ef6baa")
 
-    add_configs("micro", {description = "Compile micro core library for the embed system.", default = false, type = "boolean"})
+    add_configs("micro",      {description = "Compile micro core library for the embed system.", default = false, type = "boolean"})
+    add_configs("float",      {description = "Enable or disable the float type.", default = true, type = "boolean"})
+    add_configs("force-utf8", {description = "Forcely regard all tb_char* as utf-8.", default = false, type = "boolean"})
     for _, name in ipairs({"xml", "zip", "hash", "regex", "object", "charset", "database", "coroutine"}) do
         add_configs(name, {description = "Enable the " .. name .. " module.", default = false, type = "boolean"})
     end
@@ -25,6 +27,8 @@ package("tbox")
         add_syslinks("ws2_32", "pthread")
     elseif not is_plat("android") then
         add_syslinks("pthread")
+    elseif is_plat("macosx", "iphoneos") then
+        add_frameworks("Foundation")
     end
 
     on_load(function (package) 
@@ -38,6 +42,12 @@ package("tbox")
         if package:config("micro") then
             config.micro = true
         end
+        if not package:config("float") then
+            config["float"] = false
+        end
+        if package:config("force-utf8") then
+            config["force-utf8"] = true
+        end
         for _, name in ipairs({"xml", "zip", "hash", "regex", "object", "charset", "database", "coroutine"}) do
             if package:config(name) then
                 configs[name] = true