Skip to content

Commit 435d451

Browse files
committed
test protobuf
1 parent 1b021aa commit 435d451

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/libs/coost)
3333
include_directories(${PROJECT_SOURCE_DIR}/libs/coost/include)
3434

3535
# 可执行程序main
36-
add_executable(main tests/test_coost.cpp)
36+
add_executable(main tests/testprotobuf.cpp)
3737
target_link_libraries(main
3838
pthread
3939
# utils
@@ -43,7 +43,7 @@ target_link_libraries(main
4343
)
4444

4545
# 可执行程序test
46-
add_executable(test tests/testtmp.cpp)
47-
target_link_libraries(test co)
46+
#add_executable(test tests/testtmp.cpp)
47+
#target_link_libraries(test co)
4848

4949

build_protobuf.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12

23
set -e # exit immediately on error
34
set -x # display all commands

codegen.sh

-10
This file was deleted.
File renamed without changes.
File renamed without changes.

game/proto/test.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
syntax = "proto3";
22

3-
message TestReq {
3+
message sTest {
44
int32 uid = 1;
55
string name = 2;
66
repeated int32 nums = 3;

gen_code.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
protoc="./3rd/protobuf/bin/protoc"
4+
srcdir="./game/proto"
5+
destdir="./game/proto/cpp"
6+
7+
echo "==== gen code start ===="
8+
set -e # exit immediately on error
9+
set -x # display all commands
10+
11+
$protoc -I=$srcdir $srcdir/test.proto --cpp_out=$destdir
12+
13+
set +x # cancel display all commands
14+
echo "==== gen code success ===="

0 commit comments

Comments
 (0)