aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel <gabriel+github@mastergk.de>2018-07-04 10:01:08 +0200
committerRobert Schumacher <roschuma@microsoft.com>2018-07-04 01:01:08 -0700
commita6b2019b74be79062b7535b1eaab8b9309fdba74 (patch)
tree9dd0d35477d8cc6d739fad33b2d0d3fc5478a2ee
parent0a656f6a7a82011ac4b923d902d27c828cc1094e (diff)
downloadvcpkg-a6b2019b74be79062b7535b1eaab8b9309fdba74.tar.gz
vcpkg-a6b2019b74be79062b7535b1eaab8b9309fdba74.zip
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()
-rw-r--r--ports/sdl2-image/CMakeLists.txt9
-rw-r--r--ports/sdl2-image/CONTROL15
-rw-r--r--ports/sdl2-image/FindWEBP.cmake24
-rw-r--r--ports/sdl2-image/portfile.cmake33
4 files changed, 41 insertions, 40 deletions
diff --git a/ports/sdl2-image/CMakeLists.txt b/ports/sdl2-image/CMakeLists.txt
index 0df7e7d36..e1ef48bd9 100644
--- a/ports/sdl2-image/CMakeLists.txt
+++ b/ports/sdl2-image/CMakeLists.txt
@@ -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)
diff --git a/ports/sdl2-image/CONTROL b/ports/sdl2-image/CONTROL
index f9d5e14ed..c91b0c838 100644
--- a/ports/sdl2-image/CONTROL
+++ b/ports/sdl2-image/CONTROL
@@ -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
diff --git a/ports/sdl2-image/FindWEBP.cmake b/ports/sdl2-image/FindWEBP.cmake
deleted file mode 100644
index fb3f9caa1..000000000
--- a/ports/sdl2-image/FindWEBP.cmake
+++ /dev/null
@@ -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) \ No newline at end of file
diff --git a/ports/sdl2-image/portfile.cmake b/ports/sdl2-image/portfile.cmake
index 10567a131..82adedaaf 100644
--- a/ports/sdl2-image/portfile.cmake
+++ b/ports/sdl2-image/portfile.cmake
@@ -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()