xref: /aosp_15_r20/external/mesa3d/src/compiler/glsl/glcpp/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4bison_command = []
5if yacc_is_bison
6  bison_command = [
7    prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
8    '--defines=@OUTPUT1@', '@INPUT@',
9  ]
10else
11  bison_command = [
12    prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
13    '-H', '@OUTPUT1@', '@INPUT@',
14  ]
15endif
16
17glcpp_parse = custom_target(
18  'glcpp-parse.[ch]',
19  input : 'glcpp-parse.y',
20  output : ['glcpp-parse.c', 'glcpp-parse.h'],
21  command : bison_command
22)
23
24glcpp_lex = custom_target(
25  'glcpp-lex.c',
26  input : 'glcpp-lex.l',
27  output : 'glcpp-lex.c',
28  command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
29)
30
31libglcpp = static_library(
32  'glcpp',
33  [glcpp_lex, glcpp_parse, files('glcpp.h', 'pp.c')],
34  dependencies : idep_mesautil,
35  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
36  c_args : [no_override_init_args, c_msvc_compat_args],
37  cpp_args : [cpp_msvc_compat_args],
38  gnu_symbol_visibility : 'hidden',
39  build_by_default : false,
40)
41
42libglcpp_standalone = static_library(
43  'glcpp_standalone',
44  'pp_standalone_scaffolding.c',
45  link_with : libglcpp,
46  dependencies : idep_mesautil,
47  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
48  c_args : [no_override_init_args, c_msvc_compat_args],
49  cpp_args : [cpp_msvc_compat_args],
50  gnu_symbol_visibility : 'hidden',
51  build_by_default : false,
52)
53
54glcpp = executable(
55  'glcpp',
56  'glcpp.c',
57  dependencies : [dep_m, idep_getopt, idep_mesautil],
58  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
59  link_with : [libglcpp_standalone, libglsl_util],
60  c_args : [no_override_init_args, c_msvc_compat_args],
61  gnu_symbol_visibility : 'hidden',
62  build_by_default : false,
63)
64
65# Meson can't auto-skip these on cross builds because of the python wrapper
66if with_any_opengl and with_tests and meson.can_run_host_binaries() and \
67   with_glcpp_tests
68  modes = ['unix', 'windows', 'oldmac', 'bizarro']
69
70  foreach m : modes
71    test(
72      'glcpp test (@0@)'.format(m),
73      prog_python,
74      args : [
75        files('tests/glcpp_test.py'),
76        glcpp, join_paths(meson.current_source_dir(), 'tests'),
77        '--@0@'.format(m),
78      ],
79      suite : ['compiler', 'glcpp'],
80      timeout: 60,
81    )
82  endforeach
83endif
84