meson: replace libmesa_util with idep_mesautil
[mesa.git] / src / compiler / glsl / glcpp / meson.build
1 # Copyright © 2017 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
21 glcpp_parse = custom_target(
22 'glcpp-parse.[ch]',
23 input : 'glcpp-parse.y',
24 output : ['glcpp-parse.c', 'glcpp-parse.h'],
25 command : [
26 prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
27 '--defines=@OUTPUT1@', '@INPUT@',
28 ],
29 )
30
31 glcpp_lex = custom_target(
32 'glcpp-lex.c',
33 input : 'glcpp-lex.l',
34 output : 'glcpp-lex.c',
35 command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
36 )
37
38 libglcpp = static_library(
39 'glcpp',
40 [glcpp_lex, glcpp_parse, files('glcpp.h', 'pp.c')],
41 dependencies : idep_mesautil,
42 include_directories : [inc_common],
43 c_args : [c_vis_args, no_override_init_args, c_msvc_compat_args],
44 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
45 build_by_default : false,
46 )
47
48 glcpp = executable(
49 'glcpp',
50 'glcpp.c',
51 dependencies : [dep_m],
52 include_directories : [inc_common],
53 link_with : [libglcpp, libglsl_util],
54 c_args : [c_vis_args, no_override_init_args, c_msvc_compat_args],
55 build_by_default : false,
56 )
57
58 if with_any_opengl and with_tests
59 modes = ['unix', 'windows', 'oldmac', 'bizarro']
60 if dep_valgrind.found()
61 modes += ['valgrind']
62 endif
63
64 foreach m : modes
65 test(
66 'glcpp test (@0@)'.format(m),
67 prog_python,
68 args : [
69 join_paths(meson.current_source_dir(), 'tests/glcpp_test.py'),
70 glcpp, join_paths(meson.current_source_dir(), 'tests'),
71 '--@0@'.format(m),
72 ],
73 suite : ['compiler', 'glcpp'],
74 )
75 endforeach
76 endif