Commit 6835ae5d authored by Niklas Haas's avatar Niklas Haas

meson: use a linker script for symbol visibility

This prevents us from re-exporting e.g. glslang symbols, thereby
properly fixing #42.
parent 1484190c
......@@ -28,10 +28,6 @@
#include "config.h"
#include "pl_assert.h"
// Include all of the symbols that should be public in a way that marks them
// as being externally visible. (Otherwise, all symbols are hidden by default)
#pragma GCC visibility push(default)
#include "include/libplacebo/colorspace.h"
#include "include/libplacebo/common.h"
#include "include/libplacebo/context.h"
......@@ -50,8 +46,6 @@
#include "include/libplacebo/vulkan.h"
#endif
#pragma GCC visibility pop
// Align up to the nearest multiple of an arbitrary alignment, which may also
// be 0 to signal no alignment requirements.
#define PL_ALIGN(x, align) ((align) ? ((x) + (align) - 1) / (align) * (align) : (x))
......
{
global:
pl_3dlut_apply;
pl_3dlut_default_params;
pl_3dlut_update;
pl_bit_encoding_equal;
pl_buf_create;
pl_buf_destroy;
pl_buf_poll;
pl_buf_read;
pl_buf_storage_layout;
pl_buf_uniform_layout;
pl_buf_write;
pl_chroma_location_offset;
pl_color_adjustment_neutral;
pl_color_light_is_scene_referred;
pl_color_map_default_params;
pl_color_primaries_guess;
pl_color_primaries_is_wide_gamut;
pl_color_repr_decode;
pl_color_repr_equal;
pl_color_repr_hdtv;
pl_color_repr_jpeg;
pl_color_repr_merge;
pl_color_repr_normalize;
pl_color_repr_rgb;
pl_color_repr_sdtv;
pl_color_repr_uhdtv;
pl_color_repr_unknown;
pl_color_space_bt2020_hlg;
pl_color_space_bt709;
pl_color_space_equal;
pl_color_space_hdr10;
pl_color_space_infer;
pl_color_space_merge;
pl_color_space_monitor;
pl_color_space_srgb;
pl_color_space_unknown;
pl_color_system_guess_ycbcr;
pl_color_system_is_linear;
pl_color_system_is_ycbcr_like;
pl_color_transfer_nominal_peak;
pl_context_create;
pl_context_default_params;
pl_context_destroy;
pl_deband_default_params;
pl_desc_access_glsl_name;
pl_desc_namespace;
pl_dispatch_abort;
pl_dispatch_begin;
pl_dispatch_compute;
pl_dispatch_create;
pl_dispatch_destroy;
pl_dispatch_finish;
pl_dither_default_params;
pl_filter_bicubic;
pl_filter_box;
pl_filter_catmull_rom;
pl_filter_config_eq;
pl_filter_ewa_ginseng;
pl_filter_ewa_hann;
pl_filter_ewa_jinc;
pl_filter_ewa_lanczos;
pl_filter_ewa_robidoux;
pl_filter_ewa_robidouxsharp;
pl_filter_free;
pl_filter_function_bcspline;
pl_filter_function_bicubic;
pl_filter_function_blackman;
pl_filter_function_box;
pl_filter_function_catmull_rom;
pl_filter_function_eq;
pl_filter_function_gaussian;
pl_filter_function_hamming;
pl_filter_function_hann;
pl_filter_function_jinc;
pl_filter_function_kaiser;
pl_filter_function_mitchell;
pl_filter_function_robidoux;
pl_filter_function_robidouxsharp;
pl_filter_function_sinc;
pl_filter_function_sphinx;
pl_filter_function_spline16;
pl_filter_function_spline36;
pl_filter_function_spline64;
pl_filter_function_triangle;
pl_filter_function_welch;
pl_filter_gaussian;
pl_filter_generate;
pl_filter_ginseng;
pl_filter_haasnsoft;
pl_filter_lanczos;
pl_filter_mitchell;
pl_filter_robidoux;
pl_filter_robidouxsharp;
pl_filter_sample;
pl_filter_sinc;
pl_filter_spline16;
pl_filter_spline36;
pl_filter_spline64;
pl_filter_triangle;
pl_find_fmt;
pl_find_named_filter;
pl_find_named_filter_function;
pl_find_named_fmt;
pl_find_vertex_fmt;
pl_fmt_is_ordered;
pl_generate_bayer_matrix;
pl_generate_blue_noise;
pl_get_color_mapping_matrix;
pl_get_cone_matrix;
pl_get_rgb2xyz_matrix;
pl_get_xyz2rgb_matrix;
pl_gpu_flush;
pl_icc_profile_equal;
pl_log_color;
pl_log_simple;
pl_matrix2x2_apply;
pl_matrix2x2_identity;
pl_matrix3x3_apply;
pl_matrix3x3_identity;
pl_matrix3x3_invert;
pl_matrix3x3_mul;
pl_matrix3x3_scale;
pl_named_filter_functions;
pl_named_filters;
pl_optimal_transfer_stride;
pl_pass_create;
pl_pass_destroy;
pl_pass_run;
pl_plane_data_from_mask;
pl_plane_find_fmt;
pl_push_constant_layout;
pl_raw_primaries_get;
pl_rect2d_normalize;
pl_rect3d_normalize;
pl_render_default_params;
pl_renderer_create;
pl_renderer_destroy;
pl_renderer_flush_cache;
pl_render_image;
pl_render_target_from_swapchain;
pl_shader_alloc;
pl_shader_color_map;
pl_shader_cone_distort;
pl_shader_deband;
pl_shader_decode_color;
pl_shader_delinearize;
pl_shader_dither;
pl_shader_encode_color;
pl_shader_finalize;
pl_shader_free;
pl_shader_is_compute;
pl_shader_linearize;
pl_shader_obj_destroy;
pl_shader_output_size;
pl_shader_reset;
pl_shader_sample_bicubic;
pl_shader_sample_direct;
pl_shader_sample_ortho;
pl_shader_sample_polar;
pl_shader_sigmoidize;
pl_shader_signature;
pl_shader_unsigmoidize;
pl_sigmoid_default_params;
pl_swapchain_destroy;
pl_swapchain_latency;
pl_swapchain_start_frame;
pl_swapchain_submit_frame;
pl_swapchain_swap_buffers;
pl_tex_blit;
pl_tex_clear;
pl_tex_create;
pl_tex_destroy;
pl_tex_download;
pl_tex_invalidate;
pl_tex_upload;
pl_transform2x2_apply;
pl_transform2x2_identity;
pl_transform3x3_apply;
pl_transform3x3_identity;
pl_transform3x3_invert;
pl_transform3x3_scale;
pl_upload_plane;
pl_var_float;
pl_var_from_fmt;
pl_var_glsl_type_name;
pl_var_host_layout;
pl_var_mat2;
pl_var_mat3;
pl_var_mat4;
pl_var_type_size;
pl_var_uint;
pl_var_vec2;
pl_var_vec3;
pl_var_vec4;
pl_vision_achromatopsia;
pl_vision_deuteranomaly;
pl_vision_deuteranopia;
pl_vision_monochromacy;
pl_vision_normal;
pl_vision_protanomaly;
pl_vision_protanopia;
pl_vision_tritanomaly;
pl_vision_tritanopia;
pl_vk_inst_create;
pl_vk_inst_default_params;
pl_vk_inst_destroy;
pl_vulkan_create;
pl_vulkan_create_swapchain;
pl_vulkan_default_params;
pl_vulkan_destroy;
pl_vulkan_hold;
pl_vulkan_release;
pl_vulkan_wrap;
local:
*;
};
......@@ -6,13 +6,12 @@ version = majorver + '.' + apiver + '.' + fixver
c_opts = [
'-D_ISOC99_SOURCE', '-D_GNU_SOURCE', '-D_XOPEN_SOURCE=700',
'-U__STRICT_ANSI__', '-fvisibility=hidden',
'-Wmissing-prototypes', '-Wno-pointer-sign'
'-U__STRICT_ANSI__', '-Wmissing-prototypes', '-Wno-pointer-sign'
]
# glslang needs c++11
cpp_opts = [
'-std=c++11', '-fvisibility=hidden',
'-std=c++11',
]
# Build options mostly taken from mpv
......@@ -199,15 +198,21 @@ configure_file(
configuration: conf,
)
# Symbol visibility
symfile = 'libplacebo.sym'
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symfile)
# Build process
add_project_arguments(build_opts + c_opts, language: 'c')
add_project_arguments(build_opts + cpp_opts, language: 'cpp')
inc = include_directories('./include')
lib = library('placebo', sources,
install: true,
dependencies: build_deps,
soversion: apiver,
include_directories: inc,
link_args: vflag,
)
# Install process
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment