From 474a9ea051c584c373da28c5c8511f279ebd734c Mon Sep 17 00:00:00 2001 From: joshualitt Date: Thu, 5 Nov 2015 11:49:35 -0800 Subject: Wire up SDL on Android BUG=skia: Committed: https://skia.googlesource.com/skia/+/a4d3797c3b0f0cac8493c46cb334ca88a5d6ccf6 Review URL: https://codereview.chromium.org/1415453009 --- third_party/libsdl/android/SDL_config.h | 145 ++++++++++++++++++++++++++++ third_party/libsdl/android/sdl_android.gypi | 127 ++++++++++++++++++++++++ third_party/libsdl/sdl.gypi | 6 ++ 3 files changed, 278 insertions(+) create mode 100644 third_party/libsdl/android/SDL_config.h create mode 100644 third_party/libsdl/android/sdl_android.gypi (limited to 'third_party/libsdl') diff --git a/third_party/libsdl/android/SDL_config.h b/third_party/libsdl/android/SDL_config.h new file mode 100644 index 0000000000..8d5f1e5f2c --- /dev/null +++ b/third_party/libsdl/android/SDL_config.h @@ -0,0 +1,145 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2015 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _SDL_config_android_h +#define _SDL_config_android_h + +#include "SDL_platform.h" + +/** + * \file SDL_config_android.h + * + * This is a configuration that can be used to build SDL for Android + */ + +#include + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_CLOCK_GETTIME 1 + +#define SIZEOF_VOIDP 4 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_ANDROID 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_ANDROID 1 +#define SDL_HAPTIC_DUMMY 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_ANDROID 1 + +/* Enable OpenGL ES */ +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 + +/* Enable system power support */ +#define SDL_POWER_ANDROID 1 + +/* Enable the filesystem driver */ +#define SDL_FILESYSTEM_ANDROID 1 + +#endif /* _SDL_config_android_h */ diff --git a/third_party/libsdl/android/sdl_android.gypi b/third_party/libsdl/android/sdl_android.gypi new file mode 100644 index 0000000000..4f6365ea2b --- /dev/null +++ b/third_party/libsdl/android/sdl_android.gypi @@ -0,0 +1,127 @@ +# Copyright 2015 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# Linux specific files and settings for SDL + +{ + #TODO what is really necessary here + 'link_settings': { + 'libraries': [ + '-ldl', + '-lGLESv1_CM', + '-lGLESv2', + '-llog', + '-landroid', + ], + }, + 'sources': [ + '<(src_dir)/src/SDL.c', + '<(src_dir)/src/SDL_assert.c', + '<(src_dir)/src/SDL_error.c', + '<(src_dir)/src/SDL_hints.c', + '<(src_dir)/src/SDL_log.c', + '<(src_dir)/src/atomic/SDL_atomic.c', + '<(src_dir)/src/atomic/SDL_spinlock.c', + '<(src_dir)/src/audio/SDL_audio.c', + '<(src_dir)/src/audio/SDL_audiocvt.c', + '<(src_dir)/src/audio/SDL_audiodev.c', + '<(src_dir)/src/audio/SDL_audiotypecvt.c', + '<(src_dir)/src/audio/SDL_mixer.c', + '<(src_dir)/src/audio/SDL_wave.c', + '<(src_dir)/src/audio/dummy/SDL_dummyaudio.c', + '<(src_dir)/src/audio/android/SDL_androidaudio.c', + '<(src_dir)/src/cpuinfo/SDL_cpuinfo.c', + '<(src_dir)/src/dynapi/SDL_dynapi.c', + '<(src_dir)/src/events/SDL_clipboardevents.c', + '<(src_dir)/src/events/SDL_dropevents.c', + '<(src_dir)/src/events/SDL_events.c', + '<(src_dir)/src/events/SDL_gesture.c', + '<(src_dir)/src/events/SDL_keyboard.c', + '<(src_dir)/src/events/SDL_mouse.c', + '<(src_dir)/src/events/SDL_quit.c', + '<(src_dir)/src/events/SDL_touch.c', + '<(src_dir)/src/events/SDL_windowevents.c', + '<(src_dir)/src/file/SDL_rwops.c', + '<(src_dir)/src/haptic/SDL_haptic.c', + '<(src_dir)/src/joystick/SDL_gamecontroller.c', + '<(src_dir)/src/joystick/SDL_joystick.c', + '<(src_dir)/src/joystick/android/SDL_sysjoystick.c', + '<(src_dir)/src/power/SDL_power.c', + '<(src_dir)/src/power/android/SDL_syspower.c', + '<(src_dir)/src/loadso/dlopen/SDL_sysloadso.c', + '<(src_dir)/src/render/SDL_d3dmath.c', + '<(src_dir)/src/render/SDL_render.c', + '<(src_dir)/src/render/SDL_yuv_mmx.c', + '<(src_dir)/src/render/SDL_yuv_sw.c', + '<(src_dir)/src/render/direct3d/SDL_render_d3d.c', + '<(src_dir)/src/render/direct3d11/SDL_render_d3d11.c', + '<(src_dir)/src/render/opengl/SDL_render_gl.c', + '<(src_dir)/src/render/opengl/SDL_shaders_gl.c', + '<(src_dir)/src/render/opengles/SDL_render_gles.c', + '<(src_dir)/src/render/opengles2/SDL_render_gles2.c', + '<(src_dir)/src/render/opengles2/SDL_shaders_gles2.c', + '<(src_dir)/src/render/psp/SDL_render_psp.c', + '<(src_dir)/src/render/software/SDL_blendfillrect.c', + '<(src_dir)/src/render/software/SDL_blendline.c', + '<(src_dir)/src/render/software/SDL_blendpoint.c', + '<(src_dir)/src/render/software/SDL_drawline.c', + '<(src_dir)/src/render/software/SDL_drawpoint.c', + '<(src_dir)/src/render/software/SDL_render_sw.c', + '<(src_dir)/src/render/software/SDL_rotate.c', + '<(src_dir)/src/stdlib/SDL_getenv.c', + '<(src_dir)/src/stdlib/SDL_iconv.c', + '<(src_dir)/src/stdlib/SDL_malloc.c', + '<(src_dir)/src/stdlib/SDL_qsort.c', + '<(src_dir)/src/stdlib/SDL_stdlib.c', + '<(src_dir)/src/stdlib/SDL_string.c', + '<(src_dir)/src/thread/SDL_thread.c', + '<(src_dir)/src/timer/SDL_timer.c', + '<(src_dir)/src/video/SDL_RLEaccel.c', + '<(src_dir)/src/video/SDL_blit.c', + '<(src_dir)/src/video/SDL_blit_0.c', + '<(src_dir)/src/video/SDL_blit_1.c', + '<(src_dir)/src/video/SDL_blit_A.c', + '<(src_dir)/src/video/SDL_blit_N.c', + '<(src_dir)/src/video/SDL_blit_auto.c', + '<(src_dir)/src/video/SDL_blit_copy.c', + '<(src_dir)/src/video/SDL_blit_slow.c', + '<(src_dir)/src/video/SDL_bmp.c', + '<(src_dir)/src/video/SDL_clipboard.c', + '<(src_dir)/src/video/SDL_egl.c', + '<(src_dir)/src/video/SDL_fillrect.c', + '<(src_dir)/src/video/SDL_pixels.c', + '<(src_dir)/src/video/SDL_rect.c', + '<(src_dir)/src/video/SDL_shape.c', + '<(src_dir)/src/video/SDL_stretch.c', + '<(src_dir)/src/video/SDL_surface.c', + '<(src_dir)/src/video/SDL_video.c', + '<(src_dir)/src/video/android/SDL_androidgl.c', + '<(src_dir)/src/video/android/SDL_androidkeyboard.c', + '<(src_dir)/src/video/android/SDL_androidwindow.c', + '<(src_dir)/src/video/android/SDL_androidmouse.c', + '<(src_dir)/src/video/android/SDL_androidvideo.c', + '<(src_dir)/src/video/android/SDL_androidclipboard.c', + '<(src_dir)/src/video/android/SDL_androidtouch.c', + '<(src_dir)/src/video/android/SDL_androidevents.c', + '<(src_dir)/src/video/android/SDL_androidmessagebox.c', + '<(src_dir)/src/thread/pthread/SDL_systhread.c', + '<(src_dir)/src/thread/pthread/SDL_syssem.c', + '<(src_dir)/src/thread/pthread/SDL_sysmutex.c', + '<(src_dir)/src/thread/pthread/SDL_syscond.c', + '<(src_dir)/src/thread/pthread/SDL_systls.c', + '<(src_dir)/src/filesystem/android/SDL_sysfilesystem.c', + '<(src_dir)/src/timer/unix/SDL_systimer.c', + '<(src_dir)/src/core/android/SDL_android.c', + '<(src_dir)/src/haptic/dummy/SDL_syshaptic.c', + '<(src_dir)/src/main/android/SDL_android_main.c', + ], + 'defines': [ + 'GL_GLEXT_PROTOTYPES', + ], + 'cflags': [ + '-fPIC', + '-O3', + '-fvisibility=hidden', + ], +} diff --git a/third_party/libsdl/sdl.gypi b/third_party/libsdl/sdl.gypi index 75c59af2fd..8634fc2a2d 100644 --- a/third_party/libsdl/sdl.gypi +++ b/third_party/libsdl/sdl.gypi @@ -16,6 +16,7 @@ 'direct_dependent_settings': { 'include_dirs': [ '<(src_dir)/include', + '<(src_dir)/src', ] }, 'cflags': [ @@ -28,6 +29,11 @@ 'linux/sdl_linux.gypi', ] }], + ['skia_os == "android"', { + 'includes': [ + 'android/sdl_android.gypi', + ] + }], ], }, ], -- cgit v1.2.3