Commit Graph

111 Commits

Author SHA1 Message Date
James Zern
979c0ebbcd sharpyuv: add SharpYuvGetCPUInfo
This gives a similar structure to libwebp and fixes a bug where passing
NULL to SharpYuvInit() would unconditionally set optimized function
pointers. SharpYuvInit() is left as an undocumented public function and
SharpYuvGetCPUInfo is kept private to serialize updates to the pointer.

Change-Id: Id72fbf3ba5b396367510e3bcd1ee2e4e11b95b8c
2022-10-26 13:07:01 -07:00
James Zern
a02978c250 sharpyuv/Makefile.am+cmake: add missing -lm
this lib uses functions from math.h

Change-Id: I316f058c9e42e4888cce0d380472518a77e21517
2022-10-25 15:58:21 -07:00
James Zern
2498209ba9 *.pc.in: add lib prefix to lib names w/MSVC
this fixes the library names output after:
9ac25bcb3 CMakeLists.txt,win32: match naming convention used by nmake

before this change:
pkg-config --libs --msvc-syntax \
  libwebp libwebpdemux libwebpmux libsharpyuv libwebpdecoder
/libpath:.../lib webpdemux.lib webpmux.lib webp.lib
  sharpyuv.lib webpdecoder.lib

after:
pkg-config --libs --msvc-syntax \
  libwebp libwebpdemux libwebpmux libsharpyuv libwebpdecoder
/libpath:.../lib libwebpdemux.lib libwebpmux.lib libwebp.lib
  libsharpyuv.lib libwebpdecoder.lib

Bug: webp:584
Change-Id: Ic3693b58a40e0ba683333065003b1c00aab0cf48
Fixed: webp:584
2022-10-17 14:07:02 -07:00
James Zern
d992bb08b7 cmake: rename cpufeatures target to cpufeatures-webp
this avoids name clashes with other targets of the same name:
https://github.com/webmproject/sjpeg/pull/117

Change-Id: I520dff992c71f0e737ac4a7e21f9ae80701d052d
2022-10-11 15:52:04 -07:00
James Zern
e407d4b37c CMakeLists.txt: replace GLUT_glut_LIBRARY w/GLUT::GLUT
GLUT_glut_LIBRARY is a cache variable that is not recommended for use:

from cmake-3.24/Modules/FindGLUT.cmake:
This module may set the following variables depending on platform.
These variables may optionally be set to help this module find the
correct files, but clients should not use these as results:

...

``GLUT_glut_LIBRARY``
  The full path to the glut library.

based on a patch in the Krita and vcpkg projects:
7d51396a7a/3rdparty/ext_webp/0009-glut.patch
https://github.com/microsoft/vcpkg/blob/master/ports/libwebp/0009-glut.patch

Change-Id: If54e26cb1e4e2f582e40eebd7e49d7cc566dbb81
2022-10-04 16:20:11 -07:00
James Zern
25807fb4cb Merge "cmake: restore compatibility with cmake < 3.12" into main 2022-10-04 21:06:52 +00:00
Vincent Rabaud
b2a175dd04 Merge "Update wasm instructions." into main 2022-10-04 19:33:17 +00:00
Vincent Rabaud
cb90f76b68 Update wasm instructions.
Also update the quotes in CMake following:
https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-specify-s-options-in-a-cmake-project
https://emscripten.org/docs/getting_started/FAQ.html#why-do-i-get-a-nameerror-or-a-problem-occurred-in-evaluating-content-after-a-s-when-i-use-a-s-option

Change-Id: I9cc0a5aece0019c81e3f435106bf288cd68d0fd0
2022-10-04 16:24:57 +02:00
James Zern
02d1525869 cmake: restore compatibility with cmake < 3.12
since:
bfad7ab5 CMakeLists.txt: correct libwebpmux name in WebPConfig.cmake

replace list(TRANSFORM ...) with string(REGEX REPLACE ...); the former
was added in 3.12, but currently 3.7 is supported

Change-Id: Ie2de2cf083c937ce0bb4d402d6f2452c09de0cea
2022-10-03 18:55:30 -07:00
Jeremy Maitin-Shepard
5ba046e25f CMake: add_definitions -> add_compile_options
`add_definitions` has been superseded by `add_compile_options` and
options added via `add_definitions` can have surprising behavior,
particularly when including `libwebp` as a sub-project via
`FetchContent`.

