1# Copyright © 2017 Intel Corporation 2# SPDX-License-Identifier: MIT 3 4subdir('gen') 5 6inc_glapi = include_directories('.') 7 8static_glapi_files = [] 9static_glapi_args = [] 10 11if with_dri and ['apple', 'windows'].contains(with_dri_platform) 12 static_glapi_files += [glapi_gentable_c, glapitable_h] 13endif 14 15bridge_glapi_files = static_glapi_files 16bridge_glapi_args = static_glapi_args 17 18bridge_glapi_files += files( 19 '../entry.c', 20 '../entry.h', 21 '../entry_x86-64_tls.h', 22 '../entry_x86_tls.h', 23 '../entry_ppc64le_tls.h', 24 '../mapi_tmp.h', 25) 26bridge_glapi_files += glapi_mapi_tmp_h 27bridge_glapi_args += [ 28 '-DMAPI_MODE_BRIDGE', 29 '-DMAPI_ABI_HEADER="@0@"'.format(glapi_mapi_tmp_h.full_path()), 30 gcc_lto_quirk, 31] 32if with_platform_windows 33 bridge_glapi_args += ['-D_GDI32_'] 34endif 35 36static_glapi_args += '-DMAPI_MODE_UTIL' 37if with_platform_windows 38 static_glapi_args += ['-D_GDI32_', '-DKHRONOS_DLL_EXPORTS', '-D_GLAPI_DLL_EXPORTS'] 39endif 40static_glapi_files += files( 41 '../u_current.c', 42 '../u_current.h', 43 'glapi_dispatch.c', 44 'glapi_entrypoint.c', 45 'glapi_getproc.c', 46 'glapi_nop.c', 47 'glapi.c', 48 'glapi.h', 49 'glapi_priv.h', 50) 51static_glapi_files += [ 52 glapitable_h, glapi_mapi_tmp_h, glprocs_h, glapitemp_h, 53] 54if with_asm_arch == 'x86' 55 static_glapi_files += glapi_x86_s 56elif with_asm_arch == 'x86_64' 57 static_glapi_files += glapi_x86_64_s 58elif with_asm_arch == 'sparc' 59 static_glapi_files += glapi_sparc_s 60endif 61 62 63libglapi_bridge = static_library( 64 'glapi_bridge', 65 bridge_glapi_files, 66 include_directories : [inc_mesa, inc_include, inc_src, inc_mapi, inc_gallium], 67 c_args : [c_msvc_compat_args, bridge_glapi_args], 68 dependencies : [dep_thread, dep_selinux, idep_mesautil], 69 build_by_default : false, 70) 71 72if with_shared_glapi 73 libglapi_static = libglapi_bridge 74else 75 libglapi_static = static_library( 76 'glapi_static', 77 static_glapi_files, 78 include_directories : [inc_mesa, inc_include, inc_src, inc_mapi, inc_gallium], 79 c_args : [c_msvc_compat_args, static_glapi_args], 80 dependencies : [dep_thread, dep_selinux, idep_mesautil], 81 build_by_default : false, 82 ) 83endif 84 85# TODO: this test doesn't compile on windows with mingw or msvc due to 86# undefined symbols from libglapi_static, but that should be fixable. 87if with_any_opengl and not with_shared_glapi and with_tests and not with_platform_windows 88 test( 89 'glapi_static_check_table', 90 executable( 91 'glapi_static_check_table', 92 ['tests/check_table.cpp', glapitable_h], 93 include_directories : [inc_include, inc_src, inc_mesa, inc_mapi, inc_gallium], 94 link_with : [libglapi_static], 95 dependencies : [idep_gtest, dep_thread], 96 ), 97 suite : ['mapi'], 98 protocol : 'gtest', 99 ) 100endif 101