deps_builder: Fix missing Webp support in OIIO build on windows
webp 1.3 changed the filenames on windows to include a `lib` prefix (ie libwebp.lib rather than webp.lib) now this is a common thing on linux and cmake has a `CMAKE_FIND_LIBRARY_PREFIXES` variable that has a list of prefixes to look for during a `find_library` call. `CMAKE_FIND_LIBRARY_PREFIXES` gets set during the call to the `project` method in the main CMakeLists of a project. Now for windows `lib` is *not* a common prefix by CMake, and it doesn't add "lib" to CMAKE_FIND_LIBRARY_PREFIXES during that call. so find library doesn't look for it, the libs are not found and an unhappy time is had by all. Now the most obvious solution would be to pass `-DCMAKE_FIND_LIBRARY_PREFIXES=lib` to CMake to sidestep this however, the `project` call will set the variable overwriting anything you passed through the CLI. So the fix here is to have `find_library` counter-intuitively look for both `libwebp` and `webp`
This commit is contained in:
@@ -1,31 +1,50 @@
|
||||
diff --git a/src/cmake/modules/FindWebP.cmake b/src/cmake/modules/FindWebP.cmake
|
||||
index 87b880a..0e9850f 100644
|
||||
--- a/src/cmake/modules/FindWebP.cmake
|
||||
+++ b/src/cmake/modules/FindWebP.cmake
|
||||
@@ -29,6 +29,12 @@ find_library (WEBPDEMUX_LIBRARY webpdemux
|
||||
diff -Naur oiio-2.4.15.0/src/cmake/modules/FindWebP.cmake external_openimageio/src/cmake/modules/FindWebP.cmake
|
||||
--- oiio-2.4.15.0/src/cmake/modules/FindWebP.cmake 2023-09-01 10:48:29.000000000 -0600
|
||||
+++ external_openimageio/src/cmake/modules/FindWebP.cmake 2023-09-21 14:47:19.366083900 -0600
|
||||
@@ -25,15 +25,30 @@
|
||||
ENV WEBP_INCLUDE_PATH
|
||||
DOC "The directory where Webp headers reside")
|
||||
|
||||
-find_library (WEBP_LIBRARY webp
|
||||
+find_library (WEBP_LIBRARY
|
||||
+ NAMES
|
||||
+ webp
|
||||
+ libwebp
|
||||
HINTS
|
||||
${WEBP_LIBRARY_PATH}
|
||||
ENV WEBP_LIBRARY_PATH)
|
||||
+# New in WebP 1.3
|
||||
+find_library (WEBP_SHARPYUV_LIBRARY sharpyuv
|
||||
-find_library (WEBPDEMUX_LIBRARY webpdemux
|
||||
+find_library (WEBPDEMUX_LIBRARY
|
||||
+ NAMES
|
||||
+ webpdemux
|
||||
+ libwebpdemux
|
||||
+ HINTS
|
||||
+ ${WEBP_LIBRARY_PATH}
|
||||
+ ENV WEBP_LIBRARY_PATH)
|
||||
+
|
||||
+# New in WebP 1.3
|
||||
+find_library (WEBP_SHARPYUV_LIBRARY
|
||||
+ NAMES
|
||||
+ sharpyuv
|
||||
+ libsharpyuv
|
||||
HINTS
|
||||
${WEBP_LIBRARY_PATH}
|
||||
ENV WEBP_LIBRARY_PATH)
|
||||
|
||||
+
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (WebP
|
||||
@@ -38,7 +44,7 @@ find_package_handle_standard_args (WebP
|
||||
REQUIRED_VARS WEBP_INCLUDE_DIR
|
||||
@@ -42,7 +57,7 @@
|
||||
|
||||
if (WebP_FOUND)
|
||||
set (WEBP_INCLUDES "${WEBP_INCLUDE_DIR}")
|
||||
- set (WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBPDEMUX_LIBRARY})
|
||||
+ set (WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBPDEMUX_LIBRARY} ${WEBP_SHARPYUV_LIBRARY})
|
||||
|
||||
if (NOT TARGET WebP::WebP)
|
||||
add_library(WebP::WebP UNKNOWN IMPORTED)
|
||||
@@ -54,10 +60,18 @@ if (WebP_FOUND)
|
||||
set_property(TARGET WebP::WebPDemux APPEND PROPERTY
|
||||
if (NOT TARGET WebP::webp)
|
||||
add_library(WebP::webp UNKNOWN IMPORTED)
|
||||
@@ -58,10 +73,18 @@
|
||||
set_property(TARGET WebP::webpdemux APPEND PROPERTY
|
||||
IMPORTED_LOCATION ${WEBPDEMUX_LIBRARY})
|
||||
endif ()
|
||||
+ if (WEBP_SHARPYUV_LIBRARY AND NOT TARGET WebP::sharpyuv)
|
||||
|
||||
Reference in New Issue
Block a user