Fix libwebp dll exports (#2306)

pull/2308/head
Caleb Kiage 2 years ago committed by GitHub
parent 48800f92e4
commit c53b49dbae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      packages/l/libwebp/patches/0001-fix-dll-export.patch
  2. 8
      packages/l/libwebp/xmake.lua

@ -0,0 +1,26 @@
diff --git a/src/webp/types.h b/src/webp/types.h
index 0ce2622..69f7e89 100644
--- a/src/webp/types.h
+++ b/src/webp/types.h
@@ -39,7 +39,9 @@ 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(_MSC_VER) && defined(WEBP_DLL)
+# define WEBP_EXTERN __declspec(dllexport)
+# elif defined(__GNUC__) && __GNUC__ >= 4
# define WEBP_EXTERN extern __attribute__ ((visibility ("default")))
# else
# define WEBP_EXTERN extern
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2501012..2e090e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,2 +16,6 @@ project(WebP C)
+if(MSVC AND BUILD_SHARED_LIBS)
+ add_definitions(-DWEBP_DLL)
+endif()
+
# Options for coder / decoder executables.

@ -14,6 +14,8 @@ package("libwebp")
add_versions("v1.2.4", "dfe7bff3390cd4958da11e760b65318f0a48c32913e4d5bc5e8d55abaaa2d32e")
add_versions("v1.3.0", "dc9860d3fe06013266c237959e1416b71c63b36f343aae1d65ea9c94832630e1")
add_patches(">=1.1.0 <1.3.0", path.join(os.scriptdir(), "patches", "0001-fix-dll-export.patch"), "81d92d800dd7b57704a0e4db3b7155184fe8bb6bc0a925a699a8a0868629f60c")
add_configs("anim_utils", {description = "Build animation utilities.", default = false, type = "boolean"})
add_configs("cwebp", {description = "Build the cwebp command line tool.", default = false, type = "boolean"})
add_configs("dwebp", {description = "Build the dwebp command line tool.", default = false, type = "boolean"})
@ -43,6 +45,9 @@ package("libwebp")
if package:config("sharpyuv") or package:version():ge("1.2.3") then
package:add("links", "sharpyuv")
end
if package:config("libwebpmux") then
package:add("links", "webpmux")
end
for name, enabled in pairs(package:configs()) do
if name == "thread" then
@ -61,4 +66,7 @@ package("libwebp")
on_test(function (package)
assert(package:has_cfuncs("WebPGetEncoderVersion", {includes = "webp/encode.h"}))
if package:config("libwebpmux") and package:version():ge("1.2.1") then
assert(package:has_cfuncs("WebPGetMuxVersion", {includes = "webp/mux.h"}))
end
end)

Loading…
Cancel
Save