diff options
author | Martin Storsjö <martin@martin.st> | 2019-03-24 23:05:28 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2019-03-24 23:07:44 +0300 |
commit | 3f2bb0d9222aaf836bea6abd35d803a24bc47446 (patch) | |
tree | 907f2f361ffaa86d6796a42bb7843373f1a3ad8d | |
parent | ad8d21741a0239121a4bbfd5e48ee8f919869357 (diff) |
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.
-rw-r--r-- | include/dav1d/common.h | 6 | ||||
-rw-r--r-- | src/meson.build | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/include/dav1d/common.h b/include/dav1d/common.h index 5223f1e..b1f79a4 100644 --- a/include/dav1d/common.h +++ b/include/dav1d/common.h @@ -33,7 +33,11 @@ #ifndef DAV1D_API #if defined _WIN32 - #define DAV1D_API __declspec(dllexport) + #if defined DAV1D_BUILDING_DLL + #define DAV1D_API __declspec(dllexport) + #else + #define DAV1D_API + #endif #else #if __GNUC__ >= 4 #define DAV1D_API __attribute__ ((visibility ("default"))) diff --git a/src/meson.build b/src/meson.build index 1feeb13..18bc12d 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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' @@ -162,6 +164,8 @@ if host_machine.system() == 'windows' and get_option('default_library') != 'stat ) libdav1d_rc_obj = winmod.compile_resources(rc_file) + + api_export_flags = ['-DDAV1D_BUILDING_DLL'] else libdav1d_rc_obj = [] endif @@ -180,7 +184,7 @@ libdav1d_entrypoints_objs = static_library('dav1d_entrypoint', include_directories : dav1d_inc_dirs, dependencies: [stdatomic_dependency], - c_args : [stackalign_flag, stackrealign_flag], + c_args : [stackalign_flag, stackrealign_flag, api_export_flags], install : false, build_by_default : false, ).extract_all_objects() @@ -222,7 +226,7 @@ libdav1d = library('dav1d', thread_dependency, thread_compat_dep, ], - c_args : [stackalign_flag], + c_args : [stackalign_flag, api_export_flags], version : dav1d_soname_version, soversion : dav1d_soversion, install : true, |