1bf215546Sopenharmony_ci# Copyright © 2017 Intel Corporation 2bf215546Sopenharmony_ci 3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy 4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal 5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights 6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is 8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions: 9bf215546Sopenharmony_ci 10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in 11bf215546Sopenharmony_ci# all copies or substantial portions of the Software. 12bf215546Sopenharmony_ci 13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19bf215546Sopenharmony_ci# SOFTWARE. 20bf215546Sopenharmony_ci 21bf215546Sopenharmony_cifiles_mapi_glapi = files( 22bf215546Sopenharmony_ci '../entry.c', 23bf215546Sopenharmony_ci '../mapi_glapi.c', 24bf215546Sopenharmony_ci '../stub.c', 25bf215546Sopenharmony_ci '../stub.h', 26bf215546Sopenharmony_ci '../table.c', 27bf215546Sopenharmony_ci '../table.h', 28bf215546Sopenharmony_ci) 29bf215546Sopenharmony_ci 30bf215546Sopenharmony_cishared_glapi_mapi_tmp_h = custom_target( 31bf215546Sopenharmony_ci 'shared_glapi_mapi_tmp.h', 32bf215546Sopenharmony_ci input : [mapi_abi_py, gl_and_es_api_files], 33bf215546Sopenharmony_ci output : 'glapi_mapi_tmp.h', 34bf215546Sopenharmony_ci command : [prog_python, '@INPUT0@', '--printer', 'shared-glapi', '@INPUT1@'], 35bf215546Sopenharmony_ci depend_files : api_xml_files, 36bf215546Sopenharmony_ci capture : true, 37bf215546Sopenharmony_ci) 38bf215546Sopenharmony_ci 39bf215546Sopenharmony_ci_glapi_c_args = [] 40bf215546Sopenharmony_ciif with_platform_windows 41bf215546Sopenharmony_ci _glapi_c_args += ['-D_GLAPI_DLL_EXPORTS'] 42bf215546Sopenharmony_ciendif 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_cilibglapi = shared_library( 45bf215546Sopenharmony_ci 'glapi', 46bf215546Sopenharmony_ci [files_mapi_glapi, files_mapi_util, shared_glapi_mapi_tmp_h], 47bf215546Sopenharmony_ci c_args : [ 48bf215546Sopenharmony_ci _glapi_c_args, 49bf215546Sopenharmony_ci c_msvc_compat_args, 50bf215546Sopenharmony_ci '-DMAPI_MODE_GLAPI', 51bf215546Sopenharmony_ci '-DMAPI_ABI_HEADER="@0@"'.format(shared_glapi_mapi_tmp_h.full_path()), 52bf215546Sopenharmony_ci gcc_lto_quirk, 53bf215546Sopenharmony_ci ], 54bf215546Sopenharmony_ci gnu_symbol_visibility : 'hidden', 55bf215546Sopenharmony_ci link_args : [ld_args_gc_sections], 56bf215546Sopenharmony_ci include_directories : [inc_src, inc_include, inc_mapi], 57bf215546Sopenharmony_ci dependencies : [dep_thread, dep_selinux, idep_mesautilc11], 58bf215546Sopenharmony_ci soversion : host_machine.system() == 'windows' ? '' : '0', 59bf215546Sopenharmony_ci version : '0.0.0', 60bf215546Sopenharmony_ci name_prefix : 'lib', 61bf215546Sopenharmony_ci install : true, 62bf215546Sopenharmony_ci) 63bf215546Sopenharmony_cilibglapi_build_dir = meson.current_build_dir() 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ciif with_any_opengl and with_tests 66bf215546Sopenharmony_ci test( 67bf215546Sopenharmony_ci 'shared-glapi-test', 68bf215546Sopenharmony_ci executable( 69bf215546Sopenharmony_ci ['shared-glapi-test', glapitable_h], 70bf215546Sopenharmony_ci 'tests/check_table.cpp', 71bf215546Sopenharmony_ci cpp_args : [cpp_msvc_compat_args], 72bf215546Sopenharmony_ci include_directories : [inc_src, inc_include, inc_mapi], 73bf215546Sopenharmony_ci link_with : [libglapi], 74bf215546Sopenharmony_ci dependencies : [dep_thread, idep_gtest, idep_mesautilc11], 75bf215546Sopenharmony_ci ), 76bf215546Sopenharmony_ci suite : ['mapi'], 77bf215546Sopenharmony_ci protocol : gtest_test_protocol, 78bf215546Sopenharmony_ci ) 79bf215546Sopenharmony_ci if with_symbols_check 80bf215546Sopenharmony_ci test( 81bf215546Sopenharmony_ci 'shared-glapi symbols check', 82bf215546Sopenharmony_ci symbols_check, 83bf215546Sopenharmony_ci args : [ 84bf215546Sopenharmony_ci '--lib', libglapi, 85bf215546Sopenharmony_ci '--symbols-file', files('glapi-symbols.txt'), 86bf215546Sopenharmony_ci symbols_check_args, 87bf215546Sopenharmony_ci ], 88bf215546Sopenharmony_ci suite : ['mapi'], 89bf215546Sopenharmony_ci ) 90bf215546Sopenharmony_ci endif 91bf215546Sopenharmony_ciendif 92