2402e6c1d48e1ef4fb219cedda778d3f349dbd66
[apps/homescreen.git] / homescreen / meson.build
1 cpp = meson.get_compiler('cpp')
2 qt5_dep = dependency('qt5', modules: ['Qml', 'Quick', 'Gui'])
3 dep_wayland_client = dependency('wayland-client', version: '>= 1.20.0')
4 dep_qtappfw = [
5     dependency('qtappfw-weather'),
6     dependency('qtappfw-network'),
7     dependency('qtappfw-bt'),
8     dependency('qtappfw-vehicle-signals'),
9     dependency('qtappfw-applauncher')
10 ]
11
12 qt_defines = []
13 qpa_header_path = join_paths(qt5_dep.version(), 'QtGui')
14 qpa_header = join_paths(qpa_header_path, 'qpa/qplatformnativeinterface.h')
15 # we pass this QT_QPA_HEADER straight in the code as there's no easy
16 # way to pass the correct header
17 if cpp.has_header(qpa_header, dependencies : qt5_dep)
18   qt_defines += [ '-DQT_QPA_HEADER=<@0@>'.format(qpa_header) ]
19   message('Found QtGui QPA header in ' + qpa_header_path)
20 endif
21
22 prog_scanner = find_program('wayland-scanner')
23 agl_compositor_dep = dependency('agl-compositor-0.0.21-protocols')
24 dir_agl_compositor_base = agl_compositor_dep.get_variable(pkgconfig: 'pkgdatadir')
25
26 homescreen_dep = [
27     qt5_dep,
28     dep_wayland_client,
29     dep_qtappfw,
30 ]
31
32 homescreen_resources = [
33   'qml/images/MediaPlayer/mediaplayer.qrc',
34   'qml/images/MediaMusic/mediamusic.qrc',
35   'qml/images/Weather/weather.qrc',
36   'qml/images/Shortcut/shortcut.qrc',
37   'qml/images/Status/status.qrc',
38   'qml/images/images.qrc',
39   'qml/qml.qrc'
40 ]
41
42 resource_files = qt5.compile_resources(sources: homescreen_resources)
43
44 protocols = [
45         [ 'agl-shell', 'agl-compositor' ],
46 ]
47
48 foreach proto: protocols
49         proto_name = proto[0]
50         if proto[1] == 'agl-compositor'
51                 base_file = proto_name
52                 xml_path = join_paths(dir_agl_compositor_base, '@0@.xml'.format(base_file))
53         endif
54
55         foreach output_type: [ 'client-header', 'server-header', 'private-code' ]
56                 if output_type == 'client-header'
57                         output_file = '@0@-client-protocol.h'.format(base_file)
58                 elif output_type == 'server-header'
59                         output_file = '@0@-server-protocol.h'.format(base_file)
60                 else
61                         output_file = '@0@-protocol.c'.format(base_file)
62                         if prog_scanner.version().version_compare('< 1.14.91')
63                                 output_type = 'code'
64                         endif
65                 endif
66
67                 var_name = output_file.underscorify()
68                 target = custom_target(
69                         '@0@ @1@'.format(base_file, output_type),
70                         command: [ prog_scanner, output_type, '@INPUT@', '@OUTPUT@' ],
71                         input: xml_path,
72                         output: output_file,
73                 )
74                 message('protocol name is ' + var_name)
75                 set_variable(var_name, target)
76         endforeach
77 endforeach
78
79 homescreen_src_headers = [
80   'src/applicationlauncher.h',
81   'src/mastervolume.h',
82   'src/statusbarmodel.h',
83   'src/statusbarserver.h',
84   'src/homescreenhandler.h',
85   'src/shell.h'
86 ]
87
88 moc_files = qt5.compile_moc(headers: homescreen_src_headers,
89                             dependencies: qt5_dep)
90
91 homescreen_src = [
92   'src/shell.cpp',
93   'src/statusbarserver.cpp',
94   'src/statusbarmodel.cpp',
95   'src/applicationlauncher.cpp',
96   'src/mastervolume.cpp',
97   'src/homescreenhandler.cpp',
98   'src/main.cpp',
99   agl_shell_client_protocol_h,
100   agl_shell_protocol_c
101 ]
102
103 executable('homescreen', homescreen_src, resource_files, moc_files,
104             cpp_args: qt_defines,
105             dependencies : homescreen_dep,
106             install: true)