1SDL_IMAGE_LOCAL_PATH := $(call my-dir)
2
3
4# Enable this if you want to support loading JPEG images
5# The library path should be a relative path to this directory.
6SUPPORT_JPG ?= true
7JPG_LIBRARY_PATH := external/jpeg-9b
8
9# Enable this if you want to support loading PNG images
10# The library path should be a relative path to this directory.
11SUPPORT_PNG ?= true
12PNG_LIBRARY_PATH := external/libpng-1.6.37
13
14# Enable this if you want to support loading WebP images
15# The library path should be a relative path to this directory.
16SUPPORT_WEBP ?= true
17WEBP_LIBRARY_PATH := external/libwebp-1.0.2
18
19
20# Build the library
21ifeq ($(SUPPORT_JPG),true)
22    include $(SDL_IMAGE_LOCAL_PATH)/$(JPG_LIBRARY_PATH)/Android.mk
23endif
24
25# Build the library
26ifeq ($(SUPPORT_PNG),true)
27    include $(SDL_IMAGE_LOCAL_PATH)/$(PNG_LIBRARY_PATH)/Android.mk
28endif
29
30# Build the library
31ifeq ($(SUPPORT_WEBP),true)
32    include $(SDL_IMAGE_LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/Android.mk
33endif
34
35
36# Restore local path
37LOCAL_PATH := $(SDL_IMAGE_LOCAL_PATH)
38
39include $(CLEAR_VARS)
40
41LOCAL_MODULE := SDL2_image
42
43LOCAL_SRC_FILES :=  \
44    IMG.c           \
45    IMG_bmp.c       \
46    IMG_gif.c       \
47    IMG_jpg.c       \
48    IMG_lbm.c       \
49    IMG_pcx.c       \
50    IMG_png.c       \
51    IMG_pnm.c       \
52    IMG_svg.c       \
53    IMG_tga.c       \
54    IMG_tif.c       \
55    IMG_webp.c      \
56    IMG_WIC.c       \
57    IMG_xcf.c       \
58    IMG_xpm.c.arm   \
59    IMG_xv.c        \
60    IMG_xxx.c
61
62LOCAL_CFLAGS := -DLOAD_BMP -DLOAD_GIF -DLOAD_LBM -DLOAD_PCX -DLOAD_PNM \
63                -DLOAD_SVG -DLOAD_TGA -DLOAD_XCF -DLOAD_XPM -DLOAD_XV
64LOCAL_LDLIBS :=
65LOCAL_STATIC_LIBRARIES :=
66LOCAL_SHARED_LIBRARIES := SDL2
67
68ifeq ($(SUPPORT_JPG),true)
69    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(JPG_LIBRARY_PATH)
70    LOCAL_CFLAGS += -DLOAD_JPG
71    LOCAL_STATIC_LIBRARIES += jpeg
72endif
73
74ifeq ($(SUPPORT_PNG),true)
75    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(PNG_LIBRARY_PATH)
76    LOCAL_CFLAGS += -DLOAD_PNG
77    LOCAL_STATIC_LIBRARIES += png
78    LOCAL_LDLIBS += -lz
79endif
80
81ifeq ($(SUPPORT_WEBP),true)
82    LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(WEBP_LIBRARY_PATH)/src
83    LOCAL_CFLAGS += -DLOAD_WEBP
84    LOCAL_STATIC_LIBRARIES += webp
85endif
86
87LOCAL_EXPORT_C_INCLUDES += $(LOCAL_PATH)
88
89include $(BUILD_SHARED_LIBRARY)
90