SDL2.lua (10613B)
1-- Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> 2-- 3-- This software is provided 'as-is', without any express or implied 4-- warranty. In no event will the authors be held liable for any damages 5-- arising from the use of this software. 6-- 7-- Permission is granted to anyone to use this software for any purpose, 8-- including commercial applications, and to alter it and redistribute it 9-- freely. 10-- 11-- Meta-build system using premake created and maintained by 12-- Benjamin Henning <b.henning@digipen.edu> 13 14--[[ 15SDL2.lua 16 17 This file provides the project definition for the entire SDL2 library, on all 18 platforms supported by the meta-build system. That includes Windows, MinGW, 19 Cygwin, Mac OS X, iOS, and Linux. This project is responsible for setting up 20 the source trees and the complicated dependencies required to build the 21 final SDL2 library. In order to simplify this process, the library is split 22 into several different segments. Each segment focuses on a different 23 dependency and series of configurations which are thrown into the generated 24 config header file, used to build this project. 25]] 26 27SDL_project "SDL2" 28 SDL_isos "windows|mingw" -- all other bindings should be a shared library 29 SDL_kind "SharedLib" 30 SDL_isos "macosx|ios" -- macosx employs a static linking 31 SDL_kind "StaticLib" 32 -- the way premake generates project dependencies and how that affects linkage 33 -- makes it difficult to use shared libraries on Linux. Cygwin has issues 34 -- binding to GetProcAddress, so a static library is an easy fix. 35 SDL_isos "linux|cygwin" 36 SDL_kind "StaticLib" 37 38 SDL_language "C++" 39 SDL_sourcedir "../src" 40 -- primary platforms 41 SDL_isos "ios" 42 SDL_platforms { "iOS" } 43 SDL_isnotos "ios" 44 SDL_platforms { "native" } 45 -- additional platforms 46 SDL_isos "macosx" 47 SDL_platforms { "universal" } 48 SDL_isos "windows|mingw" 49 SDL_defines { "_WINDOWS" } 50 51 -- Following is the dependency tree for SDL2 52 -- (no SDL_os call means platform-independent) 53 54 -- The core and minimal of the SDL2 library. This will not quite build 55 -- standalone, but it's doable with a bit of tweaking to build this using the 56 -- minimal configuration header. This is a good start to adding SDL support to 57 -- new platforms. 58 SDL_config 59 { 60 ["SDL_AUDIO_DRIVER_DISK"] = 1, 61 ["SDL_AUDIO_DRIVER_DUMMY"] = 1, 62 ["SDL_VIDEO_DRIVER_DUMMY"] = 1 63 } 64 SDL_paths 65 { 66 "/", 67 "/atomic/", 68 "/audio/", 69 "/audio/disk/", 70 "/audio/dummy/", 71 "/cpuinfo/", 72 "/dynapi/", 73 "/events/", 74 "/file/", 75 "/haptic/", 76 "/joystick/", 77 "/power/", 78 "/render/", 79 "/render/software/", 80 "/stdlib/", 81 "/thread/", 82 "/timer/", 83 "/video/", 84 "/video/dummy/" 85 } 86 87 -- SDL2 on Windows 88 SDL_dependency "windows" 89 SDL_os "windows|mingw" 90 SDL_links { "imm32", "oleaut32", "winmm", "version" } 91 -- these are the links that Visual Studio includes by default 92 SDL_links { "kernel32", "user32", "gdi32", "winspool", 93 "comdlg32", "advapi32", "shell32", "ole32", 94 "oleaut32", "uuid", "odbc32", "odbccp32" } 95 SDL_config 96 { 97 ["SDL_LOADSO_WINDOWS"] = 1, 98 ["SDL_THREAD_WINDOWS"] = 1, 99 ["SDL_TIMER_WINDOWS"] = 1, 100 ["SDL_VIDEO_DRIVER_WINDOWS"] = 1, 101 ["SDL_POWER_WINDOWS"] = 1, 102 ["SDL_AUDIO_DRIVER_WINMM"] = 1, 103 ["SDL_FILESYSTEM_WINDOWS"] = 1 104 } 105 SDL_paths 106 { 107 "/audio/winmm/", 108 "/core/windows/", 109 "/libm/", 110 "/loadso/windows/", 111 "/power/windows/", 112 "/thread/windows/", 113 "/timer/windows/", 114 "/video/windows/", 115 "/filesystem/windows/" 116 } 117 SDL_files 118 { 119 -- these files have to be specified uniquely to avoid double 120 -- and incorrect linking 121 "/thread/generic/SDL_syscond.c", 122 "/thread/generic/SDL_sysmutex_c.h" 123 } 124 125 -- DirectX dependency 126 SDL_dependency "directx" 127 SDL_os "windows|mingw" 128 SDL_depfunc "DirectX" 129 SDL_config 130 { 131 ["SDL_AUDIO_DRIVER_DSOUND"] = 1, 132 ["SDL_AUDIO_DRIVER_XAUDIO2"] = 1, 133 ["SDL_JOYSTICK_DINPUT"] = 1, 134 ["SDL_HAPTIC_DINPUT"] = 1, 135 ["SDL_VIDEO_RENDER_D3D"] = 1 136 } 137 SDL_paths 138 { 139 "/audio/directsound/", 140 "/audio/xaudio2/", 141 "/render/direct3d/", 142 -- these two depend on Xinput 143 "/haptic/windows/", 144 "/joystick/windows/", 145 } 146 -- in case DirectX was not found 147 SDL_dependency "notdirectx" 148 SDL_os "windows|mingw" 149 SDL_notdepfunc "DirectX" 150 SDL_config 151 { 152 -- enable dummy systems (same as disabling them) 153 ["SDL_HAPTIC_DUMMY"] = 1, 154 ["SDL_JOYSTICK_DUMMY"] = 1 155 } 156 SDL_paths 157 { 158 -- since we don't have Xinput 159 "/haptic/dummy/", 160 "/joystick/dummy/", 161 } 162 163 -- OpenGL dependency 164 SDL_dependency "opengl" 165 SDL_depfunc "OpenGL" 166 SDL_config 167 { 168 ["SDL_VIDEO_OPENGL"] = 1, 169 ["SDL_VIDEO_RENDER_OGL"] = 1 170 } 171 SDL_paths { "/render/opengl/" } 172 -- WGL dependency for OpenGL on Windows 173 SDL_dependency "opengl-windows" 174 SDL_os "windows|mingw" 175 SDL_depfunc "OpenGL" 176 SDL_config { ["SDL_VIDEO_OPENGL_WGL"] = 1 } 177 -- GLX dependency for OpenGL on Linux 178 SDL_dependency "opengl-linux" 179 SDL_os "linux" 180 SDL_depfunc "OpenGL" 181 SDL_config { ["SDL_VIDEO_OPENGL_GLX"] = 1 } 182 183 -- SDL2 on Mac OS X 184 SDL_dependency "macosx" 185 SDL_os "macosx" 186 SDL_config 187 { 188 ["SDL_AUDIO_DRIVER_COREAUDIO"] = 1, 189 ["SDL_JOYSTICK_IOKIT"] = 1, 190 ["SDL_HAPTIC_IOKIT"] = 1, 191 ["SDL_LOADSO_DLOPEN"] = 1, 192 ["SDL_THREAD_PTHREAD"] = 1, 193 ["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1, 194 ["SDL_TIMER_UNIX"] = 1, 195 ["SDL_VIDEO_DRIVER_COCOA"] = 1, 196 ["SDL_POWER_MACOSX"] = 1, 197 ["SDL_FILESYSTEM_COCOA"] = 1 198 } 199 SDL_paths 200 { 201 "/audio/coreaudio/", 202 "/file/cocoa/", 203 "/haptic/darwin/", 204 "/joystick/darwin/", 205 "/loadso/dlopen/", 206 "/power/macosx/", 207 "/render/opengl/", 208 "/thread/pthread/", 209 "/timer/unix/", 210 "/video/cocoa/", 211 "/video/x11/", 212 "/filesystem/cocoa/" 213 } 214 SDL_links 215 { 216 "CoreVideo.framework", 217 "AudioToolbox.framework", 218 "AudioUnit.framework", 219 "Cocoa.framework", 220 "CoreAudio.framework", 221 "IOKit.framework", 222 "Carbon.framework", 223 "ForceFeedback.framework", 224 "CoreFoundation.framework" 225 } 226 227 -- Linux dependency: DLOpen 228 SDL_dependency "linux-dlopen" 229 SDL_os "linux" 230 SDL_depfunc "DLOpen" 231 SDL_paths { "/loadso/dlopen/" } 232 SDL_config { ["SDL_LOADSO_DLOPEN"] = 1 } 233 -- Linux dependency: ALSA 234 SDL_dependency "linux-alsa" 235 SDL_os "linux" 236 SDL_depfunc "ALSA" 237 SDL_paths { "/audio/alsa/" } 238 SDL_config 239 { 240 ["SDL_AUDIO_DRIVER_ALSA"] = 1, 241 ["SDL_AUDIO_DRIVER_ALSA_DYNAMIC"] = '"libasound.so"' 242 } 243 -- Linux dependency: PulseAudio 244 SDL_dependency "linux-pulseaudio" 245 SDL_os "linux" 246 SDL_depfunc "PulseAudio" 247 SDL_paths { "/audio/pulseaudio/" } 248 SDL_config 249 { 250 ["SDL_AUDIO_DRIVER_PULSEAUDIO"] = 1, 251 ["SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC"] = '"libpulse-simple.so"' 252 } 253 -- Linux dependency: ESD 254 SDL_dependency "linux-esd" 255 SDL_os "linux" 256 SDL_depfunc "ESD" 257 SDL_paths { "/audio/esd/" } 258 SDL_config 259 { 260 ["SDL_AUDIO_DRIVER_ESD"] = 1, 261 ["SDL_AUDIO_DRIVER_ESD_DYNAMIC"] = '"libesd.so"' 262 } 263 -- Linux dependency: NAS 264 SDL_dependency "linux-nas" 265 SDL_os "linux" 266 SDL_depfunc "NAS" 267 SDL_paths { "/audio/nas/" } 268 SDL_config 269 { 270 ["SDL_AUDIO_DRIVER_NAS"] = 1, 271 ["SDL_AUDIO_DRIVER_NAS_DYNAMIC"] = '"libaudio.so"' 272 } 273 -- Linux dependency: OSS 274 SDL_dependency "linux-oss" 275 SDL_os "linux" 276 SDL_depfunc "OSS" 277 SDL_paths { "/audio/dsp/" } 278 SDL_config { ["SDL_AUDIO_DRIVER_OSS"] = 1 } 279 -- Linux dependency: X11 280 SDL_dependency "linux-x11" 281 SDL_os "linux" 282 SDL_depfunc "X11" 283 SDL_paths { "/video/x11/" } 284 SDL_config 285 { 286 ["SDL_VIDEO_DRIVER_X11"] = 1, 287 ["SDL_VIDEO_DRIVER_X11_DYNAMIC"] = '"libX11.so"', 288 ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT"] = '"libXext.so"', 289 ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR"] = '"libXcursor.so"', 290 ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA"] = '"libXinerama.so"', 291 ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2"] = '"libXi.so"', 292 ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR"] = '"libXrandr.so"', 293 ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS"] = '"libXss.so"', 294 ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE"] = '"libXxf86vm.so"', 295 ["SDL_VIDEO_DRIVER_X11_XCURSOR"] = 1, 296 ["SDL_VIDEO_DRIVER_X11_XINERAMA"] = 1, 297 ["SDL_VIDEO_DRIVER_X11_XINPUT2"] = 1, 298 ["SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH"] = 1, 299 ["SDL_VIDEO_DRIVER_X11_XRANDR"] = 1, 300 ["SDL_VIDEO_DRIVER_X11_XSCRNSAVER"] = 1, 301 ["SDL_VIDEO_DRIVER_X11_XSHAPE"] = 1, 302 ["SDL_VIDEO_DRIVER_X11_XVIDMODE"] = 1, 303 ["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1, 304 ["SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY"] = 1, 305 ["SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM"] = 1 306 } 307 -- SDL2 on Linux 308 SDL_dependency "linux" 309 SDL_os "linux" 310 SDL_depfunc "DBus" 311 SDL_config 312 { 313 ["SDL_INPUT_LINUXEV"] = 1, 314 ["SDL_JOYSTICK_LINUX"] = 1, 315 ["SDL_HAPTIC_LINUX"] = 1, 316 ["SDL_THREAD_PTHREAD"] = 1, 317 ["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1, 318 ["SDL_TIMER_UNIX"] = 1, 319 ["SDL_POWER_LINUX"] = 1, 320 ["SDL_FILESYSTEM_UNIX"] = 1, 321 } 322 SDL_paths 323 { 324 "/haptic/linux/", 325 "/joystick/linux/", 326 "/power/linux/", 327 "/thread/pthread/", 328 "/timer/unix/", 329 "/filesystem/unix/" 330 } 331 SDL_links 332 { 333 "m", 334 "pthread", 335 "rt" 336 } 337 338 -- SDL2 on Cygwin (not quite working yet) 339 SDL_dependency "cygwin" 340 SDL_os "cygwin" 341 SDL_config 342 { 343 ['SDL_JOYSTICK_DISABLED'] = 1, 344 ['SDL_HAPTIC_DISABLED'] = 1, 345 ['SDL_LOADSO_DLOPEN'] = 1, 346 ['SDL_THREAD_PTHREAD'] = 1, 347 ['SDL_THREAD_PTHREAD_RECURSIVE_MUTEX'] = 1, 348 ['SDL_TIMER_UNIX'] = 1, 349 ['SDL_FILESYSTEM_UNIX'] = 1, 350 ['SDL_POWER_LINUX'] = 1 351 } 352 SDL_paths 353 { 354 "/loadso/dlopen/", 355 "/power/linux/", 356 "/render/opengl/", 357 "/thread/pthread/", 358 "/timer/unix/", 359 "/filesystem/unix/", 360 "/libm/" 361 } 362 363 -- SDL2 on iOS 364 SDL_dependency "iphoneos" 365 SDL_os "ios" 366 SDL_config 367 { 368 ["SDL_AUDIO_DRIVER_COREAUDIO"] = 1, 369 ["SDL_JOYSTICK_DISABLED"] = 0, 370 ["SDL_HAPTIC_DISABLED"] = 1, 371 ["SDL_LOADSO_DISABLED"] = 1, 372 ["SDL_THREAD_PTHREAD"] = 1, 373 ["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1, 374 ["SDL_TIMER_UNIX"] = 1, 375 ["SDL_VIDEO_DRIVER_UIKIT"] = 1, 376 ["SDL_VIDEO_OPENGL_ES"] = 1, 377 ["SDL_VIDEO_RENDER_OGL_ES"] = 1, 378 ["SDL_VIDEO_RENDER_OGL_ES2"] = 1, 379 ["SDL_POWER_UIKIT"] = 1, 380 ["SDL_IPHONE_KEYBOARD"] = 1, 381 ["SDL_FILESYSTEM_COCOA"] = 1 382 } 383 SDL_paths 384 { 385 "/audio/coreaudio/", 386 "/file/cocoa/", 387 "/joystick/iphoneos/", 388 "/loadso/dlopen/", 389 "/power/uikit/", 390 "/render/opengles/", 391 "/render/opengles2/", 392 "/thread/pthread/", 393 "/timer/unix/", 394 "/video/uikit/", 395 "/filesystem/cocoa/" 396 } 397 SDL_links 398 { 399 "$(SDKROOT)/AudioToolbox.framework", 400 "$(SDKROOT)/QuartzCore.framework", 401 "$(SDKROOT)/OpenGLES.framework", 402 "$(SDKROOT)/CoreGraphics.framework", 403 "$(SDKROOT)/UIKit.framework", 404 "$(SDKROOT)/Foundation.framework", 405 "$(SDKROOT)/CoreAudio.framework", 406 "$(SDKROOT)/CoreMotion.framework" 407 }