mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-24 03:27:12 +01:00
Merge branch 'master' of https://github.com/patrigg/vcpkg
This commit is contained in:
commit
34a0dc005d
109
ports/sdl2-image/CMakeLists.txt
Normal file
109
ports/sdl2-image/CMakeLists.txt
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
project(SDL2_image)
|
||||||
|
|
||||||
|
### configuration ###
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||||
|
# enable all file formats which are supported natively
|
||||||
|
set(SUPPORTED_FORMATS BMP GIF LBM PCX PNM TGA XPM XCF XV)
|
||||||
|
|
||||||
|
# enable all file formats which are supported through external dependencies
|
||||||
|
# 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
|
||||||
|
set(DEPENDENCIES PNG JPEG TIFF WEBP)
|
||||||
|
|
||||||
|
# patch library names for preprocessor flags
|
||||||
|
set(JPEG_FLAG JPG)
|
||||||
|
set(TIFF_FLAG TIF)
|
||||||
|
|
||||||
|
# names of potentially dynamically loaded libraries
|
||||||
|
set(JPEG_DYNAMIC \"libjpeg-9.dll\")
|
||||||
|
set(PNG_DYNAMIC \"libpng16-16.dll\")
|
||||||
|
set(TIFF_DYNAMIC \"libtiff-5.dll\")
|
||||||
|
set(WEBP_DYNAMIC \"libwebp-4.dll\")
|
||||||
|
|
||||||
|
### implementation ###
|
||||||
|
|
||||||
|
add_library(SDL2_image
|
||||||
|
IMG.c
|
||||||
|
IMG_bmp.c
|
||||||
|
IMG_gif.c
|
||||||
|
IMG_jpg.c
|
||||||
|
IMG_lbm.c
|
||||||
|
IMG_pcx.c
|
||||||
|
IMG_png.c
|
||||||
|
IMG_pnm.c
|
||||||
|
IMG_tga.c
|
||||||
|
IMG_tif.c
|
||||||
|
IMG_webp.c
|
||||||
|
IMG_xcf.c
|
||||||
|
IMG_xpm.c
|
||||||
|
IMG_xv.c
|
||||||
|
IMG_xxx.c
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(FORMAT ${SUPPORTED_FORMATS})
|
||||||
|
add_definitions(-DLOAD_${FORMAT})
|
||||||
|
endforeach(FORMAT)
|
||||||
|
|
||||||
|
# SDL
|
||||||
|
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
|
||||||
|
find_library(SDL_LIBRARY SDL2)
|
||||||
|
|
||||||
|
include_directories(${SDL_INCLUDE_DIR})
|
||||||
|
include_directories(${SDL_INCLUDE_DIR}/SDL2)
|
||||||
|
include_directories(${CMAKE_SOURCE_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(SDL2_image ${SDL_LIBRARY})
|
||||||
|
|
||||||
|
# external dependencies
|
||||||
|
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||||
|
find_package(${DEPENDENCY})
|
||||||
|
|
||||||
|
if(NOT DEFINED ${DEPENDENCY}_FLAG)
|
||||||
|
set(${DEPENDENCY}_FLAG ${DEPENDENCY})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG})
|
||||||
|
if(${DEPENDENCY}_FOUND)
|
||||||
|
message(STATUS " --> linking statically.")
|
||||||
|
target_link_libraries(SDL2_image ${${DEPENDENCY}_LIBRARIES})
|
||||||
|
elseif(DEFINED ${DEPENDENCY}_DYNAMIC)
|
||||||
|
message(STATUS " --> linking dynamically.")
|
||||||
|
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG}_DYNAMIC=${${DEPENDENCY}_DYNAMIC})
|
||||||
|
set(RUNTIME_DEPENDENCIES ON)
|
||||||
|
else()
|
||||||
|
message(STATUS " --> skipping.")
|
||||||
|
endif()
|
||||||
|
endforeach(DEPENDENCY)
|
||||||
|
|
||||||
|
if(DEFINED RUNTIME_DEPENDENCIES)
|
||||||
|
include_directories(VisualC/external/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
install(TARGETS SDL2_image
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib)
|
||||||
|
|
||||||
|
install(FILES SDL_image.h DESTINATION include/SDL2 CONFIGURATIONS Release)
|
||||||
|
|
||||||
|
|
||||||
|
message(STATUS "Link-time dependencies:")
|
||||||
|
message(STATUS " " ${SDL_LIBRARY})
|
||||||
|
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||||
|
if(${DEPENDENCY}_FOUND)
|
||||||
|
message(STATUS " " ${DEPENDENCY})
|
||||||
|
endif()
|
||||||
|
endforeach(DEPENDENCY)
|
||||||
|
|
||||||
|
if(DEFINED RUNTIME_DEPENDENCIES)
|
||||||
|
message(STATUS "Run-time dependencies:")
|
||||||
|
foreach(DEPENDENCY ${DEPENDENCIES})
|
||||||
|
if(NOT ${DEPENDENCY}_FOUND AND DEFINED ${DEPENDENCY}_DYNAMIC)
|
||||||
|
message(STATUS " " ${${DEPENDENCY}_DYNAMIC})
|
||||||
|
endif()
|
||||||
|
endforeach(DEPENDENCY)
|
||||||
|
endif()
|
5
ports/sdl2-image/CONTROL
Normal file
5
ports/sdl2-image/CONTROL
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Source: sdl2-image
|
||||||
|
Version: 2.0.1
|
||||||
|
Build-Depends: sdl2, libpng, libjpeg-turbo, tiff, libwebp
|
||||||
|
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
|
||||||
|
|
24
ports/sdl2-image/FindWEBP.cmake
Normal file
24
ports/sdl2-image/FindWEBP.cmake
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# - 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)
|
25
ports/sdl2-image/correct-sdl-headers-dir.patch
Normal file
25
ports/sdl2-image/correct-sdl-headers-dir.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
diff --git "a/SDL_image.h" "b/SDL_image.h"
|
||||||
|
index f654483..1bd4f62 100644
|
||||||
|
--- "a/SDL_image.h"
|
||||||
|
+++ "b/SDL_image.h"
|
||||||
|
@@ -24,9 +24,9 @@
|
||||||
|
#ifndef _SDL_IMAGE_H
|
||||||
|
#define _SDL_IMAGE_H
|
||||||
|
|
||||||
|
-#include "SDL.h"
|
||||||
|
-#include "SDL_version.h"
|
||||||
|
-#include "begin_code.h"
|
||||||
|
+#include <SDL2/SDL.h>
|
||||||
|
+#include <SDL2/SDL_version.h>
|
||||||
|
+#include <SDL2/begin_code.h>
|
||||||
|
|
||||||
|
/* Set up for C function definitions, even when using C++ */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
@@ -140,6 +140,6 @@ extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst,
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
-#include "close_code.h"
|
||||||
|
+#include <SDL2/close_code.h>
|
||||||
|
|
||||||
|
#endif /* _SDL_IMAGE_H */
|
39
ports/sdl2-image/portfile.cmake
Normal file
39
ports/sdl2-image/portfile.cmake
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# 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(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2_image-2.0.1)
|
||||||
|
vcpkg_download_distfile(ARCHIVE
|
||||||
|
URLS "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.zip"
|
||||||
|
FILENAME "SDL2_image-2.0.1.zip"
|
||||||
|
SHA512 37d12f4fae71c586bec73262bddb9207ab2f9a2ca6001d2cbfde646e268a950ba5cd4cff53d75e2da8959ae6da6e9cadc6eca88fa7bd9aa2758395d64c84a307
|
||||||
|
)
|
||||||
|
vcpkg_extract_source_archive(${ARCHIVE})
|
||||||
|
|
||||||
|
vcpkg_apply_patches(
|
||||||
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
|
PATCHES
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/correct-sdl-headers-dir.patch)
|
||||||
|
|
||||||
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||||
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindWEBP.cmake DESTINATION ${SOURCE_PATH}/cmake)
|
||||||
|
|
||||||
|
vcpkg_configure_cmake(
|
||||||
|
SOURCE_PATH ${SOURCE_PATH}
|
||||||
|
# OPTIONS
|
||||||
|
# OPTIONS_RELEASE -DOPTIMIZE=1
|
||||||
|
# OPTIONS_DEBUG -DDEBUGGABLE=1
|
||||||
|
)
|
||||||
|
|
||||||
|
vcpkg_install_cmake()
|
||||||
|
|
||||||
|
# Handle copyright
|
||||||
|
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-image)
|
||||||
|
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-image/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-image/copyright)
|
||||||
|
|
||||||
|
vcpkg_copy_pdbs()
|
Loading…
x
Reference in New Issue
Block a user