101e04c3fSmrg# Copyright © 2017 Intel Corporation 201e04c3fSmrg 301e04c3fSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy 401e04c3fSmrg# of this software and associated documentation files (the "Software"), to deal 501e04c3fSmrg# in the Software without restriction, including without limitation the rights 601e04c3fSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 701e04c3fSmrg# copies of the Software, and to permit persons to whom the Software is 801e04c3fSmrg# furnished to do so, subject to the following conditions: 901e04c3fSmrg 1001e04c3fSmrg# The above copyright notice and this permission notice shall be included in 1101e04c3fSmrg# all copies or substantial portions of the Software. 1201e04c3fSmrg 1301e04c3fSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1401e04c3fSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1501e04c3fSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 1601e04c3fSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1701e04c3fSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 1801e04c3fSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 1901e04c3fSmrg# SOFTWARE. 2001e04c3fSmrg 217ec681f3Smrgbison_command = [] 227ec681f3Smrgif yacc_is_bison 237ec681f3Smrg bison_command = [ 247ec681f3Smrg prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_', 257ec681f3Smrg '--defines=@OUTPUT1@', '@INPUT@', 267ec681f3Smrg ] 277ec681f3Smrgelse 287ec681f3Smrg bison_command = [ 297ec681f3Smrg prog_bison, '-o', '@OUTPUT0@', '-p', 'glcpp_parser_', 307ec681f3Smrg '-H', '@OUTPUT1@', '@INPUT@', 317ec681f3Smrg ] 327ec681f3Smrgendif 337ec681f3Smrg 3401e04c3fSmrgglcpp_parse = custom_target( 3501e04c3fSmrg 'glcpp-parse.[ch]', 3601e04c3fSmrg input : 'glcpp-parse.y', 3701e04c3fSmrg output : ['glcpp-parse.c', 'glcpp-parse.h'], 387ec681f3Smrg command : bison_command 3901e04c3fSmrg) 4001e04c3fSmrg 4101e04c3fSmrgglcpp_lex = custom_target( 4201e04c3fSmrg 'glcpp-lex.c', 4301e04c3fSmrg input : 'glcpp-lex.l', 4401e04c3fSmrg output : 'glcpp-lex.c', 4501e04c3fSmrg command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'], 4601e04c3fSmrg) 4701e04c3fSmrg 487ec681f3Smrg_extra_args = [] 497ec681f3Smrgif cpp.get_id() == 'msvc' 507ec681f3Smrg # Flex relies on __STDC_VERSION__>=199901L to decide when to include C99 517ec681f3Smrg # inttypes.h. We always have inttypes.h available with MSVC (either the one 527ec681f3Smrg # bundled with MSVC 2013, or the one we bundle ourselves), but we can't just 537ec681f3Smrg # define __STDC_VERSION__ without breaking stuff, as MSVC doesn't fully 547ec681f3Smrg # support C99. There's also no way to premptively include stdint. 557ec681f3Smrg _extra_args += '-FIinttypes.h' 567ec681f3Smrgendif 577ec681f3Smrg 5801e04c3fSmrglibglcpp = static_library( 5901e04c3fSmrg 'glcpp', 6001e04c3fSmrg [glcpp_lex, glcpp_parse, files('glcpp.h', 'pp.c')], 617ec681f3Smrg dependencies : idep_mesautil, 627ec681f3Smrg include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 637ec681f3Smrg c_args : [no_override_init_args, c_msvc_compat_args, _extra_args], 647ec681f3Smrg cpp_args : [cpp_msvc_compat_args, _extra_args], 657ec681f3Smrg gnu_symbol_visibility : 'hidden', 667ec681f3Smrg build_by_default : false, 677ec681f3Smrg) 687ec681f3Smrg 697ec681f3Smrglibglcpp_standalone = static_library( 707ec681f3Smrg 'glcpp_standalone', 717ec681f3Smrg 'pp_standalone_scaffolding.c', 727ec681f3Smrg link_with : libglcpp, 737ec681f3Smrg dependencies : idep_mesautil, 747ec681f3Smrg include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 757ec681f3Smrg c_args : [no_override_init_args, c_msvc_compat_args, _extra_args], 767ec681f3Smrg cpp_args : [cpp_msvc_compat_args, _extra_args], 777ec681f3Smrg gnu_symbol_visibility : 'hidden', 7801e04c3fSmrg build_by_default : false, 7901e04c3fSmrg) 8001e04c3fSmrg 8101e04c3fSmrgglcpp = executable( 8201e04c3fSmrg 'glcpp', 8301e04c3fSmrg 'glcpp.c', 847ec681f3Smrg dependencies : [dep_m, idep_getopt, idep_mesautil], 857ec681f3Smrg include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 867ec681f3Smrg link_with : [libglcpp_standalone, libglsl_util], 877ec681f3Smrg c_args : [no_override_init_args, c_msvc_compat_args], 887ec681f3Smrg gnu_symbol_visibility : 'hidden', 8901e04c3fSmrg build_by_default : false, 9001e04c3fSmrg) 9101e04c3fSmrg 927ec681f3Smrg# Meson can't auto-skip these on cross builds because of the python wrapper 937ec681f3Smrg# 947ec681f3Smrg# TODO: has_exe_wrapper() is deprecated and renamed to can_run_host_binaries() 957ec681f3Smrg# starting with Meson 0.55.0 967ec681f3Smrg# 977ec681f3Smrg# FIXME: these fail on windows due to whitespace differences 987ec681f3Smrgif with_any_opengl and with_tests and meson.has_exe_wrapper() and \ 997ec681f3Smrg host_machine.system() != 'windows' 10001e04c3fSmrg modes = ['unix', 'windows', 'oldmac', 'bizarro'] 10101e04c3fSmrg 10201e04c3fSmrg foreach m : modes 10301e04c3fSmrg test( 10401e04c3fSmrg 'glcpp test (@0@)'.format(m), 10501e04c3fSmrg prog_python, 10601e04c3fSmrg args : [ 10701e04c3fSmrg join_paths(meson.current_source_dir(), 'tests/glcpp_test.py'), 10801e04c3fSmrg glcpp, join_paths(meson.current_source_dir(), 'tests'), 10901e04c3fSmrg '--@0@'.format(m), 11001e04c3fSmrg ], 1117e102996Smaya suite : ['compiler', 'glcpp'], 1127ec681f3Smrg timeout: 60, 11301e04c3fSmrg ) 11401e04c3fSmrg endforeach 1157ec681f3Smrg 1167ec681f3Smrg if dep_valgrind.found() 1177ec681f3Smrg test( 1187ec681f3Smrg 'glcpp test (valgrind)', 1197ec681f3Smrg prog_python, 1207ec681f3Smrg args : [ 1217ec681f3Smrg join_paths(meson.current_source_dir(), 'tests/glcpp_test.py'), 1227ec681f3Smrg glcpp, join_paths(meson.current_source_dir(), 'tests'), 1237ec681f3Smrg '--valgrind', 1247ec681f3Smrg ], 1257ec681f3Smrg suite : ['compiler', 'glcpp'], 1267ec681f3Smrg timeout: 240, 1277ec681f3Smrg ) 1287ec681f3Smrg endif 12901e04c3fSmrgendif 130