diff options
| author | ruki <[email protected]> | 2019-07-01 22:35:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-07-01 09:35:01 +0800 |
| commit | a40920e82e60b7a87731ba60b848b9bafa8cf937 (patch) | |
| tree | 772b961a8ac0c107142ae0f743b73b332afa2140 /tests/projects | |
| parent | ff067fda68bf431a4d46ce0149d425c7665aa2e7 (diff) | |
add protobuf rules
Diffstat (limited to 'tests/projects')
| -rw-r--r-- | tests/projects/c++/protobuf/src/main.cpp | 1 | ||||
| -rw-r--r-- | tests/projects/c++/protobuf/xmake.lua | 13 | ||||
| -rw-r--r-- | tests/projects/c/protobuf/src/main.c | 7 | ||||
| -rw-r--r-- | tests/projects/c/protobuf/src/test.proto | 8 | ||||
| -rw-r--r-- | tests/projects/c/protobuf/xmake.lua | 20 |
5 files changed, 44 insertions, 5 deletions
diff --git a/tests/projects/c++/protobuf/src/main.cpp b/tests/projects/c++/protobuf/src/main.cpp index db2361659..1e7830c17 100644 --- a/tests/projects/c++/protobuf/src/main.cpp +++ b/tests/projects/c++/protobuf/src/main.cpp @@ -1,4 +1,5 @@ #include <iostream> +#include "test.pb.h" using namespace std; diff --git a/tests/projects/c++/protobuf/xmake.lua b/tests/projects/c++/protobuf/xmake.lua index b340a8cd4..da8f1ee16 100644 --- a/tests/projects/c++/protobuf/xmake.lua +++ b/tests/projects/c++/protobuf/xmake.lua @@ -3,7 +3,7 @@ add_rules("mode.debug", "mode.release") -- add protobuf -add_requires("protobuf-cpp", "protoc") +add_requires("protobuf-cpp") -- add target target("console_c++") @@ -11,10 +11,13 @@ target("console_c++") -- set kind set_kind("binary") - -- add rules and packages - add_rules("protobuf.cpp") - add_packages("protobuf-cpp", "protoc") + -- set languages + set_languages("c++11") + + -- add packages + add_packages("protobuf-cpp") -- add files - add_files("src/*.cpp", "src/*.proto") + add_files("src/*.cpp") + add_files("src/*.proto", {rules = "protobuf.cpp"}) diff --git a/tests/projects/c/protobuf/src/main.c b/tests/projects/c/protobuf/src/main.c new file mode 100644 index 000000000..1f0458b66 --- /dev/null +++ b/tests/projects/c/protobuf/src/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> +#include "test.pb-c.h" + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/tests/projects/c/protobuf/src/test.proto b/tests/projects/c/protobuf/src/test.proto new file mode 100644 index 000000000..0f129ea13 --- /dev/null +++ b/tests/projects/c/protobuf/src/test.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package test; +message TestCase { + string name = 4; +} +message Test { + repeated TestCase case = 1; +} diff --git a/tests/projects/c/protobuf/xmake.lua b/tests/projects/c/protobuf/xmake.lua new file mode 100644 index 000000000..151acf5b4 --- /dev/null +++ b/tests/projects/c/protobuf/xmake.lua @@ -0,0 +1,20 @@ + +-- add rules: debug and release +add_rules("mode.debug", "mode.release") + +-- add protobuf +add_requires("protobuf-c") + +-- add target +target("console_c") + + -- set kind + set_kind("binary") + + -- add packages + add_packages("protobuf-c") + + -- add files + add_files("src/*.c") + add_files("src/*.proto", {rules = "protobuf.c"}) + |
