star9029 1 рік тому
батько
коміт
f5cdec3d03
1 змінених файлів з 20 додано та 13 видалено
  1. 20 13
      packages/p/protobuf-cpp/xmake.lua

+ 20 - 13
packages/p/protobuf-cpp/xmake.lua

@@ -1,5 +1,4 @@
 package("protobuf-cpp")
-
     set_homepage("https://developers.google.com/protocol-buffers/")
     set_description("Google's data interchange format for cpp")
 
@@ -85,18 +84,26 @@ package("protobuf-cpp")
     end)
 
     on_test(function (package)
-        if package:is_cross() then
-            return
+        if not package:is_cross() then
+            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=.")
         end
-        io.writefile("test.proto", [[
-            syntax = "proto3";
-            package test;
-            message TestCase {
-                string name = 4;
-            }
-            message Test {
-                repeated TestCase case = 1;
+
+        assert(package:check_cxxsnippets({test = [[
+            #include <google/protobuf/timestamp.pb.h>
+            #include <google/protobuf/util/time_util.h>
+            void test() {
+                google::protobuf::Timestamp ts;
+                google::protobuf::util::TimeUtil::FromString("1972-01-01T10:00:20.021Z", &ts);
             }
-        ]])
-        os.vrun("protoc test.proto --cpp_out=.")
+        ]]}, {configs = {languages = "c++17"}}))
     end)