Change-Id: Icb8478dc92017576028becfd92c4567b4095fa60
2022-10-03 16:48:40 -07:00
James Zern
15a91ab179 cmake,cosmetics: apply cmake-format
using the defaults present in 0.6.13 and setting
--first-comment-is-literal to avoid reflowing the copyright block and
--max-subgroups-hwrap 3 (default is 2) to avoid making some short set()
statements multi-line.

Change-Id: I77ec1f05a819f09c0143d6069c56b6e771ac6a37
2022-08-17 12:46:40 -07:00
James Zern
0dd49d1a3a CMakeLists.txt: set @ONLY in configure_file() calls
this matches the behavior in autoconf and avoids expanding the ${var}
references in the files; the .pc files now match the autoconf install.

pointed out by @kmilos in:
https://github.com/AOMediaCodec/libavif/pull/1035#discussion_r947847183

Change-Id: Ib1950a290b73b7e689658e6c2f25c8784b586180
2022-08-17 12:00:22 -07:00
James Zern
639619ce72 cmake: fix dll exports
move WEBP_EXTERN definition from Makefile.vc to webp/types.h using the
existing WEBP_DLL define to control its declaration to
__declspec(dllexport); the same is done for SHARPYUV_EXTERN

Change-Id: Iecea360305bdd19a878255470a00b9dcc344c730
2022-08-11 19:33:37 -07:00
H. Vetinari
9ac25bcb39 CMakeLists.txt,win32: match naming convention used by nmake
Change-Id: Ib4d5c256b8c90afd54b4d7bcdee8df532095422d
2022-08-11 11:30:36 -07:00
James Zern
866e349cef libwebp-1.2.4
- 8/4/2022: version 1.2.4
   This is a binary compatible release.
   * restore CMake libwebpmux target name for compatibility with 1.2.2 (#575)
   * fix lossless crunch mode encoding with WEBP_REDUCE_SIZE
     (chromium: #1345547, #1345595, #1345772, #1345804)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAmLtz8MACgkQ+cPWvbgj
 K10v/A//R+sAs759jvKryQGJYDweXMKqbHbWWdkNbluX4FoitQH44Wy+YPecMrr2
 En3vSJWM50Bb8UvscvO+FoCI3x6DhgniEC7VbRnx43sSHioyd1K6XYBp+Q8Ksj6n
 qpdslDsjzpwj4uAKrDnTmdBr9CdSK8qxlXvgskqtWBwRnlePetRWXFSWO3ke7JKa
 d+SeLxboGgsZ+zjoWSqK+f7LCOEPGEkJk/JP3xOwn9K+FusLP2YMDhVw5Q78rWfh
 qNCamsM0SUFN9hfHp0/0FQvHO0B+c8BtB/hh5hjctZt7j5O+fQC+KAmiStnB2B3f
 CVjilU3ajnVH2VD4SYcsfHCVEV8hM+fHHjTgvnHh7jtz3wlokfcidMW9F1JujLZu
 M4FnD6XbJXERfitKx9lEzJ1h9RbChvrl84waU8Tkx/GboNIvHUQF5kROlOjXz3BL
 t+nkuNywxcb5RPph17OhYXT9MqPwGVHctrVG5DaAn+QjSKcxa65k03CFtZclD4Xm
 V8ozMwtKXiRZBqJRPwg7iYvnUOHixS3p+6p3OsUyjKelJEOLFfo1Z1vv7JvnXsmo
 xpvyetWnfWCnzzdMglahCVDu3ENVrjmNGV5g4wMTgDCcF0g/++M+7Yv/NfHNz0DX
 Y0uppjsXYUwNaq8Q3GpveQcpeZNrGpHRZQ88PsZkLxoNDn+hWHo=
 =BQmU
 -----END PGP SIGNATURE-----

Merge tag 'v1.2.4'

libwebp-1.2.4

- 8/4/2022: version 1.2.4
  This is a binary compatible release.
  * restore CMake libwebpmux target name for compatibility with 1.2.2 (#575)
  * fix lossless crunch mode encoding with WEBP_REDUCE_SIZE
    (chromium: #1345547, #1345595, #1345772, #1345804)

* tag 'v1.2.4':
  update ChangeLog
  update NEWS
  bump version to 1.2.4
  lossless: fix crunch mode w/WEBP_REDUCE_SIZE
  CMakeLists.txt: correct libwebpmux name in WebPConfig.cmake
  Revert "cmake: fix webpmux lib name for cmake linking"

Bug: webp:579
Change-Id: I7e1aa268d1ea9c1f3b38334cff2681e177bbdf36
2022-08-08 15:47:16 -07:00
Christopher Degawa
7deee8103e
libsharpyuv: add pkg-config file
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I872cd62ccdf096044c7921afda8289849d141531
2022-08-02 15:46:19 -05:00
Maryla
a3b68c195e Build libsharpyuv as a full installable library.
Headers are installed in a "sharpyuv" subdirectory of the webp
dir, e.g. /usr/local/include/webp/sharpyuv/
Remove unnecessary dependency from sharpyuv to webp/types.h

Add SHARPYUV_EXTERN so that only symbols meant to be public
are exported.

Sharpyuv users can use the library with:

find_package(WebP)
if(TARGET WebP::sharpyuv)
  # ... use WebP::sharpyuv
endif()

Change-Id: I602a25521a135a2edc39d6587610484fe6447ec5
2022-07-28 12:31:59 +00:00
James Zern
b4994eaa6d CMake: set rpath for shared objects
this ensures the correct library is loaded when the install path is not
in the default search path; this matches the behavior of
autoconf/libtool

Change-Id: I7eaa458c353cbdb7f0a1f782a879c59662a5de79
2022-07-25 16:48:00 -07:00
James Zern
231bdfb762 CMake: fix dylib versioning
match the behavior of autoconf in generating the -compatibility_version
and -current_version options. these use current + 1 and revision:
  # Darwin ld doesn't like 0 for these options...
  func_arith $current + 1
  minor_current=$func_arith_result
  ...
  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"

this requires CMake >= 3.17 to set the MACHO_COMPATIBILITY_VERSION and
MACHO_CURRENT_VERSION properties:
https://cmake.org/cmake/help/latest/prop_tgt/MACHO_COMPATIBILITY_VERSION.html

based on the fix in libexpat:
https://github.com/libexpat/libexpat/issues/55

Bug: webp:576
Fixed: webp:576
Change-Id: Ibc3ab99449aa213fc8c2ca3ae06def648c61acbd
2022-07-22 11:39:18 -07:00
James Zern
bfad7ab589 CMakeLists.txt: correct libwebpmux name in WebPConfig.cmake
this fixes link errors when using ${WEBP_LIBRARIES} from
WebPConfig.cmake:
/usr/bin/ld: cannot find -llibwebpmux: No such file or directory
/usr/bin/ld: note to link with /tmp/install/lib/libwebpmux.a use
-l:libwebpmux.a or rename it to liblibwebpmux.a

previously mentioned in https://github.com/openwrt/packages/pull/16784

Bug: webp:575
Change-Id: I38b45cb102ef1086ed992178cd736f45acf10d35
2022-07-21 19:12:38 -07:00
James Zern
c2e3fd30c4 Revert "cmake: fix webpmux lib name for cmake linking"
This reverts commit 13b8281609.

This breaks target name compatibility with earlier releases.

Conflicts:
	CMakeLists.txt

Bug: webp:575
Change-Id: I3d4895b8a8d14b3f4595ec19646ec4a1001c7748
2022-07-21 18:32:17 -07:00
Maryla
1124ff662d Add -fvisibility=hidden flag in CMakeLists.
This way, only functions marked with WEBP_EXTERN get exposed by the library.
This flag is already set in other build configs: configure.ac, makefile.unix,
Android.mk

Change-Id: Iafd8f160e539290e7ea46ceec764a090c6e626a9
2022-06-15 10:03:03 +02:00
Christopher Degawa
9fc12274ce
CMake: add src to webpinfo includes
Fixes an include error with webp/types.h

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I3d17d529c904cdb4e5c8ae630e89ed3789791e79
2022-05-31 20:46:21 -05:00
Christopher Degawa
7d18f40ac1
CMake: add WEBP_BUILD_WEBPINFO to list of checks for exampleutil
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I530268809468107fe29e0f04278791fe7c583208
2022-05-31 17:45:32 -05:00
Christopher Degawa
11309aa54c
CMake: add WEBP_BUILD_WEBPMUX to list of checks for exampleutil
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I1bd6163966d8cec9fc240fa46d41605f11d0c1ac
2022-05-31 17:45:30 -05:00
Christopher Degawa
4bc762f729
CMake: link imageioutil to exampleutil after defined
Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I6bd4b25d31a85839aadef57437faa04966085f52
2022-05-31 17:11:20 -05:00
Vincent Rabaud
42888f6c7c Add an option to enable static builds.
The build is not fully static but enough for certain usage.

Change-Id: I269fa40f332365873634b12ac54fd3c36beefd66
2022-04-12 17:50:19 +02:00
Maryla
01a05de1a7 libsharpyuv: add colorspace utilities
Change-Id: I620c8593dc81f39e747de5ed354332adb7278bed
2022-04-08 10:07:22 +02:00
Maryla
d55d447c9a Make libwebp depend on libsharpyuv.
Change-Id: I6d8ebfe1f855024fc0694b1aa584f71fa27b83ae
2022-03-04 11:35:03 +01:00
Maryla
29cc95ce4c Basic version of libsharpyuv in libwebp, in C.
It's self contained apart from a dependency on src/webp/types.h and src/dsp/cpu.h
For now it's only set up as an internal library, not an installable one.
Webp doesn't depend on it yet, the code is only duplicated.

Change-Id: I752799894f9d4105d0d296ddebd9f9641181a1ec
2022-02-18 14:52:44 +00:00
James Zern
b4533debd9 CMakeLists.txt,cosmetics: break long line
Change-Id: Ibe48516e858d4443d9ae43d8a5f6d074c7b07dd8
2022-02-14 10:06:03 -08:00
Alexandru Ardelean
13b8281609 cmake: fix webpmux lib name for cmake linking
When using CMake the `<prefix>/usr/share/WebP/cmake/WebPConfig.cmake` gets
used to get the names of the libraries to link against.

Since version 1.2.1 of libwebp, libwebpmux is on by default.
This causes a linker error because the linker arg should be `-lwebpmux`
instead of `-llibwebpmux`.

This is fixable by renaming `libwebpmux` to `webpmux` in a few places.

This was identified after an update to 1.2.1 of libwebp in the OpenWrt
project:
  https://github.com/openwrt/packages/pull/16766

Internally in OpenWrt, this was patched here:
  https://github.com/openwrt/packages/pull/16784

Change-Id: I97501c62b1e97b133a62b04d6516261d6d7c7fd0
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2022-01-31 14:38:16 +01:00
James Zern
3875c7de07 CMakeLists.txt: set minimum version to 3.7
cmake/cpu.cmake (at least) requires 3.7 due to its use of GREATER_EQUAL:
https://cmake.org/cmake/help/latest/release/3.7.html

Bug: webp:538
Change-Id: I63511226a593218e1f4d3b1a7c4c998de3ba2ae1
2021-08-31 13:21:46 -07:00
Yannis Guyon
42592af875 webp,cmake: Remove unnecessary include dirs
Following crrev.com/c/webm/libwebp/+/3038647

Change-Id: Id43ed9b1cc02a7333bc64e82523122f483c9350a
2021-08-30 09:35:31 +02:00
Yannis Guyon
edea64442c libwebp/CMake: Add <BUILD_INTERFACE> to webp incl
This way target_link_libraries(my_target PUBLIC webp) is enough,
no need to add include directories explicitly for the public headers
such as src/webp/decode.h. This matches the /usr/include/webp/decode.h
installation folder path prefix (#include "webp/decode.h").
See https://bugs.chromium.org/p/webp/issues/detail?id=532

The target_include_directories() calls for cwebp, dwebp etc. may be
unnecessary now and may be removed in another patch.

Change-Id: I2c85218920ffc35ebec23e0dd239f71e29add23b
2021-07-19 18:46:03 +02:00
Christopher Degawa
6f445b3e3d
CMake: set CMP0072 to NEW
Silences CMake's warning and uses GLVND, which still works for linux

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: Iadd173b41c4fbcdff9fe512f9a7dbf70a6d95bcd
2021-06-21 21:25:28 -05:00
Christopher Degawa
de3b4ba813 CMake: add WEBP_BUILD_LIBWEBPMUX
Adds an additional option similar to configure's --enable-libwebpmux
to toggle building libwebpmux separate from the binaries

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Change-Id: I0443b84eea36d86791e2e421a6fc0070879a7bef
2021-06-16 16:55:45 +00:00
James Zern
7f09d3d132 CMakeLists.txt: rm libwebpmux dep from anim_{diff,dump}
Change-Id: Ic293affca5a3e17afbfcda5e96eb101d005621b8
2021-06-16 04:40:21 +00:00
James Zern
3320416b2e CMakeLists,emscripten: use EXPORTED_RUNTIME_METHODS
rather than EXTRA_EXPORTED_RUNTIME_METHODS. this was deprecated in
2.0.18.

quiets a warning:
emcc: warning: EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use
EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]

https://emscripten.org/docs/introducing_emscripten/release_notes.html?highlight=exported_runtime_methods

Change-Id: I3acf22339a64f39a342051841a147744f6af954a
2021-05-21 15:09:04 -07:00
James Zern
7e58a1a260 *.cmake: add license header
this syncs the files with CMakeLists.txt

Change-Id: I94d45ef61d33ee9e43973b5d4e85fab007941f67
2021-04-12 17:28:15 -07:00
James Zern
5651a6b2ed cmake: fix .so versioning
libtool uses -version-info current:revision:age, but the library created
is [c-a].a.r.

Change-Id: Icf081e156a818a3cd7579ad5ffe3b518d8532bdb
2021-04-07 13:51:22 -07:00
James Zern
759b9d5a06 cmake: add WEBP_USE_THREAD option
this controls the config.h define of the same name and matches the
behavior of configure's --disable-threading

Bug: webp:502
Change-Id: Id135bbf4e6b3c9900e2b4f4f7ab744b3457ce41c
2021-02-05 15:32:41 -08:00
James Zern
926ce921f3 cmake: don't install binaries from extras/
this matches the behavior of configure

Bug: webp:502
Change-Id: I99e597971636bdc2b9a9465ba13bb24c70ce87c0
2021-02-05 15:30:06 -08:00
Skal
9eb2638119 CMake: remove duplicate "include(GNUInstallDirs)"
+ add missing copyright header

Change-Id: I2b61ab56a14d38360ac5beaebab4d2acf165dd46
2020-12-17 08:00:06 +01:00
James Zern
d2e245ea9e cmake: disable webp.js if WEBP_ENABLE_SIMD=1
wasm2js doesn't support SIMD, fixes link error

Change-Id: I3d9d3cb5f29434bf6c0c0029c07540a9768f9b95
2020-11-23 18:53:20 -08:00
James Zern
5abb55823b Merge "cmake: fix compilation w/Xcode generator" 2020-11-24 01:31:26 +00:00
James Zern
8484a1204c cmake: fix compilation w/Xcode generator
Add a stub file to object only library targets.

https://cmake.org/cmake/help/v3.18/command/add_library.html#object-libraries
Some native build systems (such as Xcode) may not like targets that have
only object files, so consider adding at least one real source file to
any target that references $<TARGET_OBJECTS:objlib>.

Bug: webp:477
Change-Id: I5d404c921d84433c7a0b22e0736ab0dbe699d264
2020-11-20 13:21:17 -08:00
Ingvar Stepanyan
52273943c6 Couple of fixes to allow SIMD on Emscripten
- Add `-msimd128` to flags to actually enable WebAssembly SIMD
   when performing SIMD detection. It's currently required in
   addition to `-msse*` / `-mfpu=neon` flags which only perform
   translation of corresponding intrinsics to Wasm SIMD ones.
   See a discussion at emscripten-core/emscripten#12714 for
   automating this and making easier in the future.
 - Remove compilation branch that prevented definitions of
   `WEBP_USE_SSE` and `WEBP_USE_NEON` on Emscripten even when
   SIMD support was detected at compile-time.
 - Add an implementation of `VP8GetCPUInfo` for Emscripten which
   uses static `WEBP_USE_*` flags to determine if a corresponding
   SIMD instruction is supported. This is because Wasm doesn't
   have proper feature detection (yet) and requires making separate
   build for SIMD version anyway.

Change-Id: I77592081b91fd0e4cbc9242f5600ce905184f506
2020-11-18 21:51:41 +00:00
Vincent Rabaud
133ff0e374 webp_js: force WASM=0 option explicitly
It's apparently no longer the default.

BUG=webp:470

Change-Id: Ic3219f2df2f19783ccea116e87bbefee29fe5edc
2020-05-29 14:56:34 +02:00
James Zern
22e404ccbd CMakeLists.txt: fix set(CACHE) argument order
<type> comes before <docstring>

Change-Id: Iad8cfbbab452381969a7b36aaf244b6abc4fc974
2020-02-06 20:27:01 -08:00