mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 13:50:49 +00:00
SDL2 image: Add features for libjpeg, tiff and webp (#3531)
* SDL2 image: Add features for libjpeg, tiff and webp * [sdl2-image] Avoid passing lists through vcpkg_configure_cmake()
This commit is contained in:
parent
0a656f6a7a
commit
a6b2019b74
@ -3,7 +3,7 @@ project(SDL2_image C)
|
||||
|
||||
### configuration ###
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CURRENT_INSTALLED_DIR}/share/libwebp")
|
||||
# enable all file formats which are supported natively
|
||||
set(SUPPORTED_FORMATS BMP GIF LBM PCX PNM TGA XPM XCF XV SVG)
|
||||
|
||||
@ -11,6 +11,8 @@ set(SUPPORTED_FORMATS BMP GIF LBM PCX PNM TGA XPM XCF XV SVG)
|
||||
# first try to load them statically (lib file in vcpkg installation)
|
||||
# if this fails try to make them a dynamic dependency (dll will be loaded at runtime) if possible. vcpkg cannot resolve these dependencies!
|
||||
# else do not support this file format at all
|
||||
|
||||
# Can be explicitly enabled or disabled via USE_XYZ
|
||||
set(DEPENDENCIES PNG JPEG TIFF WEBP)
|
||||
|
||||
# patch library names for preprocessor flags
|
||||
@ -62,7 +64,10 @@ include_directories(${CMAKE_SOURCE_DIR})
|
||||
target_link_libraries(SDL2_image ${SDL_LIBRARY})
|
||||
|
||||
# external dependencies
|
||||
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||
foreach(DEPENDENCY IN LISTS DEPENDENCIES)
|
||||
if(NOT USE_${DEPENDENCY})
|
||||
continue()
|
||||
endif()
|
||||
find_package(${DEPENDENCY})
|
||||
|
||||
if(NOT DEFINED ${DEPENDENCY}_FLAG)
|
||||
|
@ -1,5 +1,16 @@
|
||||
Source: sdl2-image
|
||||
Version: 2.0.2-1
|
||||
Build-Depends: sdl2, libpng, libjpeg-turbo, tiff, libwebp
|
||||
Version: 2.0.2-3
|
||||
Build-Depends: sdl2, libpng
|
||||
Description: SDL_image is an image file loading library. It loads images as SDL surfaces and textures, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV
|
||||
|
||||
Feature: libjpeg-turbo
|
||||
Description: Support for JPEG image format
|
||||
Build-Depends: libjpeg-turbo
|
||||
|
||||
Feature: tiff
|
||||
Description: Support for TIFF image format
|
||||
Build-Depends: tiff
|
||||
|
||||
Feature: libwebp
|
||||
Description: Support for WEBP image format.
|
||||
Build-Depends: libwebp
|
||||
|
@ -1,24 +0,0 @@
|
||||
# - Find WEBP
|
||||
# Find the WEBP library
|
||||
# This module defines
|
||||
# WEBP_INCLUDE_DIRS, where to find webp/decode.h
|
||||
# WEBP_LIBRARIES, the libraries needed to use WEBP
|
||||
#
|
||||
|
||||
find_path(WEBP_INCLUDE_DIRS
|
||||
NAMES webp/decode.h
|
||||
)
|
||||
mark_as_advanced(WEBP_INCLUDE_DIRS)
|
||||
|
||||
find_library(
|
||||
WEBP_LIBRARIES
|
||||
NAMES webp
|
||||
)
|
||||
|
||||
find_library(WEBP_LIBRARY_RELEASE NAMES webp PATH_SUFFIXES lib)
|
||||
find_library(WEBP_LIBRARY_DEBUG NAMES webpd PATH_SUFFIXES lib)
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(WEBP)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WEBP DEFAULT_MSG WEBP_INCLUDE_DIRS WEBP_LIBRARIES)
|
@ -1,11 +1,3 @@
|
||||
# Common Ambient Variables:
|
||||
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
|
||||
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
|
||||
# PORT is the current port name (zlib, etc)
|
||||
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
|
||||
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
|
||||
#
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
set(SDL2_IMAGE_VERSION "2.0.2")
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2_image-${SDL2_IMAGE_VERSION})
|
||||
@ -17,14 +9,31 @@ vcpkg_download_distfile(ARCHIVE
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindWEBP.cmake DESTINATION ${SOURCE_PATH}/cmake)
|
||||
|
||||
set(USE_JPEG OFF)
|
||||
if("libjpeg-turbo" IN_LIST FEATURES)
|
||||
set(USE_JPEG ON)
|
||||
endif()
|
||||
|
||||
set(USE_TIFF OFF)
|
||||
if("tiff" IN_LIST FEATURES)
|
||||
set(USE_TIFF ON)
|
||||
endif()
|
||||
|
||||
set(USE_WEBP OFF)
|
||||
if("libwebp" IN_LIST FEATURES)
|
||||
set(USE_WEBP ON)
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
# OPTIONS
|
||||
# OPTIONS_RELEASE -DOPTIMIZE=1
|
||||
# OPTIONS_DEBUG -DDEBUGGABLE=1
|
||||
OPTIONS
|
||||
"-DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}"
|
||||
-DUSE_PNG=ON
|
||||
-DUSE_JPEG=${USE_JPEG}
|
||||
-DUSE_TIFF=${USE_TIFF}
|
||||
-DUSE_WEBP=${USE_WEBP}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
Loading…
x
Reference in New Issue
Block a user