Add more grpc - Asyncstuff
[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       'main-grpc.cpp',
50       'grpc-async-cb.cpp',
51       'shell.cpp',
52       generated_protoc_sources,
53       generated_grpc_sources,
54       agl_shell_client_protocol_h,
55       agl_shell_protocol_c,
56     ],
57     'deps_objs' : [ grpc_deps, dep_wayland_client ],
58     'deps' : [],
59 },
60 ]
61
62 foreach t: clients
63   t_name = t.get('basename')
64   t_deps = t.get('deps_objs', [])
65
66   foreach xdep: t.get('deps', [])
67     dep = dependency(xdep, required: false)
68     if dep.found()
69       t_deps += dep
70     endif
71   endforeach
72
73   if t_name == 'agl-shell-grpc-server'
74     executable(
75         t_name, t.get('sources'),
76         include_directories: [ common_inc ],
77         dependencies: [ t_deps, libweston_dep ],
78         install: true,
79         install_dir: dir_module_agl_compositor,
80     )
81   else
82     executable(
83         t_name, t.get('sources'),
84         include_directories: [ common_inc ],
85         dependencies: [ t_deps, libweston_dep ],
86         install: true,
87     )
88   endif
89
90   message('Building client ' + t_name)
91 endforeach