diff --git a/src/egl/meson.build b/src/egl/meson.build index f7689c4aafe..b6c803a85c4 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -205,7 +205,7 @@ libegl = shared_library( cpp_args : [cpp_args_for_egl], gnu_symbol_visibility : 'hidden', include_directories : incs_for_egl, - link_with : [link_for_egl, libglapi], + link_with : [link_for_egl], link_args : [ld_args_bsymbolic, ld_args_gc_sections, link_args_for_egl], link_depends : [link_deps_for_egl], dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread, idep_mesautil], diff --git a/src/gallium/targets/dri/dri.sym.in b/src/gallium/targets/dri/dri.sym.in index bf8fdec956e..ec5b7974f77 100644 --- a/src/gallium/targets/dri/dri.sym.in +++ b/src/gallium/targets/dri/dri.sym.in @@ -1,5 +1,16 @@ { global: + # shared-glapi exported from libgallium: + _glapi_get_context; + _glapi_get_dispatch; + _glapi_get_dispatch_table_size; + _glapi_get_proc_address; + _glapi_get_proc_offset; + _glapi_set_context; + _glapi_set_dispatch; + _glapi_tls_Context; + _glapi_tls_Dispatch; + ddebug_screen_create; noop_screen_create; util_run_tests; diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build index b6b0421fee0..5ecdc7be6e7 100644 --- a/src/gallium/targets/dri/meson.build +++ b/src/gallium/targets/dri/meson.build @@ -68,6 +68,8 @@ libgallium_dri = shared_library( name_suffix : libname_suffix, ) +shared_glapi_lib = libgallium_dri + if with_gallium_va or with_gallium_vdpau va_drivers = [] vdpau_drivers = [] diff --git a/src/gallium/targets/libgl-xlib/libgl-xlib.sym b/src/gallium/targets/libgl-xlib/libgl-xlib.sym index d6cd23dbffe..046eeb4d1c4 100644 --- a/src/gallium/targets/libgl-xlib/libgl-xlib.sym +++ b/src/gallium/targets/libgl-xlib/libgl-xlib.sym @@ -1,5 +1,9 @@ { global: + _glapi_Dispatch; + _glapi_tls_Dispatch; + _glapi_get_dispatch_table_size; # only for tests + _glapi_get_proc_offset; # only for tests gl*; local: *; diff --git a/src/gallium/targets/libgl-xlib/meson.build b/src/gallium/targets/libgl-xlib/meson.build index 9dcb0f1eb30..a8fbae7bf1c 100644 --- a/src/gallium/targets/libgl-xlib/meson.build +++ b/src/gallium/targets/libgl-xlib/meson.build @@ -37,3 +37,5 @@ libgl = shared_library( version : '1.5.0', darwin_versions: '4.0.0', ) + +shared_glapi_lib = libgl diff --git a/src/gallium/targets/wgl/meson.build b/src/gallium/targets/wgl/meson.build index 15092916769..ec0d7bbcd82 100644 --- a/src/gallium/targets/wgl/meson.build +++ b/src/gallium/targets/wgl/meson.build @@ -31,3 +31,5 @@ libgallium_wgl = shared_library( install : true, ) libgallium_wgl_build_dir = meson.current_build_dir() + +shared_glapi_lib = libgallium_wgl diff --git a/src/glx/meson.build b/src/glx/meson.build index 6057aefaf96..b52b91c5269 100644 --- a/src/glx/meson.build +++ b/src/glx/meson.build @@ -133,7 +133,7 @@ libglx = static_library( libgl = shared_library( gl_lib_name, [], - link_with : [libglapi_static, libglapi], + link_with : [libglapi_static], link_whole : libglx, link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl], dependencies : [ diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build index 2d7e26fdafe..8a7c57e03d9 100644 --- a/src/mapi/es1api/meson.build +++ b/src/mapi/es1api/meson.build @@ -36,7 +36,7 @@ libglesv1_cm = shared_library( gnu_symbol_visibility : 'hidden', link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], - link_with : libglapi, + link_with : shared_glapi_lib, dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl, idep_mesautilc11], soversion : host_machine.system() == 'windows' ? '' : '1', version : '1.1.0', diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build index a29d1a12014..afc5b95c856 100644 --- a/src/mapi/es2api/meson.build +++ b/src/mapi/es2api/meson.build @@ -36,7 +36,7 @@ libgles2 = shared_library( gnu_symbol_visibility : 'hidden', link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], - link_with : libglapi, + link_with : shared_glapi_lib, dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl, idep_mesautilc11], soversion : host_machine.system() == 'windows' ? '' : '2', version : '2.0.0', diff --git a/src/mapi/meson.build b/src/mapi/meson.build index 4aefd36e4cf..d9d4674d1c1 100644 --- a/src/mapi/meson.build +++ b/src/mapi/meson.build @@ -11,11 +11,3 @@ if with_shared_glapi else libglapi = [] endif -if not with_glvnd - if with_gles1 - subdir('es1api') - endif - if with_gles2 - subdir('es2api') - endif -endif diff --git a/src/mapi/shared-glapi/glapi-symbols.txt b/src/mapi/shared-glapi/glapi-symbols.txt deleted file mode 100644 index 43d87af2b1e..00000000000 --- a/src/mapi/shared-glapi/glapi-symbols.txt +++ /dev/null @@ -1,20 +0,0 @@ -_glapi_Context -_glapi_Dispatch -_glapi_add_dispatch -_glapi_check_multithread -_glapi_destroy_multithread -_glapi_get_context -_glapi_get_dispatch -_glapi_get_dispatch_table_size -_glapi_get_proc_address -_glapi_get_proc_name -_glapi_get_proc_offset -_glapi_new_nop_table -_glapi_noop_enable_warnings -_glapi_set_context -_glapi_set_dispatch -_glapi_set_nop_handler -_glapi_set_warning_func -(optional) _glapi_tls_Context -(optional) _glapi_tls_Dispatch -_glthread_GetID diff --git a/src/mapi/shared-glapi/meson.build b/src/mapi/shared-glapi/meson.build index e9e7366568a..dc7be9cdc07 100644 --- a/src/mapi/shared-glapi/meson.build +++ b/src/mapi/shared-glapi/meson.build @@ -26,7 +26,7 @@ if with_platform_windows _glapi_c_args += ['-D_GLAPI_DLL_EXPORTS'] endif -libglapi = shared_library( +libglapi = static_library( 'glapi', [files_shared_glapi, shared_glapi_mapi_tmp_h], c_args : [ @@ -40,37 +40,6 @@ libglapi = shared_library( link_args : [ld_args_gc_sections], include_directories : [inc_src, inc_include, inc_mapi], dependencies : [dep_thread, idep_mesautil], - soversion : host_machine.system() == 'windows' ? '' : '0', - version : '0.0.0', - name_prefix : host_machine.system() == 'windows' ? 'lib' : [], # always use lib, but avoid warnings on !windows - install : true, + install : false, ) libglapi_build_dir = meson.current_build_dir() - -if with_any_opengl and with_tests - test( - 'shared-glapi-test', - executable( - ['shared-glapi-test', glapitable_h], - 'tests/check_table.cpp', - cpp_args : [cpp_msvc_compat_args], - include_directories : [inc_src, inc_include, inc_mapi], - link_with : [libglapi], - dependencies : [dep_thread, idep_gtest, idep_mesautilc11], - ), - suite : ['mapi'], - protocol : 'gtest', - ) - if with_symbols_check - test( - 'shared-glapi symbols check', - symbols_check, - args : [ - '--lib', libglapi, - '--symbols-file', files('glapi-symbols.txt'), - symbols_check_args, - ], - suite : ['mapi'], - ) - endif -endif diff --git a/src/mapi/shared-glapi/tests/meson.build b/src/mapi/shared-glapi/tests/meson.build new file mode 100644 index 00000000000..e454035b44d --- /dev/null +++ b/src/mapi/shared-glapi/tests/meson.build @@ -0,0 +1,18 @@ +# Copyright © 2017 Intel Corporation +# SPDX-License-Identifier: MIT + +if with_any_opengl and with_tests + test( + 'shared-glapi-test', + executable( + ['shared-glapi-test', glapitable_h], + 'check_table.cpp', + cpp_args : [cpp_msvc_compat_args], + include_directories : [inc_src, inc_include, inc_mapi], + link_with : [shared_glapi_lib], + dependencies : [dep_thread, idep_gtest, idep_mesautilc11], + ), + suite : ['mapi'], + protocol : 'gtest', + ) +endif diff --git a/src/mesa/meson.build b/src/mesa/meson.build index ac6f214fa19..fed6557c810 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -446,12 +446,9 @@ endif _mesa_windows_args = [] if with_platform_windows _mesa_windows_args += [ + '-D_GLAPI_NO_EXPORTS', '-D_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers ] - if not with_shared_glapi - # prevent _glapi_* from being declared __declspec(dllimport) - _mesa_windows_args += '-D_GLAPI_NO_EXPORTS' - endif endif libmesa = static_library( diff --git a/src/mesa/state_tracker/tests/meson.build b/src/mesa/state_tracker/tests/meson.build index 4225bc11884..34fa40df0c4 100644 --- a/src/mesa/state_tracker/tests/meson.build +++ b/src/mesa/state_tracker/tests/meson.build @@ -8,7 +8,7 @@ test( ['st_format.c'], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], link_with : [ - libmesa, libglapi, libgallium, + libmesa, shared_glapi_lib, libgallium, ], dependencies : [idep_gtest, idep_mesautil], ), diff --git a/src/meson.build b/src/meson.build index 442583eba09..80486ba3cca 100644 --- a/src/meson.build +++ b/src/meson.build @@ -111,11 +111,17 @@ endif if with_gallium_or_lvp subdir('gallium') endif -if with_gallium and with_tests - # This has to be here since it requires libgallium, and subdir cannot - # contain .. - subdir('mesa/main/tests') - if with_shared_glapi +# These require libgallium (shared_glapi_lib) +if with_gallium and (with_glx != 'disabled' or with_egl) + if with_gles1 and not with_glvnd + subdir('mapi/es1api') + endif + if with_gles2 and not with_glvnd + subdir('mapi/es2api') + endif + if with_tests and with_shared_glapi + subdir('mapi/shared-glapi/tests') + subdir('mesa/main/tests') subdir('mesa/state_tracker/tests') endif endif