Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(run): generate library #9460

Merged
merged 4 commits into from
Jul 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
cmake can handle k8s.min.proto
  • Loading branch information
dbolduc committed Jul 12, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 6f96b5d338f70edee13db41b79fb657c9183bd14
25 changes: 14 additions & 11 deletions cmake/CompileProtos.cmake
Original file line number Diff line number Diff line change
@@ -80,9 +80,10 @@ function (google_cloud_cpp_generate_proto SRCS)
foreach (file_path ${_opt_UNPARSED_ARGUMENTS})
get_filename_component(file_directory "${file_path}" DIRECTORY)
get_filename_component(file_name "${file_path}" NAME)
# This gets the filename without the extension, analogous to $(basename
# "${file_path}" .proto)
get_filename_component(file_stem "${file_path}" NAME_WE)
# This gets the file name without the ".proto" extension. We would like
# to use get_filename_component with the option NAME_WLE, but that is
# not available until CMake 3.14
string(REPLACE ".proto" "" file_stem "${file_name}")

# Strip all the prefixes in ${_opt_PROTO_PATH_DIRECTORIES} from the
# source proto directory
@@ -175,11 +176,13 @@ function (google_cloud_cpp_generate_grpcpp SRCS)
endforeach ()

set(${SRCS})
foreach (filename ${_opt_UNPARSED_ARGUMENTS})
get_filename_component(file_directory "${filename}" DIRECTORY)
# This gets the filename without the extension, analogous to $(basename
# "${filename}" .proto)
get_filename_component(file_stem "${filename}" NAME_WE)
foreach (file_path ${_opt_UNPARSED_ARGUMENTS})
get_filename_component(file_directory "${file_path}" DIRECTORY)
get_filename_component(file_name "${file_path}" NAME)
# This gets the file name without the ".proto" extension. We would like
# to use get_filename_component with the option NAME_WLE, but that is
# not available until CMake 3.14
string(REPLACE ".proto" "" file_stem "${file_name}")

# Strip all the prefixes in ${_opt_PROTO_PATH_DIRECTORIES} from the
# source proto directory
@@ -201,9 +204,9 @@ function (google_cloud_cpp_generate_grpcpp SRCS)
--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin>
"--grpc_out=${CMAKE_CURRENT_BINARY_DIR}"
"--cpp_out=${CMAKE_CURRENT_BINARY_DIR}" ${protobuf_include_path}
"${filename}"
DEPENDS "${filename}" protobuf::protoc gRPC::grpc_cpp_plugin
COMMENT "Running gRPC C++ protocol buffer compiler on ${filename}"
"${file_path}"
DEPENDS "${file_path}" protobuf::protoc gRPC::grpc_cpp_plugin
COMMENT "Running gRPC C++ protocol buffer compiler on ${file_path}"
VERBATIM)
endforeach ()