• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
21bison_command = []
22if yacc_is_bison
23  bison_command = [
24    prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
25    '--defines=@OUTPUT1@', '@INPUT@',
26  ]
27else
28  bison_command = [
29    prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_',
30    '-H', '@OUTPUT1@', '@INPUT@',
31  ]
32endif
33
34glcpp_parse = custom_target(
35  'glcpp-parse.[ch]',
36  input : 'glcpp-parse.y',
37  output : ['glcpp-parse.c', 'glcpp-parse.h'],
38  command : bison_command
39)
40
41glcpp_lex = custom_target(
42  'glcpp-lex.c',
43  input : 'glcpp-lex.l',
44  output : 'glcpp-lex.c',
45  command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
46)
47
48libglcpp = static_library(
49  'glcpp',
50  [glcpp_lex, glcpp_parse, files('glcpp.h', 'pp.c')],
51  dependencies : idep_mesautil,
52  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
53  c_args : [no_override_init_args, c_msvc_compat_args],
54  cpp_args : [cpp_msvc_compat_args],
55  gnu_symbol_visibility : 'hidden',
56  build_by_default : false,
57)
58
59libglcpp_standalone = static_library(
60  'glcpp_standalone',
61  'pp_standalone_scaffolding.c',
62  link_with : libglcpp,
63  dependencies : idep_mesautil,
64  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
65  c_args : [no_override_init_args, c_msvc_compat_args],
66  cpp_args : [cpp_msvc_compat_args],
67  gnu_symbol_visibility : 'hidden',
68  build_by_default : false,
69)
70
71glcpp = executable(
72  'glcpp',
73  'glcpp.c',
74  dependencies : [dep_m, idep_getopt, idep_mesautil],
75  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
76  link_with : [libglcpp_standalone, libglsl_util],
77  c_args : [no_override_init_args, c_msvc_compat_args],
78  gnu_symbol_visibility : 'hidden',
79  build_by_default : false,
80)
81
82# Meson can't auto-skip these on cross builds because of the python wrapper
83#
84# TODO: has_exe_wrapper() is deprecated and renamed to can_run_host_binaries()
85# starting with Meson 0.55.0
86#
87# FIXME: these fail on windows due to whitespace differences
88if with_any_opengl and with_tests and meson.has_exe_wrapper() and \
89   host_machine.system() != 'windows'
90  modes = ['unix', 'windows', 'oldmac', 'bizarro']
91
92  foreach m : modes
93    test(
94      'glcpp test (@0@)'.format(m),
95      prog_python,
96      args : [
97        join_paths(meson.current_source_dir(), 'tests/glcpp_test.py'),
98        glcpp, join_paths(meson.current_source_dir(), 'tests'),
99        '--@0@'.format(m),
100      ],
101      suite : ['compiler', 'glcpp'],
102      timeout: 60,
103    )
104  endforeach
105endif
106