aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Bader <mail@patrickbader.eu>2017-01-05 16:42:52 +0100
committerPatrick Bader <mail@patrickbader.eu>2017-01-05 16:42:52 +0100
commit29aedfad6cd82cc2c071dc99fa5d6aac74af8d49 (patch)
treed5d0553a414294893e6ce9fe5d2decb0ad5f1ee1
parentf73bc68642ea3493b1681b1e9d526565ac80b426 (diff)
downloadvcpkg-29aedfad6cd82cc2c071dc99fa5d6aac74af8d49.tar.gz
vcpkg-29aedfad6cd82cc2c071dc99fa5d6aac74af8d49.zip
added first version of SDL2_image library which currently does not link to any external libraries.
-rw-r--r--ports/sdl2-image/CMakeLists.txt44
-rw-r--r--ports/sdl2-image/CONTROL3
-rw-r--r--ports/sdl2-image/correct-sdl-headers-dir.patch25
-rw-r--r--ports/sdl2-image/portfile.cmake36
4 files changed, 108 insertions, 0 deletions
diff --git a/ports/sdl2-image/CMakeLists.txt b/ports/sdl2-image/CMakeLists.txt
new file mode 100644
index 000000000..3167294d3
--- /dev/null
+++ b/ports/sdl2-image/CMakeLists.txt
@@ -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})
diff --git a/ports/sdl2-image/CONTROL b/ports/sdl2-image/CONTROL
new file mode 100644
index 000000000..591550cdc
--- /dev/null
+++ b/ports/sdl2-image/CONTROL
@@ -0,0 +1,3 @@
+Source: sdl2-image
+Version:
+Description:
diff --git a/ports/sdl2-image/correct-sdl-headers-dir.patch b/ports/sdl2-image/correct-sdl-headers-dir.patch
new file mode 100644
index 000000000..4addc155d
--- /dev/null
+++ b/ports/sdl2-image/correct-sdl-headers-dir.patch
@@ -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 */
diff --git a/ports/sdl2-image/portfile.cmake b/ports/sdl2-image/portfile.cmake
new file mode 100644
index 000000000..f70d237c2
--- /dev/null
+++ b/ports/sdl2-image/portfile.cmake
@@ -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)