clients/grpc: Initial start for gRPC proxy
[src/agl-compositor.git] / clients / meson.build
index 08b2c08..ff27a60 100644 (file)
@@ -1,5 +1,32 @@
 dep_wayland_client = dependency('wayland-client', version: '>= 1.17.0')
 
+grpcpp_reflection_dep = cxx.find_library('grpc++_reflection')
+protoc = find_program('protoc')
+grpc_cpp = find_program('grpc_cpp_plugin')
+
+protoc_gen = generator(protoc, \
+                       output : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
+                       arguments : ['--proto_path=@CURRENT_SOURCE_DIR@/../protocol',
+                         '--cpp_out=@BUILD_DIR@',
+                         '@INPUT@'])
+
+generated_protoc_sources = protoc_gen.process('../protocol/agl_shell.proto')
+
+grpc_gen = generator(protoc, \
+                     output : ['@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'],
+                     arguments : ['--proto_path=@CURRENT_SOURCE_DIR@/../protocol',
+                       '--grpc_out=@BUILD_DIR@',
+                       '--plugin=protoc-gen-grpc=' + grpc_cpp.path(),
+                       '@INPUT@'])
+generated_grpc_sources = grpc_gen.process('../protocol/agl_shell.proto')
+
+grpc_deps = [
+    dependency('protobuf'),
+    dependency('grpc'),
+    dependency('grpc++'),
+    grpcpp_reflection_dep,
+]
+
 clients = [
 {
        'basename': 'agl-screenshooter',
@@ -16,6 +43,18 @@ clients = [
        'deps_objs' : [ dep_wayland_client ],
        'deps': [ 'cairo' ],
 },
+{
+    'basename': 'agl-shell-grpc-server',
+    'sources': [
+      'grpc.cpp',
+      generated_protoc_sources,
+      generated_grpc_sources,
+      agl_shell_client_protocol_h,
+      agl_shell_protocol_c,
+    ],
+    'deps_objs' : [ grpc_deps, dep_wayland_client ],
+    'deps' : [],
+},
 ]
 
 foreach t: clients
@@ -29,12 +68,22 @@ foreach t: clients
     endif
   endforeach
 
-  executable(
-      t_name, t.get('sources'),
-      include_directories: [ common_inc ],
-      dependencies: [ t_deps, libweston_dep ],
-      install: true,
-  )
+  if t_name == 'agl-shell-grpc-server'
+    executable(
+        t_name, t.get('sources'),
+        include_directories: [ common_inc ],
+        dependencies: [ t_deps, libweston_dep ],
+        install: true,
+        install_dir: dir_module_agl_compositor,
+    )
+  else
+    executable(
+        t_name, t.get('sources'),
+        include_directories: [ common_inc ],
+        dependencies: [ t_deps, libweston_dep ],
+        install: true,
+    )
+  endif
 
   message('Building client ' + t_name)
 endforeach