xref: /aosp_15_r20/external/mesa3d/src/mapi/shared-glapi/meson.build (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1# Copyright © 2017 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4files_shared_glapi = files(
5  '../entry.c',
6  '../u_current.c',
7  '../u_current.h',
8  'glapi.c',
9  'stub.c',
10  'stub.h',
11  'table.c',
12  'table.h',
13)
14
15shared_glapi_mapi_tmp_h = custom_target(
16  'shared_glapi_mapi_tmp.h',
17  input : [mapi_abi_py, gl_and_es_api_files],
18  output : 'glapi_mapi_tmp.h',
19  command : [prog_python, '@INPUT0@', '--printer', 'shared-glapi', '@INPUT1@'],
20  depend_files : api_xml_files,
21  capture : true,
22)
23
24_glapi_c_args = []
25if with_platform_windows
26  _glapi_c_args += ['-D_GLAPI_DLL_EXPORTS']
27endif
28
29libglapi = shared_library(
30  'glapi',
31  [files_shared_glapi, shared_glapi_mapi_tmp_h],
32  c_args : [
33    _glapi_c_args,
34    c_msvc_compat_args,
35    '-DMAPI_MODE_GLAPI',
36    '-DMAPI_ABI_HEADER="@0@"'.format(shared_glapi_mapi_tmp_h.full_path()),
37    gcc_lto_quirk,
38  ],
39  gnu_symbol_visibility : 'hidden',
40  link_args : [ld_args_gc_sections],
41  include_directories : [inc_src, inc_include, inc_mapi],
42  dependencies : [dep_thread, dep_selinux, idep_mesautil],
43  soversion : host_machine.system() == 'windows' ? '' : '0',
44  version : '0.0.0',
45  name_prefix : host_machine.system() == 'windows' ? 'lib' : [],  # always use lib, but avoid warnings on !windows
46  install : true,
47)
48libglapi_build_dir = meson.current_build_dir()
49
50if with_any_opengl and with_tests
51  test(
52    'shared-glapi-test',
53    executable(
54      ['shared-glapi-test', glapitable_h],
55      'tests/check_table.cpp',
56      cpp_args : [cpp_msvc_compat_args],
57      include_directories : [inc_src, inc_include, inc_mapi],
58      link_with : [libglapi],
59      dependencies : [dep_thread, idep_gtest, idep_mesautilc11],
60    ),
61    suite : ['mapi'],
62    protocol : 'gtest',
63  )
64  if with_symbols_check
65    test(
66      'shared-glapi symbols check',
67      symbols_check,
68      args : [
69        '--lib', libglapi,
70        '--symbols-file', files('glapi-symbols.txt'),
71        symbols_check_args,
72      ],
73      suite : ['mapi'],
74    )
75  endif
76endif
77