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 21subdir('gen') 22 23inc_glapi = include_directories('.') 24 25static_glapi_files = [] 26static_glapi_args = [] 27 28if with_dri and ['apple', 'windows'].contains(with_dri_platform) 29 static_glapi_files += [glapi_gentable_c, glapitable_h] 30endif 31 32bridge_glapi_files = static_glapi_files 33bridge_glapi_args = static_glapi_args 34 35bridge_glapi_files += files( 36 '../entry.c', 37 '../entry.h', 38 '../entry_x86-64_tls.h', 39 '../entry_x86_tls.h', 40 '../entry_ppc64le_tls.h', 41 '../mapi_tmp.h', 42) 43bridge_glapi_files += glapi_mapi_tmp_h 44bridge_glapi_args += [ 45 '-DMAPI_MODE_BRIDGE', 46 '-DMAPI_ABI_HEADER="@0@"'.format(glapi_mapi_tmp_h.full_path()), 47 gcc_lto_quirk, 48] 49if with_platform_windows 50 bridge_glapi_args += ['-D_GDI32_'] 51endif 52 53static_glapi_args += '-DMAPI_MODE_UTIL' 54if with_platform_windows 55 static_glapi_args += ['-D_GDI32_', '-DKHRONOS_DLL_EXPORTS', '-D_GLAPI_DLL_EXPORTS'] 56endif 57static_glapi_files += files( 58 'glapi_dispatch.c', 59 'glapi_entrypoint.c', 60 'glapi_getproc.c', 61 'glapi_nop.c', 62 'glapi.c', 63 'glapi.h', 64 'glapi_priv.h', 65) 66static_glapi_files += files_mapi_util 67static_glapi_files += [ 68 glapitable_h, glapi_mapi_tmp_h, glprocs_h, glapitemp_h, 69] 70if with_asm_arch == 'x86' 71 static_glapi_files += glapi_x86_s 72elif with_asm_arch == 'x86_64' 73 static_glapi_files += glapi_x86_64_s 74elif with_asm_arch == 'sparc' 75 static_glapi_files += glapi_sparc_s 76endif 77 78 79libglapi_bridge = static_library( 80 'glapi_bridge', 81 bridge_glapi_files, 82 include_directories : [inc_mesa, inc_include, inc_src, inc_mapi], 83 c_args : [c_msvc_compat_args, bridge_glapi_args], 84 dependencies : [dep_thread, dep_selinux, idep_mesautilc11], 85 build_by_default : false, 86) 87 88if with_shared_glapi 89 libglapi_static = libglapi_bridge 90else 91 libglapi_static = static_library( 92 'glapi_static', 93 static_glapi_files, 94 include_directories : [inc_mesa, inc_include, inc_src, inc_mapi], 95 c_args : [c_msvc_compat_args, static_glapi_args], 96 dependencies : [dep_thread, dep_selinux, idep_mesautilc11], 97 build_by_default : false, 98 ) 99endif 100 101# TODO: this test doesn't compile on windows with mingw or msvc due to 102# undefined symbols from libglapi_static, but that should be fixable. 103if with_any_opengl and not with_shared_glapi and with_tests and not with_platform_windows 104 test( 105 'glapi_static_check_table', 106 executable( 107 'glapi_static_check_table', 108 ['tests/check_table.cpp', glapitable_h], 109 include_directories : [inc_include, inc_src, inc_mesa, inc_mapi], 110 link_with : [libglapi_static], 111 dependencies : [idep_gtest, dep_thread], 112 ), 113 suite : ['mapi'], 114 protocol : gtest_test_protocol, 115 ) 116endif 117