| #Only edit file in g3 |
| |
| includes = include_directories('.') |
| protoc = find_program('protoc') |
| grpc_plugin = find_program('grpc_cpp_plugin') |
| proto_gen = generator(protoc, |
| output : [ |
| '@BASENAME@.pb.cc', |
| '@BASENAME@.pb.h', |
| ], |
| arguments : [ |
| '--proto_path=@CURRENT_SOURCE_DIR@', |
| '--grpc_out=@BUILD_DIR@', |
| '--cpp_out=@BUILD_DIR@', |
| '--plugin=protoc-gen-grpc='+grpc_plugin.path(), |
| '@INPUT@']) |
| grpc_gen = generator(protoc, |
| output : [ |
| '@BASENAME@.grpc.pb.cc', |
| '@BASENAME@.grpc.pb.h', |
| ], |
| arguments : [ |
| '--proto_path=@CURRENT_SOURCE_DIR@', |
| '--grpc_out=@BUILD_DIR@', |
| '--cpp_out=@BUILD_DIR@', |
| '--plugin=protoc-gen-grpc='+grpc_plugin.path(), |
| '@INPUT@']) |
| protobuf_generated = [ |
| proto_gen.process( |
| [ |
| 'safepower_agent.proto', |
| 'safepower_agent_config.proto', |
| 'state_persistence.proto', |
| ], |
| preserve_path_from : meson.current_source_dir()), |
| grpc_gen.process( |
| [ |
| 'safepower_agent.proto', |
| ], |
| preserve_path_from : meson.current_source_dir()) |
| ] |
| cpp_compiler = meson.get_compiler('cpp') |
| grpc_deps = dependency('grpc', required: false) |
| if not grpc_deps.found() |
| grpc_deps = cpp_compiler.find_library('grpc') |
| endif |
| grpcpp_deps = dependency('grpc++', required: false) |
| if not grpcpp_deps.found() |
| grpcpp_deps = cpp_compiler.find_library('grpc++') |
| endif |
| gpr_deps = dependency('gpr', required: false) |
| if not gpr_deps.found() |
| gpr_deps = cpp_compiler.find_library('gpr') |
| endif |
| gpowerd_proto_deps = [ |
| gpr_deps, |
| grpc_deps, |
| grpcpp_deps, |
| dependency('protobuf'), |
| cpp_compiler.find_library('grpc++_reflection'), |
| ] |
| libgpowerd_proto = library( |
| 'gpowerd_proto', |
| protobuf_generated, |
| implicit_include_directories: false, |
| dependencies: gpowerd_proto_deps, |
| ) |
| gpowerd_proto = declare_dependency( |
| sources: [protobuf_generated], |
| dependencies: gpowerd_proto_deps, |
| link_with: [libgpowerd_proto], |
| ) |