Commit 3f2bb0d9 authored by Martin Storsjö's avatar Martin Storsjö

Only define DAV1D_API to dllexport when building dav1d itself

As meson still doesn't allow specifying different cflags between
static and dynamic libraries, this still includes the dllexport
in the static library when built with default_library=both, but
it at least is avoided in static-only builds, and avoids
defining these symbols as dllexport in the callers' translation
units.
parent ad8d2174
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
#ifndef DAV1D_API #ifndef DAV1D_API
#if defined _WIN32 #if defined _WIN32
#if defined DAV1D_BUILDING_DLL
#define DAV1D_API __declspec(dllexport) #define DAV1D_API __declspec(dllexport)
#else
#define DAV1D_API
#endif
#else #else
#if __GNUC__ >= 4 #if __GNUC__ >= 4
#define DAV1D_API __attribute__ ((visibility ("default"))) #define DAV1D_API __attribute__ ((visibility ("default")))
......
...@@ -139,8 +139,10 @@ endif ...@@ -139,8 +139,10 @@ endif
api_export_flags = []
# #
# Windows .rc file # Windows .rc file and API export flags
# #
if host_machine.system() == 'windows' and get_option('default_library') != 'static' if host_machine.system() == 'windows' and get_option('default_library') != 'static'
...@@ -162,6 +164,8 @@ if host_machine.system() == 'windows' and get_option('default_library') != 'stat ...@@ -162,6 +164,8 @@ if host_machine.system() == 'windows' and get_option('default_library') != 'stat
) )
libdav1d_rc_obj = winmod.compile_resources(rc_file) libdav1d_rc_obj = winmod.compile_resources(rc_file)
api_export_flags = ['-DDAV1D_BUILDING_DLL']
else else
libdav1d_rc_obj = [] libdav1d_rc_obj = []
endif endif
...@@ -180,7 +184,7 @@ libdav1d_entrypoints_objs = static_library('dav1d_entrypoint', ...@@ -180,7 +184,7 @@ libdav1d_entrypoints_objs = static_library('dav1d_entrypoint',
include_directories : dav1d_inc_dirs, include_directories : dav1d_inc_dirs,
dependencies: [stdatomic_dependency], dependencies: [stdatomic_dependency],
c_args : [stackalign_flag, stackrealign_flag], c_args : [stackalign_flag, stackrealign_flag, api_export_flags],
install : false, install : false,
build_by_default : false, build_by_default : false,
).extract_all_objects() ).extract_all_objects()
...@@ -222,7 +226,7 @@ libdav1d = library('dav1d', ...@@ -222,7 +226,7 @@ libdav1d = library('dav1d',
thread_dependency, thread_dependency,
thread_compat_dep, thread_compat_dep,
], ],
c_args : [stackalign_flag], c_args : [stackalign_flag, api_export_flags],
version : dav1d_soname_version, version : dav1d_soname_version,
soversion : dav1d_soversion, soversion : dav1d_soversion,
install : true, install : true,
......
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