summaryrefslogtreecommitdiffstats
path: root/radio/meson.build
blob: 7ae1bac9a07033a123359ebb7aad30a9ae1389a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
cpp = meson.get_compiler('cpp')
grpcpp_reflection_dep = cpp.find_library('grpc++_reflection')

qt5_dep = dependency('qt5', modules: ['Qml'])
radio_dep = [
    qt5_dep,
    dependency('protobuf'),
    dependency('grpc'),
    dependency('grpc++'),
    grpcpp_reflection_dep,
]

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@/protos',
                         '--cpp_out=@BUILD_DIR@',
                         '@INPUT@'])
generated_protoc_sources = protoc_gen.process('protos/radio.proto')

grpc_gen = generator(protoc, \
                     output : ['@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'],
                     arguments : ['--proto_path=@CURRENT_SOURCE_DIR@/protos',
                       '--grpc_out=@BUILD_DIR@',
                       '--plugin=protoc-gen-grpc=' + grpc_cpp.path(),
                       '@INPUT@'])
generated_grpc_sources = grpc_gen.process('protos/radio.proto')

moc_files = qt5.compile_moc(headers: ['RadioClient.h', 'RadioGrpcClient.h'],
                            dependencies: qt5_dep)

src = [
    'RadioClient.cpp',
    'RadioGrpcClient.cpp',
    generated_protoc_sources,
    generated_grpc_sources,
    moc_files
]

lib = shared_library('qtappfw-radio',
                     sources: src,
                     version: '1.0.0',
                     soversion: '0',
                     dependencies: radio_dep,
                     install: true)

install_headers('RadioClient.h')

pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : lib,
                 version : '1.0',
                 name : 'libqtappfw-radio',
                 filebase : 'qtappfw-radio',
                 requires: 'Qt5Qml',
                 description : 'Library wrapping AGL radio API in Qt objects')