clients/grpc: Initial start for gRPC proxy
[src/agl-compositor.git] / clients / meson.build
1 dep_wayland_client = dependency('wayland-client', version: '>= 1.17.0')
2
3 grpcpp_reflection_dep = cxx.find_library('grpc++_reflection')
4 protoc = find_program('protoc')
5 grpc_cpp = find_program('grpc_cpp_plugin')
6
7 protoc_gen = generator(protoc, \
8                        output : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
9                        arguments : ['--proto_path=@CURRENT_SOURCE_DIR@/../protocol',
10                          '--cpp_out=@BUILD_DIR@',
11                          '@INPUT@'])
12
13 generated_protoc_sources = protoc_gen.process('../protocol/agl_shell.proto')
14
15 grpc_gen = generator(protoc, \
16                      output : ['@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'],
17                      arguments : ['--proto_path=@CURRENT_SOURCE_DIR@/../protocol',
18                        '--grpc_out=@BUILD_DIR@',
19                        '--plugin=protoc-gen-grpc=' + grpc_cpp.path(),
20                        '@INPUT@'])
21 generated_grpc_sources = grpc_gen.process('../protocol/agl_shell.proto')
22
23 grpc_deps = [
24     dependency('protobuf'),
25     dependency('grpc'),
26     dependency('grpc++'),
27     grpcpp_reflection_dep,
28 ]
29
30 clients = [
31 {
32         'basename': 'agl-screenshooter',
33         'sources': [
34           'screenshooter.c',
35           '../shared/file-util.c',
36           '../shared/os-compatibility.c',
37           '../shared/xalloc.c',
38           agl_screenshooter_client_protocol_h,
39           agl_screenshooter_protocol_c,
40           xdg_output_unstable_v1_client_protocol_h,
41           xdg_output_unstable_v1_protocol_c,
42         ],
43         'deps_objs' : [ dep_wayland_client ],
44         'deps': [ 'cairo' ],
45 },
46 {
47     'basename': 'agl-shell-grpc-server',
48     'sources': [
49       'grpc.cpp',
50       generated_protoc_sources,
51       generated_grpc_sources,
52       agl_shell_client_protocol_h,
53       agl_shell_protocol_c,
54     ],
55     'deps_objs' : [ grpc_deps, dep_wayland_client ],
56     'deps' : [],
57 },
58 ]
59
60 foreach t: clients
61   t_name = t.get('basename')
62   t_deps = t.get('deps_objs', [])
63
64   foreach xdep: t.get('deps', [])
65     dep = dependency(xdep, required: false)
66     if dep.found()
67       t_deps += dep
68     endif
69   endforeach
70
71   if t_name == 'agl-shell-grpc-server'
72     executable(
73         t_name, t.get('sources'),
74         include_directories: [ common_inc ],
75         dependencies: [ t_deps, libweston_dep ],
76         install: true,
77         install_dir: dir_module_agl_compositor,
78     )
79   else
80     executable(
81         t_name, t.get('sources'),
82         include_directories: [ common_inc ],
83         dependencies: [ t_deps, libweston_dep ],
84         install: true,
85     )
86   endif
87
88   message('Building client ' + t_name)
89 endforeach