Skip to content
This repository has been archived by the owner on Mar 22, 2020. It is now read-only.

Commit

Permalink
Use Hunter to download WebP
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Apr 9, 2018
1 parent 442e5f2 commit 64216a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cmake/OpenCVFindLibsGrfmt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,27 @@ if(WITH_WEBP)
if(BUILD_WEBP)
ocv_clear_vars(WEBP_FOUND WEBP_LIBRARY WEBP_LIBRARIES WEBP_INCLUDE_DIR)
else()
if(HUNTER_ENABLED)
hunter_add_package(WebP)
find_package(WebP CONFIG REQUIRED)
set(WEBP_FOUND TRUE)
set(HAVE_WEBP 1)
set(WEBP_LIBRARY WebP::webp)
set(WEBP_LIBRARIES ${WEBP_LIBRARY})

get_target_property(
WEBP_INCLUDE_DIR
WebP::webp
INTERFACE_INCLUDE_DIRECTORIES
)
else()

include(cmake/OpenCVFindWebP.cmake)
if(WEBP_FOUND)
set(HAVE_WEBP 1)
endif()

endif()
endif()
endif()

Expand Down
4 changes: 4 additions & 0 deletions cmake/templates/OpenCVConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ if("@JASPER_FOUND@")
find_dependency(jasper CONFIG)
endif()

if("@WEBP_FOUND@")
find_dependency(WebP CONFIG)
endif()

# AWP: Qt5 dependencies -- start
if("@Qt5Core_FOUND@")
find_dependency(Qt5Core)
Expand Down

8 comments on commit 64216a3

@xsacha
Copy link

@xsacha xsacha commented on 64216a3 Apr 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about for Android, that comes with webp library on device?

@ruslo
Copy link
Author

@ruslo ruslo commented on 64216a3 Apr 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the question. WebP builds fine on Android and OpenCV has WITH_WEBP=ON by default for Android, so I guess it's used just like any other dependency.

@xsacha
Copy link

@xsacha xsacha commented on 64216a3 Apr 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally it will link to the webp in NDK, which uses the system shared library.

@ruslo
Copy link
Author

@ruslo ruslo commented on 64216a3 Apr 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see. Yes it seems that ${OpenCV_SOURCE_DIR}/3rdparty/libwebp directory not used on Android if(WITH_WEBP AND NOT WEBP_FOUND AND (NOT ANDROID ...). Do you think it will cause any troubles or it's just not optimal?

@xsacha
Copy link

@xsacha xsacha commented on 64216a3 Apr 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just not optimal. Won't cause issues (may just get a newer WebP version).

@xsacha
Copy link

@xsacha xsacha commented on 64216a3 Jun 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just got an error compiling OpenCV for Android when host machine is Windows:

in cmake/OpenCVFindLibsGrfmt.cmake:112 (hunter_add_package)
CMake Error at CMakeLists.txt:49 (add_library):
Syntax error in cmake code when parsing string

C:\Users\Xsach\AppData\Roaming\..\Local\Android\sdk\ndk-bundle/sources/android/cpufeatures/cpu-features.c

Invalid escape sequence \U

Seems silly seeing as it shouldn't be compiled at all.

@ruslo
Copy link
Author

@ruslo ruslo commented on 64216a3 Jun 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just got an error compiling OpenCV for Android when host machine is Windows

I'm not sure I understand where the error happened exactly, can you show full log with HUNTER_STATUS_DEBUG=ON?

@ruslo
Copy link
Author

@ruslo ruslo commented on 64216a3 Jun 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also probably it make sense to open an issue, not a comment to commit.

Please sign in to comment.