meson: set visibility flag when compiler supports it

Since vtest_server and the tests make use of private interfaces we must
mirror the autotoosl build that keeps the private interfaces in a static
library so that these functions can be called by the test code. The main
library that get installed then uses this static library and adds the
exported interface.

Closes #152

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 5 years ago
parent 1686cf92a7
commit 1e581b6b49
  1. 10
      meson.build
  2. 53
      src/meson.build
  3. 2
      tests/fuzzer/meson.build
  4. 4
      tests/meson.build
  5. 4
      vtest/meson.build

@ -60,6 +60,16 @@ foreach w : warnings
endif endif
endforeach endforeach
flags = [
'-fvisibility=hidden',
]
foreach f : flags
if cc.has_argument(f)
add_project_arguments(f, language : 'c')
endif
endforeach
prog_python = import('python').find_installation('python3') prog_python = import('python').find_installation('python3')
libdrm_dep = dependency('libdrm', version : '>=2.4.50') libdrm_dep = dependency('libdrm', version : '>=2.4.50')

@ -23,12 +23,10 @@
subdir('gallium') subdir('gallium')
virglrenderer_sources = [ virgl_sources = [
'iov.c', 'iov.c',
'virgl_hw.h', 'virgl_hw.h',
'virgl_protocol.h', 'virgl_protocol.h',
'virglrenderer.c',
'virglrenderer.h',
'vrend_blitter.c', 'vrend_blitter.c',
'vrend_blitter.h', 'vrend_blitter.h',
'vrend_debug.c', 'vrend_debug.c',
@ -48,19 +46,25 @@ virglrenderer_sources = [
'vrend_util.h', 'vrend_util.h',
] ]
virglrenderer_egl_sources = [ virglrenderer_sources = [
'virglrenderer.c',
'virglrenderer.h',
]
virgl_egl_sources = [
'virgl_gbm.c', 'virgl_gbm.c',
'virgl_gbm.h', 'virgl_gbm.h',
'virgl_egl_context.c', 'virgl_egl_context.c',
'virgl_egl.h', 'virgl_egl.h',
] ]
virglrenderer_glx_sources = [ virgl_glx_sources = [
'virgl_glx_context.c', 'virgl_glx_context.c',
'virgl_glx.h', 'virgl_glx.h',
] ]
virglrenderer_depends = [ virgl_depends = [
gallium_dep, gallium_dep,
epoxy_dep, epoxy_dep,
libdrm_dep, libdrm_dep,
@ -69,35 +73,48 @@ virglrenderer_depends = [
] ]
if have_egl if have_egl
virglrenderer_sources += virglrenderer_egl_sources virgl_sources += virgl_egl_sources
virglrenderer_depends += [gbm_dep] virgl_depends += [gbm_dep]
endif endif
if have_glx if have_glx
virglrenderer_sources += virglrenderer_glx_sources virgl_sources += virgl_glx_sources
virglrenderer_depends += [glx_dep] virgl_depends += [glx_dep]
endif endif
libvirgl = static_library(
'virgl',
virgl_sources,
include_directories: [inc_gallium, inc_configuration],
dependencies : virgl_depends,
)
libvirgl_inc = [
inc_gallium,
inc_configuration,
include_directories('.')
]
libvirgl_dep = declare_dependency(
link_with: libvirgl,
include_directories: libvirgl_inc
)
libvirglrenderer = shared_library( libvirglrenderer = shared_library(
'virglrenderer', 'virglrenderer',
virglrenderer_sources, virglrenderer_sources,
include_directories: [inc_gallium, inc_configuration], include_directories: [inc_gallium, inc_configuration],
dependencies : virglrenderer_depends, dependencies : [virgl_depends, libvirgl_dep],
version : binary_age.to_string() + '.' version : binary_age.to_string() + '.'
+ interface_age.to_string() + '.' + interface_age.to_string() + '.'
+ revision.to_string(), + revision.to_string(),
install : true install : true
) )
libvirglrenderer_inc = [
inc_gallium,
inc_configuration,
include_directories('.')
]
libvirglrenderer_dep = declare_dependency( libvirglrenderer_dep = declare_dependency(
link_with: libvirglrenderer, link_with: libvirglrenderer,
include_directories: libvirglrenderer_inc include_directories: libvirgl_inc,
dependencies : [libvirgl_dep, gallium_dep]
) )
install_headers('virglrenderer.h', subdir : 'virgl') install_headers('virglrenderer.h', subdir : 'virgl')

@ -29,5 +29,5 @@ virgl_fuzzer = executable(
'virgl_fuzzer.c', 'virgl_fuzzer.c',
c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ],
link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ],
dependencies : [libvirglrenderer_dep, epoxy_dep] dependencies : [libvirgl_dep, gallium_dep, epoxy_dep]
) )

@ -30,11 +30,11 @@ libvrtest_sources = [
'testvirgl_encode.h', 'testvirgl_encode.h',
] ]
libvrtest = library( libvrtest = static_library(
'vrtest', 'vrtest',
libvrtest_sources, libvrtest_sources,
dependencies : [ dependencies : [
libvirglrenderer_dep, libvirgl_dep,
gallium_dep, gallium_dep,
check_dep check_dep
] ]

@ -36,7 +36,7 @@ virgl_test_server_sources = [
virgl_test_server = executable( virgl_test_server = executable(
'virgl_test_server', 'virgl_test_server',
virgl_test_server_sources, virgl_test_server_sources,
dependencies : libvirglrenderer_dep, dependencies : [libvirglrenderer_dep, gallium_dep],
install : true install : true
) )
@ -55,6 +55,6 @@ if with_fuzzer
c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ],
link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ],
objects : vtest_obj, objects : vtest_obj,
dependencies : libvirglrenderer_dep dependencies : libvirgl_dep
) )
endif endif

Loading…
Cancel
Save