f9b11616ff4152438dc80e8168911a303a76668d
[platform/upstream/gobject-introspection.git] / tools / meson.build
1 libdir_abs = join_paths(get_option('prefix'), get_option('libdir'))
2 datadir_abs = join_paths(get_option('prefix'), get_option('datadir'))
3
4 tools = [
5   ['g-ir-scanner', 'scannermain', 'scanner_main'],
6   ['g-ir-annotation-tool', 'annotationmain', 'annotation_main'],
7 ]
8 if with_doctool
9   tools += [['g-ir-doc-tool', 'docmain', 'doc_main']]
10 endif
11
12 if cc.get_id() == 'msvc'
13   python_cmd = '/usr/bin/env ' + python.get_variable('prefix') + '\\python.exe'
14 else
15   python_cmd = '/usr/bin/env python@0@'.format(python.language_version().split('.')[0])
16 endif
17
18 tool_output = []
19 foreach tool : tools
20   tools_conf = configuration_data()
21   tools_conf.set('libdir', libdir_abs)
22   tools_conf.set('datarootdir', datadir_abs)
23   tools_conf.set('gir_dir_prefix', gir_dir_prefix)
24   tools_conf.set('PYTHON_CMD', python_cmd)
25   tools_conf.set('GIR_DIR', girdir)
26
27   tools_conf.set('TOOL_MODULE', tool[1])
28   tools_conf.set('TOOL_FUNCTION', tool[2])
29   tool_bin = configure_file(
30     input: 'g-ir-tool-template.in',
31     output: tool[0],
32     configuration: tools_conf,
33     install: true,
34     install_dir: get_option('bindir'),
35   )
36   tool_output += tool_bin
37   # Provide tools for others when we're a subproject and they use the Meson GNOME module
38   meson.override_find_program(tool[0], tool_bin)
39 endforeach
40
41 girscanner = tool_output[0]
42 if with_doctool
43   girdoctool = tool_output[-1]
44 endif
45
46 custom_c_args = []
47 if cc.get_id() != 'msvc'
48   custom_c_args = cc.get_supported_arguments(['-Wno-missing-field-initializers'])
49 endif
50
51
52 gircompiler = executable('g-ir-compiler', 'compiler.c',
53   dependencies: [
54     girepo_internals_dep,
55     girepo_dep,
56   ],
57   install: true,
58   c_args: custom_c_args,
59 )
60
61 girgenerate = executable('g-ir-generate', 'generate.c',
62   dependencies: [
63     girepo_internals_dep,
64     girepo_dep,
65   ],
66   install: true,
67   c_args: custom_c_args,
68 )
69
70 girinspect = executable('g-ir-inspect', 'g-ir-inspect.c',
71   dependencies: girepo_dep,
72   install: true,
73   c_args: custom_c_args,
74 )