1# Copyright © 2017-2018 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21gen_knobs_cpp = custom_target(
22  'gen_knobs.cpp',
23  input : ['gen_knobs.py'],
24  output : 'gen_knobs.cpp',
25  command : [prog_python, '@INPUT0@', '--output', '@OUTPUT@', '--gen_cpp'],
26  depend_files : files(
27    'knob_defs.py', 'gen_common.py',
28    'templates/gen_knobs.cpp',
29  ),
30)
31
32gen_knobs_h = custom_target(
33  'gen_knobs.h',
34  input : ['gen_knobs.py'],
35  output : 'gen_knobs.h',
36  command : [prog_python, '@INPUT0@', '--output', '@OUTPUT@', '--gen_h'],
37  depend_files : files(
38    'knob_defs.py', 'gen_common.py',
39    'templates/gen_knobs.h',
40  ),
41)
42
43
44# The generators above this are needed individually, while the below generators
45# are all inputs to the same lib, so they don't need unique names.
46files_swr_common += [
47  gen_builder_hpp, gen_builder_meta_hpp, gen_knobs_h, gen_knobs_cpp
48]
49
50foreach x : [[swr_context_files, 'gen_swr_context_llvm.h'],
51             [swr_state_files, 'gen_state_llvm.h'],
52             [swr_surf_state_files, 'gen_surf_state_llvm.h']]
53  files_swr_common += custom_target(
54    x[1],
55    input : ['gen_llvm_types.py', x[0]],
56    output : x[1],
57    command : [prog_python, '@INPUT0@', '--input', '@INPUT1@', '--output', '@OUTPUT@'],
58    depend_files : files(
59      'templates/gen_llvm.hpp',
60      'gen_common.py',
61    ),
62  )
63endforeach
64
65ar_output_filenames = ['gen_ar_event.hpp', 'gen_ar_event.cpp', 'gen_ar_eventhandler.hpp', 'gen_ar_eventhandlerfile.hpp']
66ar_template_filenames = []
67foreach fname : ar_output_filenames
68    ar_template_filenames += join_paths('templates', fname)
69endforeach
70
71files_swr_common += custom_target(
72    'gen_archrast',
73    input : ['gen_archrast.py', swr_event_proto_files, swr_event_pproto_files],
74    output : ar_output_filenames,
75    command : [prog_python, '@INPUT0@', '--proto', '@INPUT1@', '@INPUT2@', '--output-dir', meson.current_build_dir()],
76    depend_files : files('gen_common.py', ar_template_filenames)
77)
78