diff options
author | Gert Wollny <gert.wollny@collabora.com> | 2019-12-23 16:48:52 +0100 |
---|---|---|
committer | Gert Wollny <gert.wollny@collabora.com> | 2019-12-27 10:00:56 +0100 |
commit | 1e581b6b49d5ba46e9dae8f271f6d585d89c9411 (patch) | |
tree | 90505e78d8c88224b8a34e88785f4fe45b2d8687 | |
parent | 1686cf92a7c67b12ed90519e5cf6428eff4d9026 (diff) |
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>
-rw-r--r-- | meson.build | 10 | ||||
-rw-r--r-- | src/meson.build | 53 | ||||
-rw-r--r-- | tests/fuzzer/meson.build | 2 | ||||
-rw-r--r-- | tests/meson.build | 4 | ||||
-rw-r--r-- | vtest/meson.build | 4 |
5 files changed, 50 insertions, 23 deletions
diff --git a/meson.build b/meson.build index 682d7c8..85b6500 100644 --- a/meson.build +++ b/meson.build @@ -60,6 +60,16 @@ foreach w : warnings endif 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') libdrm_dep = dependency('libdrm', version : '>=2.4.50') diff --git a/src/meson.build b/src/meson.build index 1f34daf..ec2d664 100644 --- a/src/meson.build +++ b/src/meson.build @@ -23,12 +23,10 @@ subdir('gallium') -virglrenderer_sources = [ +virgl_sources = [ 'iov.c', 'virgl_hw.h', 'virgl_protocol.h', - 'virglrenderer.c', - 'virglrenderer.h', 'vrend_blitter.c', 'vrend_blitter.h', 'vrend_debug.c', @@ -48,19 +46,25 @@ virglrenderer_sources = [ 'vrend_util.h', ] -virglrenderer_egl_sources = [ +virglrenderer_sources = [ + 'virglrenderer.c', + 'virglrenderer.h', +] + + +virgl_egl_sources = [ 'virgl_gbm.c', 'virgl_gbm.h', 'virgl_egl_context.c', 'virgl_egl.h', ] -virglrenderer_glx_sources = [ +virgl_glx_sources = [ 'virgl_glx_context.c', 'virgl_glx.h', ] -virglrenderer_depends = [ +virgl_depends = [ gallium_dep, epoxy_dep, libdrm_dep, @@ -69,35 +73,48 @@ virglrenderer_depends = [ ] if have_egl - virglrenderer_sources += virglrenderer_egl_sources - virglrenderer_depends += [gbm_dep] + virgl_sources += virgl_egl_sources + virgl_depends += [gbm_dep] endif if have_glx - virglrenderer_sources += virglrenderer_glx_sources - virglrenderer_depends += [glx_dep] + virgl_sources += virgl_glx_sources + virgl_depends += [glx_dep] 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( 'virglrenderer', virglrenderer_sources, include_directories: [inc_gallium, inc_configuration], - dependencies : virglrenderer_depends, + dependencies : [virgl_depends, libvirgl_dep], version : binary_age.to_string() + '.' + interface_age.to_string() + '.' + revision.to_string(), install : true ) -libvirglrenderer_inc = [ - inc_gallium, - inc_configuration, - include_directories('.') -] - libvirglrenderer_dep = declare_dependency( link_with: libvirglrenderer, - include_directories: libvirglrenderer_inc + include_directories: libvirgl_inc, + dependencies : [libvirgl_dep, gallium_dep] ) install_headers('virglrenderer.h', subdir : 'virgl') diff --git a/tests/fuzzer/meson.build b/tests/fuzzer/meson.build index 6c8f2df..96c8792 100644 --- a/tests/fuzzer/meson.build +++ b/tests/fuzzer/meson.build @@ -29,5 +29,5 @@ virgl_fuzzer = executable( 'virgl_fuzzer.c', c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], - dependencies : [libvirglrenderer_dep, epoxy_dep] + dependencies : [libvirgl_dep, gallium_dep, epoxy_dep] ) diff --git a/tests/meson.build b/tests/meson.build index 7a25562..66b1157 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -30,11 +30,11 @@ libvrtest_sources = [ 'testvirgl_encode.h', ] -libvrtest = library( +libvrtest = static_library( 'vrtest', libvrtest_sources, dependencies : [ - libvirglrenderer_dep, + libvirgl_dep, gallium_dep, check_dep ] diff --git a/vtest/meson.build b/vtest/meson.build index 90f93a8..b7ac747 100644 --- a/vtest/meson.build +++ b/vtest/meson.build @@ -36,7 +36,7 @@ virgl_test_server_sources = [ virgl_test_server = executable( 'virgl_test_server', virgl_test_server_sources, - dependencies : libvirglrenderer_dep, + dependencies : [libvirglrenderer_dep, gallium_dep], install : true ) @@ -55,6 +55,6 @@ if with_fuzzer c_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], link_args : [ '-fsanitize=address', '-fsanitize=fuzzer' ], objects : vtest_obj, - dependencies : libvirglrenderer_dep + dependencies : libvirgl_dep ) endif |