diff options
Diffstat (limited to 'vcpkg/ports/libwebp')
| -rw-r--r-- | vcpkg/ports/libwebp/0002-cmake-config.patch | 20 | ||||
| -rw-r--r-- | vcpkg/ports/libwebp/0003-simd.patch | 23 | ||||
| -rw-r--r-- | vcpkg/ports/libwebp/0008-sdl.patch | 43 | ||||
| -rw-r--r-- | vcpkg/ports/libwebp/portfile.cmake | 74 | ||||
| -rw-r--r-- | vcpkg/ports/libwebp/usage | 9 | ||||
| -rw-r--r-- | vcpkg/ports/libwebp/vcpkg.json | 215 |
6 files changed, 384 insertions, 0 deletions
diff --git a/vcpkg/ports/libwebp/0002-cmake-config.patch b/vcpkg/ports/libwebp/0002-cmake-config.patch new file mode 100644 index 0000000..ad19140 --- /dev/null +++ b/vcpkg/ports/libwebp/0002-cmake-config.patch @@ -0,0 +1,20 @@ +diff --git a/cmake/WebPConfig.cmake.in b/cmake/WebPConfig.cmake.in +index a0d721f..8726c09 100644 +--- a/cmake/WebPConfig.cmake.in ++++ b/cmake/WebPConfig.cmake.in +@@ -13,7 +13,14 @@ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") + set_and_check(WebP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") + set(WebP_INCLUDE_DIRS ${WebP_INCLUDE_DIR}) + set(WEBP_INCLUDE_DIRS ${WebP_INCLUDE_DIR}) +-set(WebP_LIBRARIES "@INSTALLED_LIBRARIES@") ++set(WebP_LIBRARIES "") ++include(SelectLibraryConfigurations) ++foreach(_vcpkg_libwebp_lib IN ITEMS @INSTALLED_LIBRARIES@ sharpyuv) ++ find_library(_vcpkg_${_vcpkg_libwebp_lib}_LIBRARY_RELEASE NAMES ${_vcpkg_libwebp_lib} lib${_vcpkg_libwebp_lib} NAMES_PER_DIR PATHS "${VCPKG_IMPORT_PREFIX}/lib" NO_DEFAULT_PATH) ++ find_library(_vcpkg_${_vcpkg_libwebp_lib}_LIBRARY_DEBUG NAMES ${_vcpkg_libwebp_lib}d lib${_vcpkg_libwebp_lib}d ${_vcpkg_libwebp_lib} lib${_vcpkg_libwebp_lib} NAMES_PER_DIR PATHS "${VCPKG_IMPORT_PREFIX}/debug/lib" NO_DEFAULT_PATH) ++ select_library_configurations(_vcpkg_${_vcpkg_libwebp_lib}) ++ list(APPEND WebP_LIBRARIES ${_vcpkg_${_vcpkg_libwebp_lib}_LIBRARIES}) ++endforeach() + set(WEBP_LIBRARIES "${WebP_LIBRARIES}") + + check_required_components(WebP) diff --git a/vcpkg/ports/libwebp/0003-simd.patch b/vcpkg/ports/libwebp/0003-simd.patch new file mode 100644 index 0000000..e477d6b --- /dev/null +++ b/vcpkg/ports/libwebp/0003-simd.patch @@ -0,0 +1,23 @@ +diff --git a/cmake/cpu.cmake b/cmake/cpu.cmake +index 3b0b2d37..a376b87b 100644 +--- a/cmake/cpu.cmake ++++ b/cmake/cpu.cmake +@@ -50,7 +50,7 @@ if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "MSVC") + if(MSVC_VERSION GREATER_EQUAL 1800 AND NOT CMAKE_C_FLAGS MATCHES "/arch:") + set(SIMD_ENABLE_FLAGS) + else() +- set(SIMD_ENABLE_FLAGS "/arch:AVX2;/arch:AVX;/arch:SSE2;;;;") ++ set(SIMD_ENABLE_FLAGS ";;/arch:SSE2;;;;") # /arch:AVX2;/arch:AVX is too much for SSE4 + endif() + set(SIMD_DISABLE_FLAGS) + else() +@@ -111,6 +111,9 @@ foreach(I_SIMD RANGE ${WEBP_SIMD_FLAGS_RANGE}) + "${CMAKE_CURRENT_LIST_DIR}/../src/dsp/*${WEBP_SIMD_FILE_EXTENSION}") + if(WEBP_HAVE_${WEBP_SIMD_FLAG}) + # Memorize the file and flags. ++ if("${SIMD_COMPILE_FLAG}" STREQUAL "") ++ set(SIMD_COMPILE_FLAG " ") ++ endif() + foreach(FILE ${SIMD_FILES}) + list(APPEND WEBP_SIMD_FILES_TO_INCLUDE ${FILE}) + list(APPEND WEBP_SIMD_FLAGS_TO_INCLUDE ${SIMD_COMPILE_FLAG}) diff --git a/vcpkg/ports/libwebp/0008-sdl.patch b/vcpkg/ports/libwebp/0008-sdl.patch new file mode 100644 index 0000000..7622ca4 --- /dev/null +++ b/vcpkg/ports/libwebp/0008-sdl.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b785a8e..f214a32 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -665,6 +665,10 @@ if(WEBP_BUILD_EXTRAS) + ${CMAKE_CURRENT_BINARY_DIR}/src ${SDL2_INCLUDE_DIRS}) + set(WEBP_HAVE_SDL 1) + target_compile_definitions(vwebp_sdl PUBLIC WEBP_HAVE_SDL) ++ target_compile_definitions(vwebp_sdl PRIVATE WEBP_HAVE_JUST_SDL_H) ++ if(WIN32) ++ target_link_libraries(vwebp_sdl dxguid winmm) ++ endif() + + set(CMAKE_REQUIRED_INCLUDES "${SDL2_INCLUDE_DIRS}") + check_c_source_compiles( +@@ -699,8 +703,9 @@ if(WEBP_BUILD_WEBP_JS) + if(NOT WEBP_ENABLE_SIMD) + # JavaScript version + add_executable(webp_js ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c) +- target_link_libraries(webp_js webpdecoder SDL2) ++ target_link_libraries(webp_js webpdecoder ${SDL_LIBRARY}) + target_include_directories(webp_js PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) ++ target_include_directories(webp_js PRIVATE ${SDL_INCLUDE_DIR}) + set(WEBP_HAVE_SDL 1) + set_target_properties( + webp_js +@@ -715,12 +720,15 @@ if(WEBP_BUILD_WEBP_JS) + -sALLOW_MEMORY_GROWTH") + set_target_properties(webp_js PROPERTIES OUTPUT_NAME webp) + target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_SDL) ++ target_compile_definitions(webp_js PUBLIC EMSCRIPTEN WEBP_HAVE_JUST_SDL_H) + endif() + + # WASM version + add_executable(webp_wasm ${CMAKE_CURRENT_SOURCE_DIR}/extras/webp_to_sdl.c) +- target_link_libraries(webp_wasm webpdecoder SDL2) ++ target_link_libraries(webp_wasm webpdecoder ${SDL_LIBRARY}) + target_include_directories(webp_wasm PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) ++ target_include_directories(webp_wasm PRIVATE ${SDL_INCLUDE_DIR}) ++ target_compile_definitions(webp_wasm PUBLIC EMSCRIPTEN WEBP_HAVE_JUST_SDL_H) + set_target_properties( + webp_wasm + PROPERTIES diff --git a/vcpkg/ports/libwebp/portfile.cmake b/vcpkg/ports/libwebp/portfile.cmake new file mode 100644 index 0000000..e9864c0 --- /dev/null +++ b/vcpkg/ports/libwebp/portfile.cmake @@ -0,0 +1,74 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO webmproject/libwebp + REF "v${VERSION}" + SHA512 298e0ad4c09392213baf5abb69d330c6203b618800073fe2df91d01d35034197c5d3e29a74573b06971473c52c74514f0e6e0f6c8162f923e2dd15cb1a692aef + HEAD_REF master + PATCHES + 0002-cmake-config.patch + 0003-simd.patch + 0008-sdl.patch +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + anim WEBP_BUILD_ANIM_UTILS + cwebp WEBP_BUILD_CWEBP + dwebp WEBP_BUILD_DWEBP + extras WEBP_BUILD_EXTRAS + gif2webp WEBP_BUILD_GIF2WEBP + img2webp WEBP_BUILD_IMG2WEBP + info WEBP_BUILD_WEBPINFO + libwebpmux WEBP_BUILD_LIBWEBPMUX + mux WEBP_BUILD_WEBPMUX + nearlossless WEBP_NEAR_LOSSLESS + simd WEBP_ENABLE_SIMD + swap16bitcsp WEBP_ENABLE_SWAP_16BIT_CSP + unicode WEBP_UNICODE + vwebp WEBP_BUILD_VWEBP + vwebp-sdl CMAKE_REQUIRE_FIND_PACKAGE_SDL + INVERTED_FEATURES + vwebp-sdl CMAKE_DISABLE_FIND_PACKAGE_SDL +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + OPTIONS_DEBUG + -DWEBP_BUILD_ANIM_UTILS=OFF + -DWEBP_BUILD_CWEBP=OFF + -DWEBP_BUILD_DWEBP=OFF + -DWEBP_BUILD_EXTRAS=OFF + -DWEBP_BUILD_GIF2WEBP=OFF + -DWEBP_BUILD_IMG2WEBP=OFF + -DWEBP_BUILD_VWEBP=OFF + -DWEBP_BUILD_WEBPINFO=OFF + -DWEBP_BUILD_WEBPMUX=OFF + MAYBE_UNUSED_VARIABLES + CMAKE_DISABLE_FIND_PACKAGE_SDL + CMAKE_REQUIRE_FIND_PACKAGE_SDL +) + +vcpkg_cmake_install() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_copy_pdbs() +vcpkg_cmake_config_fixup(PACKAGE_NAME WebP CONFIG_PATH share/WebP/cmake) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + +vcpkg_fixup_pkgconfig() + +vcpkg_list(SET BIN_NAMES) +foreach(tool IN ITEMS get_disto gif2webp img2webp vwebp vwebp_sdl webpinfo webpmux webp_quality cwebp dwebp) + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + vcpkg_list(APPEND BIN_NAMES "${tool}") + endif() +endforeach() +if(NOT BIN_NAMES STREQUAL "") + vcpkg_copy_tools(TOOL_NAMES ${BIN_NAMES} AUTO_CLEAN) +endif() + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST ${SOURCE_PATH}/COPYING ${SOURCE_PATH}/PATENTS) diff --git a/vcpkg/ports/libwebp/usage b/vcpkg/ports/libwebp/usage new file mode 100644 index 0000000..da6b265 --- /dev/null +++ b/vcpkg/ports/libwebp/usage @@ -0,0 +1,9 @@ +libwebp provides CMake targets: + + find_package(WebP CONFIG REQUIRED) + # basic usage + target_link_libraries(main PRIVATE WebP::webp WebP::webpdecoder WebP::webpdemux) + # for manipulating the WebP graphics format container (port feature libwebpmux) + target_link_libraries(main PRIVATE WebP::libwebpmux) + # for sharp RGB to YUV conversion + target_link_libraries(main PRIVATE WebP::sharpyuv) diff --git a/vcpkg/ports/libwebp/vcpkg.json b/vcpkg/ports/libwebp/vcpkg.json new file mode 100644 index 0000000..b25845e --- /dev/null +++ b/vcpkg/ports/libwebp/vcpkg.json @@ -0,0 +1,215 @@ +{ + "name": "libwebp", + "version": "1.6.0", + "port-version": 1, + "description": "WebP codec: library to encode and decode images in WebP format", + "homepage": "https://github.com/webmproject/libwebp", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "libwebp", + "default-features": false, + "features": [ + "unicode" + ], + "platform": "windows" + }, + { + "name": "libwebp", + "default-features": false, + "features": [ + "simd" + ], + "platform": "osx & x64" + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "libwebpmux", + "nearlossless", + { + "name": "simd", + "platform": "!emscripten" + } + ], + "features": { + "all": { + "description": "enable all features except for swap16bitcsp", + "dependencies": [ + { + "name": "libwebp", + "features": [ + "anim", + "cwebp", + "dwebp", + "extras", + "gif2webp", + "img2webp", + "info", + "libwebpmux", + "mux", + "nearlossless", + "simd" + ] + }, + { + "name": "libwebp", + "features": [ + "vwebp" + ], + "platform": "!osx & !static" + }, + { + "name": "libwebp", + "features": [ + "vwebp-sdl" + ], + "platform": "!android & !osx & !uwp & !(windows & static)" + } + ] + }, + "anim": { + "description": "Build animation utilities.", + "dependencies": [ + "giflib", + "libjpeg-turbo", + "libpng", + { + "name": "libwebp", + "default-features": false, + "features": [ + "img2webp", + "mux" + ] + }, + { + "name": "tiff", + "default-features": false + } + ] + }, + "cwebp": { + "description": "Build the cwebp command line tool.", + "dependencies": [ + "libjpeg-turbo", + "libpng", + { + "name": "tiff", + "default-features": false + } + ] + }, + "dwebp": { + "description": "Build the dwebp command line tool.", + "dependencies": [ + "libjpeg-turbo", + "libpng", + { + "name": "tiff", + "default-features": false + } + ] + }, + "extras": { + "description": "Build extras. (Doesn't include vwebp-sdl.)", + "dependencies": [ + "libjpeg-turbo", + "libpng", + { + "name": "tiff", + "default-features": false + } + ] + }, + "gif2webp": { + "description": "Build the gif2webp conversion tool.", + "dependencies": [ + "giflib", + { + "name": "libwebp", + "default-features": false, + "features": [ + "libwebpmux" + ] + } + ] + }, + "img2webp": { + "description": "Build the img2webp animation tool.", + "dependencies": [ + "libjpeg-turbo", + "libpng", + { + "name": "libwebp", + "default-features": false, + "features": [ + "libwebpmux" + ] + }, + { + "name": "tiff", + "default-features": false + } + ] + }, + "info": { + "description": "Build the webpinfo command line tool." + }, + "libwebpmux": { + "description": "Build the libwebpmux library" + }, + "mux": { + "description": "Build the webpmux command line tool.", + "dependencies": [ + { + "name": "libwebp", + "default-features": false, + "features": [ + "libwebpmux" + ] + } + ] + }, + "nearlossless": { + "description": "Enable near-lossless encoding" + }, + "simd": { + "description": "Enable any SIMD optimization." + }, + "swap16bitcsp": { + "description": "Enable byte swap for 16 bit colorspaces." + }, + "unicode": { + "description": "Build Unicode executables. (Adds definition UNICODE and _UNICODE)" + }, + "vwebp": { + "description": "Build the vwebp viewer tool.", + "supports": "!osx & !(windows & static)", + "dependencies": [ + "freeglut", + "opengl" + ] + }, + "vwebp-sdl": { + "description": "Build the vwebp viewer tool for SDL.", + "dependencies": [ + { + "name": "libwebp", + "default-features": false, + "features": [ + "extras", + "vwebp" + ] + }, + "sdl1" + ] + } + } +} |