티스토리 뷰
한국어는 아래에 있습니다.
I covered "How to generate protobuf code(except Service) with CMake and prtoto buffer compiler(protoc)
This post is going to cover generate gRPC service code. So, You have to read previous post to understand
what this post's code exactly indicates(If you are not accustomed to CMake).
https://4whomtbts.tistory.com/75
[CMake,ENG/KOR] compile protobuf with CMake
한글은 아래에 있습니다. This post deals with "How to trigger protoc with your CMake". I struggled to trigger my protoc with my CMake, I refered to some projects's CMake files that are expected to us..
4whomtbts.tistory.com
Prerequisites
You have to have "grpc_cpp_plugin", and gRPC, protoc
foreach(__proto_file ${_all_proto_files})
execute_process(COMMAND protoc -I=${proto_dir}
--grpc_out=${proto_gen_dir}
--cpp_out=${proto_gen_dir}
--plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin
${__proto_file}
WORKING_DIRECTORY ${proto_dir})
endforeach(__proto_file)
That's all. (__proto_file, __all_proto_files, proto_gen_dir and proto_dir depend on you.)
Differences between this with previous source code are "--grpc_out=${proto_gen_dir} and
--plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin"
--grpc_out : literally indicates where byproducts are supposed to be placed.
--plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin : This specifies plugin(In this case, grpc_cpp_plugin)
RESULT
한국어
이번에는 proto buffer에서 gRPC에서 사용할 service code를 만들어보겠습니다.
https://4whomtbts.tistory.com/75
준비물
grpc_cpp_plugin과 gRPC, protoc가 필요합니다. 아래 경로에서 확인해보세요
저번 포스팅에서는 CMake랑 protoc를 이용해서 protobuf c++ 코드를 만들었습니다.
foreach(__proto_file ${_all_proto_files})
execute_process(COMMAND protoc -I=${proto_dir}
--grpc_out=${proto_gen_dir}
--cpp_out=${proto_gen_dir}
--plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin
${__proto_file}
WORKING_DIRECTORY ${proto_dir})
endforeach(__proto_file)
끝입니다.
저번 포스팅이랑 달라진건
"--grpc_out=${proto_gen_dir} and --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin"
--grpc_out 는 만들어진 소스코드들이 들어갈 경로입니다.
--plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin : 무슨 플러그인을 사용할지 명시합니다.
결과
'cmake' 카테고리의 다른 글
[CMake, ENG] Let's use "FUNCTION" in CMake (0) | 2019.12.27 |
---|---|
[CMake,ENG/KOR] compile protobuf with CMake (0) | 2019.12.24 |
[CMake, KOR] get_filename_component (0) | 2019.12.23 |
[CMake, KOR] foreach - 1 (0) | 2019.12.23 |
[CMake,KOR] LIST (0) | 2019.12.23 |
- Total
- Today
- Yesterday
- CMake get file name
- CMake for
- 14714 복습법
- CMake 강좌
- CMake run proto compiler
- 14714 공부법
- CMake run protoc
- 복습 어플
- 14714 어플리케이션
- review reminder
- 복습 계획어플
- CMake get_filename_Component
- react-native
- buffer-over-flow
- aws 청구문의
- 토리파 공부법
- CMake for문
- function pointer overflow
- 14714 앱
- CMake probouf
- get_filename_component
- CMAke 파일이름 추출
- aws 프리티어 요금청구
- 함수포인터 오버라이트
- CMake 기초
- 14714 어플
- 14714 공부법 어플리케이션
- 14714 review
- CMake 반복문
- 14714 플래너
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |