• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
21files_shared_glapi = files(
22  '../entry.c',
23  '../u_current.c',
24  '../u_current.h',
25  'glapi.c',
26  'stub.c',
27  'stub.h',
28  'table.c',
29  'table.h',
30)
31
32shared_glapi_mapi_tmp_h = custom_target(
33  'shared_glapi_mapi_tmp.h',
34  input : [mapi_abi_py, gl_and_es_api_files],
35  output : 'glapi_mapi_tmp.h',
36  command : [prog_python, '@INPUT0@', '--printer', 'shared-glapi', '@INPUT1@'],
37  depend_files : api_xml_files,
38  capture : true,
39)
40
41_glapi_c_args = []
42if with_platform_windows
43  _glapi_c_args += ['-D_GLAPI_DLL_EXPORTS']
44endif
45
46libglapi = shared_library(
47  'glapi',
48  [files_shared_glapi, shared_glapi_mapi_tmp_h],
49  c_args : [
50    _glapi_c_args,
51    c_msvc_compat_args,
52    '-DMAPI_MODE_GLAPI',
53    '-DMAPI_ABI_HEADER="@0@"'.format(shared_glapi_mapi_tmp_h.full_path()),
54    gcc_lto_quirk,
55  ],
56  gnu_symbol_visibility : 'hidden',
57  link_args : [ld_args_gc_sections],
58  include_directories : [inc_src, inc_include, inc_mapi],
59  dependencies : [dep_thread, dep_selinux, idep_mesautil],
60  soversion : host_machine.system() == 'windows' ? '' : '0',
61  version : '0.0.0',
62  name_prefix : host_machine.system() == 'windows' ? 'lib' : [],  # always use lib, but avoid warnings on !windows
63  install : true,
64)
65libglapi_build_dir = meson.current_build_dir()
66
67if with_any_opengl and with_tests
68  test(
69    'shared-glapi-test',
70    executable(
71      ['shared-glapi-test', glapitable_h],
72      'tests/check_table.cpp',
73      cpp_args : [cpp_msvc_compat_args],
74      include_directories : [inc_src, inc_include, inc_mapi],
75      link_with : [libglapi],
76      dependencies : [dep_thread, idep_gtest, idep_mesautilc11],
77    ),
78    suite : ['mapi'],
79    protocol : 'gtest',
80  )
81  if with_symbols_check
82    test(
83      'shared-glapi symbols check',
84      symbols_check,
85      args : [
86        '--lib', libglapi,
87        '--symbols-file', files('glapi-symbols.txt'),
88        symbols_check_args,
89      ],
90      suite : ['mapi'],
91    )
92  endif
93endif
94