mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 03:34:26 +08:00
added first version of SDL2_image library which currently does not link to any external libraries.
This commit is contained in:
parent
f73bc68642
commit
29aedfad6c
44
ports/sdl2-image/CMakeLists.txt
Normal file
44
ports/sdl2-image/CMakeLists.txt
Normal file
@ -0,0 +1,44 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(SDL2_image)
|
||||
|
||||
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})
|
||||
|
||||
#add_definitions(-DNOCONTROLS -DTHREADED_AUDIO)
|
||||
|
||||
# some c++ code just assumes memset is available
|
||||
|
||||
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
|
||||
)
|
||||
|
||||
target_link_libraries(SDL2_image ${SDL_LIBRARY})
|
||||
|
||||
install(TARGETS SDL2_image
|
||||
RUNTIME DESTINATION bin
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib)
|
||||
|
||||
install(FILES SDL_image.h DESTINATION include CONFIGURATIONS Release)
|
||||
|
||||
|
||||
message(STATUS "Link-time dependencies:")
|
||||
message(STATUS " " ${SDL_LIBRARY})
|
3
ports/sdl2-image/CONTROL
Normal file
3
ports/sdl2-image/CONTROL
Normal file
@ -0,0 +1,3 @@
|
||||
Source: sdl2-image
|
||||
Version:
|
||||
Description:
|
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 */
|
36
ports/sdl2-image/portfile.cmake
Normal file
36
ports/sdl2-image/portfile.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
# 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})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
|
||||
# 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)
|
Loading…
x
Reference in New Issue
Block a user