1# Copyright 2016 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6declare_args() { 7} 8 9import("../third_party.gni") 10 11third_party("libsdl") { 12 public_include_dirs = [ "../externals/sdl/include" ] 13 14 include_dirs = [ "." ] 15 sources = [ 16 "../externals/sdl/src/SDL.c", 17 "../externals/sdl/src/SDL_assert.c", 18 "../externals/sdl/src/SDL_error.c", 19 "../externals/sdl/src/SDL_hints.c", 20 "../externals/sdl/src/SDL_log.c", 21 "../externals/sdl/src/atomic/SDL_atomic.c", 22 "../externals/sdl/src/atomic/SDL_spinlock.c", 23 "../externals/sdl/src/audio/SDL_audio.c", 24 "../externals/sdl/src/audio/SDL_audiocvt.c", 25 "../externals/sdl/src/audio/SDL_audiodev.c", 26 "../externals/sdl/src/audio/SDL_audiotypecvt.c", 27 "../externals/sdl/src/audio/SDL_mixer.c", 28 "../externals/sdl/src/audio/SDL_wave.c", 29 "../externals/sdl/src/cpuinfo/SDL_cpuinfo.c", 30 "../externals/sdl/src/dynapi/SDL_dynapi.c", 31 "../externals/sdl/src/events/SDL_clipboardevents.c", 32 "../externals/sdl/src/events/SDL_dropevents.c", 33 "../externals/sdl/src/events/SDL_events.c", 34 "../externals/sdl/src/events/SDL_gesture.c", 35 "../externals/sdl/src/events/SDL_keyboard.c", 36 "../externals/sdl/src/events/SDL_mouse.c", 37 "../externals/sdl/src/events/SDL_quit.c", 38 "../externals/sdl/src/events/SDL_touch.c", 39 "../externals/sdl/src/events/SDL_windowevents.c", 40 "../externals/sdl/src/file/SDL_rwops.c", 41 "../externals/sdl/src/haptic/SDL_haptic.c", 42 "../externals/sdl/src/haptic/dummy/SDL_syshaptic.c", 43 "../externals/sdl/src/joystick/SDL_gamecontroller.c", 44 "../externals/sdl/src/joystick/SDL_joystick.c", 45 "../externals/sdl/src/joystick/dummy/SDL_sysjoystick.c", 46 "../externals/sdl/src/power/SDL_power.c", 47 "../externals/sdl/src/render/SDL_render.c", 48 "../externals/sdl/src/render/SDL_yuv_sw.c", 49 "../externals/sdl/src/render/software/SDL_blendfillrect.c", 50 "../externals/sdl/src/render/software/SDL_blendline.c", 51 "../externals/sdl/src/render/software/SDL_blendpoint.c", 52 "../externals/sdl/src/render/software/SDL_drawline.c", 53 "../externals/sdl/src/render/software/SDL_drawpoint.c", 54 "../externals/sdl/src/render/software/SDL_render_sw.c", 55 "../externals/sdl/src/render/software/SDL_rotate.c", 56 "../externals/sdl/src/stdlib/SDL_getenv.c", 57 "../externals/sdl/src/stdlib/SDL_iconv.c", 58 "../externals/sdl/src/stdlib/SDL_malloc.c", 59 "../externals/sdl/src/stdlib/SDL_qsort.c", 60 "../externals/sdl/src/stdlib/SDL_stdlib.c", 61 "../externals/sdl/src/stdlib/SDL_string.c", 62 "../externals/sdl/src/thread/SDL_thread.c", 63 "../externals/sdl/src/timer/SDL_timer.c", 64 "../externals/sdl/src/video/SDL_RLEaccel.c", 65 "../externals/sdl/src/video/SDL_blit.c", 66 "../externals/sdl/src/video/SDL_blit_0.c", 67 "../externals/sdl/src/video/SDL_blit_1.c", 68 "../externals/sdl/src/video/SDL_blit_A.c", 69 "../externals/sdl/src/video/SDL_blit_N.c", 70 "../externals/sdl/src/video/SDL_blit_auto.c", 71 "../externals/sdl/src/video/SDL_blit_copy.c", 72 "../externals/sdl/src/video/SDL_blit_slow.c", 73 "../externals/sdl/src/video/SDL_bmp.c", 74 "../externals/sdl/src/video/SDL_clipboard.c", 75 "../externals/sdl/src/video/SDL_egl.c", 76 "../externals/sdl/src/video/SDL_fillrect.c", 77 "../externals/sdl/src/video/SDL_pixels.c", 78 "../externals/sdl/src/video/SDL_rect.c", 79 "../externals/sdl/src/video/SDL_shape.c", 80 "../externals/sdl/src/video/SDL_stretch.c", 81 "../externals/sdl/src/video/SDL_surface.c", 82 "../externals/sdl/src/video/SDL_video.c", 83 ] 84 defines = [ 85 "HAVE_ACOS", 86 "HAVE_ASIN", 87 "HAVE_ATAN", 88 "HAVE_ATAN2", 89 "HAVE_CEIL", 90 "HAVE_COPYSIGN", 91 "HAVE_COS", 92 "HAVE_COSF", 93 "HAVE_FABS", 94 "HAVE_FLOOR", 95 "HAVE_LOG", 96 "HAVE_POW", 97 "HAVE_SCALBN", 98 "HAVE_SIN", 99 "HAVE_SINF", 100 "HAVE_SQRT", 101 "HAVE_SQRTF", 102 "HAVE_TAN", 103 "HAVE_TANF", 104 "SDL_HAPTIC_DISABLED=1", 105 "SDL_JOYSTICK_DISABLED=1", 106 "USING_PREMAKE_CONFIG_H", 107 ] 108 libs = [] 109 110 if (!is_win) { 111 defines += [ 112 "SDL_LOADSO_DLOPEN=1", 113 "SDL_THREAD_PTHREAD=1", 114 "SDL_THREAD_PTHREAD_RECURSIVE_MUTEX=1", 115 "SDL_TIMER_UNIX=1", 116 ] 117 sources += [ 118 "../externals/sdl/src/loadso/dlopen/SDL_sysloadso.c", 119 "../externals/sdl/src/thread/pthread/SDL_syscond.c", 120 "../externals/sdl/src/thread/pthread/SDL_sysmutex.c", 121 "../externals/sdl/src/thread/pthread/SDL_syssem.c", 122 "../externals/sdl/src/thread/pthread/SDL_systhread.c", 123 "../externals/sdl/src/thread/pthread/SDL_systls.c", 124 "../externals/sdl/src/timer/unix/SDL_systimer.c", 125 ] 126 } 127 128 if (is_linux) { 129 sources += [ 130 "../externals/sdl/src/filesystem/unix/SDL_sysfilesystem.c", 131 "../externals/sdl/src/render/opengl/SDL_render_gl.c", 132 "../externals/sdl/src/render/opengl/SDL_shaders_gl.c", 133 "../externals/sdl/src/video/x11/SDL_x11clipboard.c", 134 "../externals/sdl/src/video/x11/SDL_x11dyn.c", 135 "../externals/sdl/src/video/x11/SDL_x11events.c", 136 "../externals/sdl/src/video/x11/SDL_x11framebuffer.c", 137 "../externals/sdl/src/video/x11/SDL_x11keyboard.c", 138 "../externals/sdl/src/video/x11/SDL_x11messagebox.c", 139 "../externals/sdl/src/video/x11/SDL_x11modes.c", 140 "../externals/sdl/src/video/x11/SDL_x11mouse.c", 141 "../externals/sdl/src/video/x11/SDL_x11opengl.c", 142 "../externals/sdl/src/video/x11/SDL_x11opengles.c", 143 "../externals/sdl/src/video/x11/SDL_x11shape.c", 144 "../externals/sdl/src/video/x11/SDL_x11touch.c", 145 "../externals/sdl/src/video/x11/SDL_x11video.c", 146 "../externals/sdl/src/video/x11/SDL_x11window.c", 147 "../externals/sdl/src/video/x11/SDL_x11xinput2.c", 148 "../externals/sdl/src/video/x11/imKStoUCS.c", 149 ] 150 defines += [ 151 "SDL_FILESYSTEM_UNIX=1", 152 "SDL_VIDEO_DRIVER_X11=1", 153 "SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS=1", 154 "SDL_VIDEO_OPENGL=1", 155 "SDL_VIDEO_RENDER_OGL=1", 156 "SDL_VIDEO_OPENGL_GLX=1", 157 ] 158 libs += [ 159 "GL", 160 "X11", 161 "Xext", 162 ] 163 } 164 165 if (is_mac) { 166 sources += [ 167 "../externals/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m", 168 "../externals/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m", 169 "../externals/sdl/src/render/opengl/SDL_render_gl.c", 170 "../externals/sdl/src/render/opengl/SDL_shaders_gl.c", 171 "../externals/sdl/src/video/cocoa/SDL_cocoaclipboard.m", 172 "../externals/sdl/src/video/cocoa/SDL_cocoaevents.m", 173 "../externals/sdl/src/video/cocoa/SDL_cocoakeyboard.m", 174 "../externals/sdl/src/video/cocoa/SDL_cocoamessagebox.m", 175 "../externals/sdl/src/video/cocoa/SDL_cocoamodes.m", 176 "../externals/sdl/src/video/cocoa/SDL_cocoamouse.m", 177 "../externals/sdl/src/video/cocoa/SDL_cocoamousetap.m", 178 "../externals/sdl/src/video/cocoa/SDL_cocoaopengl.m", 179 "../externals/sdl/src/video/cocoa/SDL_cocoashape.m", 180 "../externals/sdl/src/video/cocoa/SDL_cocoavideo.m", 181 "../externals/sdl/src/video/cocoa/SDL_cocoawindow.m", 182 ] 183 defines += [ 184 "SDL_FILESYSTEM_COCOA=1", 185 "SDL_VIDEO_DRIVER_COCOA=1", 186 "SDL_VIDEO_OPENGL=1", 187 "SDL_VIDEO_RENDER_OGL=1", 188 "SDL_VIDEO_OPENGL_CGL=1", 189 ] 190 frameworks = [ 191 "Carbon.framework", 192 "Cocoa.framework", 193 "Foundation.framework", 194 "IOKit.framework", 195 "QuartzCore.framework", 196 ] 197 } 198 199 if (is_ios) { 200 sources += [ 201 "../externals/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m", 202 "../externals/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m", 203 "../externals/sdl/src/render/opengles/SDL_render_gles.c", 204 "../externals/sdl/src/render/opengles2/SDL_render_gles2.c", 205 "../externals/sdl/src/render/opengles2/SDL_shaders_gles2.c", 206 "../externals/sdl/src/video/uikit/SDL_uikitappdelegate.m", 207 "../externals/sdl/src/video/uikit/SDL_uikitclipboard.m", 208 "../externals/sdl/src/video/uikit/SDL_uikitevents.m", 209 "../externals/sdl/src/video/uikit/SDL_uikitmessagebox.m", 210 "../externals/sdl/src/video/uikit/SDL_uikitmodes.m", 211 "../externals/sdl/src/video/uikit/SDL_uikitopengles.m", 212 "../externals/sdl/src/video/uikit/SDL_uikitopenglview.m", 213 "../externals/sdl/src/video/uikit/SDL_uikitvideo.m", 214 "../externals/sdl/src/video/uikit/SDL_uikitview.m", 215 "../externals/sdl/src/video/uikit/SDL_uikitviewcontroller.m", 216 "../externals/sdl/src/video/uikit/SDL_uikitwindow.m", 217 ] 218 cflags_objc = [ "-fobjc-arc" ] 219 defines += [ 220 "TARGET_OS_IPHONE=1", 221 "__IPHONE_OS__=1", 222 "HAVE_MATH_H=1", 223 "HAVE_GCC_ATOMICS=1", 224 "SDL_FILESYSTEM_COCOA=1", 225 "SDL_VIDEO_DRIVER_UIKIT=1", 226 "SDL_VIDEO_RENDER_OGL_ES=1", 227 "SDL_VIDEO_RENDER_OGL_ES2=1", 228 "SDL_VIDEO_OPENGL_ES=1", 229 "SDL_VIDEO_OPENGL_ES2=1", 230 ] 231 frameworks = [ 232 "Foundation.framework", 233 "QuartzCore.framework", 234 "UIKit.framework", 235 ] 236 } 237} 238