diff options
author | James Zern <jzern@google.com> | 2024-03-06 23:54:57 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-03-06 23:54:57 +0000 |
commit | 661c1b6641f32a951c3045bf5253166ee94f93ac (patch) | |
tree | c44bd63b78848113f844bb2622d3c0691e59bfa7 | |
parent | 8ea678b9904ac76afe6c2baada9a6d9bd0f5f11b (diff) | |
parent | 8487860a8c634bdbaee6056c2081d147041c3b06 (diff) | |
download | webp-661c1b6641f32a951c3045bf5253166ee94f93ac.tar.gz |
Merge "windows exports: use dllexport attribute, instead of visibility." into main
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | sharpyuv/sharpyuv.h | 10 | ||||
-rw-r--r-- | src/webp/types.h | 12 |
4 files changed, 14 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cfc625ed..bce1a7f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,7 +135,7 @@ if(WEBP_UNICODE) add_definitions(-DUNICODE -D_UNICODE) endif() -if(MSVC AND BUILD_SHARED_LIBS) +if(WIN32 AND BUILD_SHARED_LIBS) add_definitions(-DWEBP_DLL) endif() @@ -163,7 +163,9 @@ if(MSVC) set(CMAKE_STATIC_LIBRARY_PREFIX "${webp_libname_prefix}") endif() +if(NOT WIN32) set(CMAKE_C_VISIBILITY_PRESET hidden) +endif() if(WEBP_ENABLE_WUNUSED_RESULT) if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21.0) diff --git a/configure.ac b/configure.ac index 128c3633..53753a67 100644 --- a/configure.ac +++ b/configure.ac @@ -763,7 +763,8 @@ AC_CONFIG_FILES([Makefile src/Makefile man/Makefile \ src/libwebp.pc src/libwebpdecoder.pc \ src/demux/libwebpdemux.pc src/mux/libwebpmux.pc]) - +dnl fix exports from MinGW builds +AC_CONFIG_COMMANDS_POST([$SED -i 's/-DDLL_EXPORT/-DWEBP_DLL/' config.status]) AC_OUTPUT AC_MSG_NOTICE([ diff --git a/sharpyuv/sharpyuv.h b/sharpyuv/sharpyuv.h index 23a69ce3..fe958915 100644 --- a/sharpyuv/sharpyuv.h +++ b/sharpyuv/sharpyuv.h @@ -22,15 +22,13 @@ extern "C" { #else // This explicitly marks library functions and allows for changing the // signature for e.g., Windows DLL builds. -#if defined(__GNUC__) && __GNUC__ >= 4 -#define SHARPYUV_EXTERN extern __attribute__((visibility("default"))) -#else -#if defined(_MSC_VER) && defined(WEBP_DLL) +#if defined(_WIN32) && defined(WEBP_DLL) #define SHARPYUV_EXTERN __declspec(dllexport) +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define SHARPYUV_EXTERN extern __attribute__((visibility("default"))) #else #define SHARPYUV_EXTERN extern -#endif /* _MSC_VER && WEBP_DLL */ -#endif /* __GNUC__ >= 4 */ +#endif /* defined(_WIN32) && defined(WEBP_DLL) */ #endif /* WEBP_EXTERN */ #endif /* SHARPYUV_EXTERN */ diff --git a/src/webp/types.h b/src/webp/types.h index f1727491..0e7ef129 100644 --- a/src/webp/types.h +++ b/src/webp/types.h @@ -56,15 +56,13 @@ typedef long long int int64_t; #ifndef WEBP_EXTERN // This explicitly marks library functions and allows for changing the // signature for e.g., Windows DLL builds. -# if defined(__GNUC__) && __GNUC__ >= 4 +# if defined(_WIN32) && defined(WEBP_DLL) +# define WEBP_EXTERN __declspec(dllexport) +# elif defined(__GNUC__) && __GNUC__ >= 4 # define WEBP_EXTERN extern __attribute__ ((visibility ("default"))) # else -# if defined(_MSC_VER) && defined(WEBP_DLL) -# define WEBP_EXTERN __declspec(dllexport) -# else -# define WEBP_EXTERN extern -# endif -# endif /* __GNUC__ >= 4 */ +# define WEBP_EXTERN extern +# endif /* defined(_WIN32) && defined(WEBP_DLL) */ #endif /* WEBP_EXTERN */ // Macro to check ABI compatibility (same major revision number) |