mirror of https://github.com/qt/qtgrpc.git
testservers: add conditional proto3_optional support
protoc versions 3.12 - 3.15 need to enable optional support explicitly Pick-to: 6.8 Change-Id: Ie672e1bb06fb8665f2517bad9c39cdfcc9b3b728 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
8017462139
commit
01d6739d9d
|
|
@ -17,11 +17,18 @@ set(generated_files
|
|||
"${out_dir}/testservice.pb.h" "${out_dir}/testservice.pb.cc"
|
||||
"${out_dir}/testservice.grpc.pb.h" "${out_dir}/testservice.grpc.pb.cc")
|
||||
|
||||
set(extra_protoc_args "")
|
||||
get_target_property(protoc_version WrapProtoc::WrapProtoc _qt_internal_protobuf_version)
|
||||
if(protoc_version VERSION_GREATER_EQUAL "3.12" AND protoc_version VERSION_LESS "3.15")
|
||||
list(APPEND extra_protoc_args "--experimental_allow_proto3_optional")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${generated_files}
|
||||
COMMAND
|
||||
$<TARGET_FILE:WrapProtoc::WrapProtoc>
|
||||
ARGS
|
||||
${extra_protoc_args}
|
||||
--grpc_out "${out_dir}"
|
||||
--cpp_out "${out_dir}"
|
||||
-I "${CMAKE_CURRENT_LIST_DIR}/../../../shared/proto/"
|
||||
|
|
|
|||
|
|
@ -28,12 +28,20 @@ set(testserver_gen_output
|
|||
"${CMAKE_CURRENT_BINARY_DIR}/qtgrpc/tests/testservice_grpc.pb.go"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/qtgrpc/tests/testservice.pb.go"
|
||||
)
|
||||
|
||||
set(extra_protoc_args "")
|
||||
get_target_property(protoc_version WrapProtoc::WrapProtoc _qt_internal_protobuf_version)
|
||||
if(protoc_version VERSION_GREATER_EQUAL "3.12" AND protoc_version VERSION_LESS "3.15")
|
||||
list(APPEND extra_protoc_args "--experimental_allow_proto3_optional")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${testserver_gen_output}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E env "PATH=$ENV{PATH}:${go_path}/bin" "GOPATH=${go_path}" --
|
||||
$<TARGET_FILE:WrapProtoc::WrapProtoc>
|
||||
${extra_protoc_args}
|
||||
--go_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
--go-grpc_out=${CMAKE_CURRENT_BINARY_DIR}
|
||||
-I${CMAKE_CURRENT_LIST_DIR}/../../../shared/proto
|
||||
|
|
|
|||
Loading…
Reference in New Issue