libwebp: Unicode command tools on Windows

Define macros in examples/unicode.h to use Unicode argv
on Windows. Keep char everywhere on Unix since it handles
UTF-8 without any change.

Impact:
 - All fopen () and SHCreateStreamOnFile(),
 - All fprintf() printing file paths,
 - All strcmp() used with "-",
 - File path parsing,
 - Gif reading.

Concerned executables from examples/ and extras/:
  anim_diff, anim_dump, vwebp, vwebp_sdl,
  cwebp, dwebp, gif2webp, img2webp,
  webpmux, webpinfo, webp_quality, get_disto

When compiled on Windows with Unicode enabled, webpmux and
img2webp will not work when used with an argument file and
will print "Reading arguments from a file is a feature
unavailable with Unicode binaries."

BUG=webp:398

Change-Id: Ic55d222a3ce1a715f9c4cce57ecbe2705d5ce317
This commit is contained in:
Yannis Guyon
2018-10-16 11:03:18 +02:00
parent 5030e90278
commit 9cf9841b5e
23 changed files with 485 additions and 214 deletions

View File

@ -18,6 +18,11 @@ option(WEBP_NEAR_LOSSLESS "Enable near-lossless encoding" ON)
option(WEBP_ENABLE_SWAP_16BIT_CSP "Enable byte swap for 16 bit colorspaces."
OFF)
# Option needed for handling Unicode file names on Windows.
if(WIN32)
option(WEBP_UNICODE "Build Unicode executables." ON)
endif()
if(WEBP_BUILD_WEBP_JS)
set(WEBP_ENABLE_SIMD OFF)
endif()
@ -41,6 +46,11 @@ if(WEBP_ENABLE_SWAP_16BIT_CSP)
add_definitions(-DWEBP_SWAP_16BIT_CSP=1)
endif()
if(WEBP_UNICODE)
# Windows recommends setting both UNICODE and _UNICODE.
add_definitions(-DUNICODE -D_UNICODE)
endif()
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\$\{prefix\}")
set(libdir "\$\{prefix\}/lib")