3ee5e48f9cb4e32534859732f79984110178c688
[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 dep_scanner = dependency('wayland-scanner')
23 prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner'))
24 agl_compositor_dep = dependency('agl-compositor-0.0.21-protocols')
25 dir_agl_compositor_base = agl_compositor_dep.get_pkgconfig_variable('pkgdatadir')
26
27 homescreen_dep = [
28     qt5_dep,
29     dep_wayland_client,
30     dep_qtappfw,
31 ]
32
33 homescreen_resources = [
34   'qml/images/MediaPlayer/mediaplayer.qrc',
35   'qml/images/MediaMusic/mediamusic.qrc',
36   'qml/images/Weather/weather.qrc',
37   'qml/images/Shortcut/shortcut.qrc',
38   'qml/images/Status/status.qrc',
39   'qml/images/images.qrc',
40   'qml/qml.qrc'
41 ]
42
43 resource_files = qt5.compile_resources(sources: homescreen_resources)
44
45 protocols = [
46         [ 'agl-shell', 'agl-compositor' ],
47 ]
48
49 foreach proto: protocols
50         proto_name = proto[0]
51         if proto[1] == 'agl-compositor'
52                 base_file = proto_name
53                 xml_path = join_paths(dir_agl_compositor_base, '@0@.xml'.format(base_file))
54         endif
55
56         foreach output_type: [ 'client-header', 'server-header', 'private-code' ]
57                 if output_type == 'client-header'
58                         output_file = '@0@-client-protocol.h'.format(base_file)
59                 elif output_type == 'server-header'
60                         output_file = '@0@-server-protocol.h'.format(base_file)
61                 else
62                         output_file = '@0@-protocol.c'.format(base_file)
63                         if dep_scanner.version().version_compare('< 1.14.91')
64                                 output_type = 'code'
65                         endif
66                 endif
67
68                 var_name = output_file.underscorify()
69                 target = custom_target(
70                         '@0@ @1@'.format(base_file, output_type),
71                         command: [ prog_scanner, output_type, '@INPUT@', '@OUTPUT@' ],
72                         input: xml_path,
73                         output: output_file,
74                 )
75                 message('protocol name is ' + var_name)
76                 set_variable(var_name, target)
77         endforeach
78 endforeach
79
80 homescreen_src_headers = [
81   'src/applicationlauncher.h',
82   'src/mastervolume.h',
83   'src/statusbarmodel.h',
84   'src/statusbarserver.h',
85   'src/homescreenhandler.h',
86   'src/shell.h'
87 ]
88
89 moc_files = qt5.compile_moc(headers: homescreen_src_headers,
90                             dependencies: qt5_dep)
91
92 homescreen_src = [
93   'src/shell.cpp',
94   'src/statusbarserver.cpp',
95   'src/statusbarmodel.cpp',
96   'src/applicationlauncher.cpp',
97   'src/mastervolume.cpp',
98   'src/homescreenhandler.cpp',
99   'src/main.cpp',
100   agl_shell_client_protocol_h,
101   agl_shell_protocol_c
102 ]
103
104 executable('homescreen', homescreen_src, resource_files, moc_files,
105             cpp_args: qt_defines,
106             dependencies : homescreen_dep,
107             install: true)