premake/projects/SDL2.lua
changeset 7925 f090a47eb7f7
child 8094 9efaae827924
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/premake/projects/SDL2.lua	Sun Nov 10 00:38:37 2013 -0500
     1.3 @@ -0,0 +1,404 @@
     1.4 +-- Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
     1.5 +--
     1.6 +-- This software is provided 'as-is', without any express or implied
     1.7 +-- warranty.  In no event will the authors be held liable for any damages
     1.8 +-- arising from the use of this software.
     1.9 +--
    1.10 +-- Permission is granted to anyone to use this software for any purpose,
    1.11 +-- including commercial applications, and to alter it and redistribute it
    1.12 +-- freely.
    1.13 +--
    1.14 +-- Meta-build system using premake created and maintained by
    1.15 +-- Benjamin Henning <b.henning@digipen.edu>
    1.16 +
    1.17 +--[[
    1.18 +SDL2.lua
    1.19 +
    1.20 +	This file provides the project definition for the entire SDL2 library, on all
    1.21 +	platforms supported by the meta-build system. That includes Windows, MinGW,
    1.22 +	Cygwin, Mac OS X, iOS, and Linux. This project is responsible for setting up
    1.23 +	the source trees and the complicated dependencies required to build the
    1.24 +	final SDL2 library. In order to simplify this process, the library is split
    1.25 +	into several different segments. Each segment focuses on a different
    1.26 +	dependency and series of configurations which are thrown into the generated
    1.27 +	config header file, used to build this project.
    1.28 +]]
    1.29 +
    1.30 +SDL_project "SDL2"
    1.31 +	 SDL_isos "windows|mingw" -- all other bindings should be a shared library
    1.32 +		SDL_kind "SharedLib"
    1.33 +	SDL_isos "macosx|ios" -- macosx employs a static linking
    1.34 +		SDL_kind "StaticLib"
    1.35 +	-- the way premake generates project dependencies and how that affects linkage
    1.36 +	-- makes it difficult to use shared libraries on Linux. Cygwin has issues
    1.37 +	-- binding to GetProcAddress, so a static library is an easy fix.
    1.38 +	SDL_isos "linux|cygwin"
    1.39 +		SDL_kind "StaticLib"
    1.40 +
    1.41 +	SDL_language "C++"
    1.42 +	SDL_sourcedir "../src"
    1.43 +	-- primary platforms
    1.44 +	SDL_isos "ios"
    1.45 +		SDL_platforms { "iOS" }
    1.46 +	SDL_isnotos "ios"
    1.47 +		SDL_platforms { "native" }
    1.48 +	-- additional platforms
    1.49 +	SDL_isos "macosx"
    1.50 +		SDL_platforms { "universal" }
    1.51 +	SDL_isos "windows|mingw"
    1.52 +		SDL_defines { "_WINDOWS" }
    1.53 +
    1.54 +	-- Following is the dependency tree for SDL2
    1.55 +	-- (no SDL_os call means platform-independent)
    1.56 +
    1.57 +	-- The core and minimal of the SDL2 library. This will not quite build
    1.58 +	-- standalone, but it's doable with a bit of tweaking to build this using the
    1.59 +	-- minimal configuration header. This is a good start to adding SDL support to
    1.60 +	-- new platforms.
    1.61 +	SDL_config
    1.62 +	{
    1.63 +		["SDL_AUDIO_DRIVER_DISK"] = 1,
    1.64 +		["SDL_AUDIO_DRIVER_DUMMY"] = 1,
    1.65 +		["SDL_VIDEO_DRIVER_DUMMY"] = 1
    1.66 +	}
    1.67 +	SDL_paths
    1.68 +	{
    1.69 +		"/",
    1.70 +		"/atomic/",
    1.71 +		"/audio/",
    1.72 +		"/audio/disk/",
    1.73 +		"/audio/dummy/",
    1.74 +		"/cpuinfo/",
    1.75 +		"/events/",
    1.76 +		"/file/",
    1.77 +		"/haptic/",
    1.78 +		"/joystick/",
    1.79 +		"/power/",
    1.80 +		"/render/",
    1.81 +		"/render/software/",
    1.82 +		"/stdlib/",
    1.83 +		"/thread/",
    1.84 +		"/timer/",
    1.85 +		"/video/",
    1.86 +		"/video/dummy/"
    1.87 +	}
    1.88 +
    1.89 +	-- SDL2 on Windows
    1.90 +	SDL_dependency "windows"
    1.91 +		SDL_os "windows|mingw"
    1.92 +		SDL_links { "imm32", "oleaut32", "winmm", "version" }
    1.93 +		-- these are the links that Visual Studio includes by default
    1.94 +		SDL_links { "kernel32", "user32", "gdi32", "winspool",
    1.95 +			"comdlg32", "advapi32", "shell32", "ole32",
    1.96 +			"oleaut32", "uuid", "odbc32", "odbccp32" }
    1.97 +		SDL_config
    1.98 +		{
    1.99 +			["SDL_LOADSO_WINDOWS"] = 1,
   1.100 +			["SDL_THREAD_WINDOWS"] = 1,
   1.101 +			["SDL_TIMER_WINDOWS"] = 1,
   1.102 +			["SDL_VIDEO_DRIVER_WINDOWS"] = 1,
   1.103 +			["SDL_POWER_WINDOWS"] = 1,
   1.104 +			["SDL_AUDIO_DRIVER_WINMM"] = 1,
   1.105 +			["SDL_FILESYSTEM_WINDOWS"] = 1
   1.106 +		}
   1.107 +		SDL_paths
   1.108 +		{
   1.109 +			"/audio/winmm/",
   1.110 +			"/core/windows/",
   1.111 +			"/libm/",
   1.112 +			"/loadso/windows/",
   1.113 +			"/power/windows/",
   1.114 +			"/thread/windows/",
   1.115 +			"/timer/windows/",
   1.116 +			"/video/windows/",
   1.117 +			"/filesystem/windows/"
   1.118 +		}
   1.119 +		SDL_files
   1.120 +		{
   1.121 +			-- these files have to be specified uniquely to avoid double
   1.122 +			-- and incorrect linking
   1.123 +			"/thread/generic/SDL_syscond.c",
   1.124 +			"/thread/generic/SDL_sysmutex_c.h"
   1.125 +		}
   1.126 +
   1.127 +	-- DirectX dependency
   1.128 +	SDL_dependency "directx"
   1.129 +		SDL_os "windows|mingw"
   1.130 +		SDL_depfunc "DirectX"
   1.131 +		SDL_config
   1.132 +		{
   1.133 +			["SDL_AUDIO_DRIVER_DSOUND"] = 1,
   1.134 +			["SDL_AUDIO_DRIVER_XAUDIO2"] = 1,
   1.135 +			["SDL_JOYSTICK_DINPUT"] = 1,
   1.136 +			["SDL_HAPTIC_DINPUT"] = 1,
   1.137 +			["SDL_VIDEO_RENDER_D3D"] = 1
   1.138 +		}
   1.139 +		SDL_paths
   1.140 +		{
   1.141 +			"/audio/directsound/",
   1.142 +			"/audio/xaudio2/",
   1.143 +			"/render/direct3d/",
   1.144 +			-- these two depend on Xinput
   1.145 +			"/haptic/windows/",
   1.146 +			"/joystick/windows/",
   1.147 +		}
   1.148 +	-- in case DirectX was not found
   1.149 +	SDL_dependency "notdirectx"
   1.150 +		SDL_os "windows|mingw"
   1.151 +		SDL_notdepfunc "DirectX"
   1.152 +		SDL_config
   1.153 +		{
   1.154 +			-- enable dummy systems (same as disabling them)
   1.155 +			["SDL_HAPTIC_DUMMY"] = 1,
   1.156 +			["SDL_JOYSTICK_DUMMY"] = 1
   1.157 +		}
   1.158 +		SDL_paths
   1.159 +		{
   1.160 +			-- since we don't have Xinput
   1.161 +			"/haptic/dummy/",
   1.162 +			"/joystick/dummy/",
   1.163 +		}
   1.164 +
   1.165 +	-- OpenGL dependency
   1.166 +	SDL_dependency "opengl"
   1.167 +		SDL_depfunc "OpenGL"
   1.168 +		SDL_config
   1.169 +		{
   1.170 +			["SDL_VIDEO_OPENGL"] = 1,
   1.171 +			["SDL_VIDEO_RENDER_OGL"] = 1
   1.172 +		}
   1.173 +		SDL_paths { "/render/opengl/" }
   1.174 +	-- WGL dependency for OpenGL on Windows
   1.175 +	SDL_dependency "opengl-windows"
   1.176 +		SDL_os "windows|mingw"
   1.177 +		SDL_depfunc "OpenGL"
   1.178 +		SDL_config { ["SDL_VIDEO_OPENGL_WGL"] = 1 }
   1.179 +	-- GLX dependency for OpenGL on Linux
   1.180 +	SDL_dependency "opengl-linux"
   1.181 +		SDL_os "linux"
   1.182 +		SDL_depfunc "OpenGL"
   1.183 +		SDL_config { ["SDL_VIDEO_OPENGL_GLX"] = 1 }
   1.184 +
   1.185 +	-- SDL2 on Mac OS X
   1.186 +	SDL_dependency "macosx"
   1.187 +		SDL_os "macosx"
   1.188 +		SDL_config
   1.189 +		{
   1.190 +			["SDL_AUDIO_DRIVER_COREAUDIO"] = 1,
   1.191 +			["SDL_JOYSTICK_IOKIT"] = 1,
   1.192 +			["SDL_HAPTIC_IOKIT"] = 1,
   1.193 +			["SDL_LOADSO_DLOPEN"] = 1,
   1.194 +			["SDL_THREAD_PTHREAD"] = 1,
   1.195 +			["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1,
   1.196 +			["SDL_TIMER_UNIX"] = 1,
   1.197 +			["SDL_VIDEO_DRIVER_COCOA"] = 1,
   1.198 +			["SDL_POWER_MACOSX"] = 1,
   1.199 +			["SDL_FILESYSTEM_COCOA"] = 1
   1.200 +		}
   1.201 +		SDL_paths
   1.202 +		{
   1.203 +			"/audio/coreaudio/",
   1.204 +			"/file/cocoa/",
   1.205 +			"/haptic/darwin/",
   1.206 +			"/joystick/darwin/",
   1.207 +			"/loadso/dlopen/",
   1.208 +			"/power/macosx/",
   1.209 +			"/render/opengl/",
   1.210 +			"/thread/pthread/",
   1.211 +			"/timer/unix/",
   1.212 +			"/video/cocoa/",
   1.213 +			"/video/x11/",
   1.214 +			"/filesystem/cocoa/"
   1.215 +		}
   1.216 +		SDL_links
   1.217 +		{
   1.218 +			"AudioToolbox.framework",
   1.219 +			"AudioUnit.framework",
   1.220 +			"Cocoa.framework",
   1.221 +			"CoreAudio.framework",
   1.222 +			"IOKit.framework",
   1.223 +			"Carbon.framework",
   1.224 +			"ForceFeedback.framework",
   1.225 +			"CoreFoundation.framework"
   1.226 +		}
   1.227 +
   1.228 +	-- Linux dependency: DLOpen
   1.229 +	SDL_dependency "linux-dlopen"
   1.230 +		SDL_os "linux"
   1.231 +		SDL_depfunc "DLOpen"
   1.232 +		SDL_paths { "/loadso/dlopen/" }
   1.233 +		SDL_config { ["SDL_LOADSO_DLOPEN"] = 1 }
   1.234 +	-- Linux dependency: ALSA
   1.235 +	SDL_dependency "linux-alsa"
   1.236 +		SDL_os "linux"
   1.237 +		SDL_depfunc "ALSA"
   1.238 +		SDL_paths { "/audio/alsa/" }
   1.239 +		SDL_config
   1.240 +		{
   1.241 +			["SDL_AUDIO_DRIVER_ALSA"] = 1,
   1.242 +			["SDL_AUDIO_DRIVER_ALSA_DYNAMIC"] = '"libasound.so"'
   1.243 +		}
   1.244 +	-- Linux dependency: PulseAudio
   1.245 +	SDL_dependency "linux-pulseaudio"
   1.246 +		SDL_os "linux"
   1.247 +		SDL_depfunc "PulseAudio"
   1.248 +		SDL_paths { "/audio/pulseaudio/" }
   1.249 +		SDL_config
   1.250 +		{
   1.251 +			["SDL_AUDIO_DRIVER_PULSEAUDIO"] = 1,
   1.252 +			["SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC"] = '"libpulse-simple.so"'
   1.253 +		}
   1.254 +	-- Linux dependency: ESD
   1.255 +	SDL_dependency "linux-esd"
   1.256 +		SDL_os "linux"
   1.257 +		SDL_depfunc "ESD"
   1.258 +		SDL_paths { "/audio/esd/" }
   1.259 +		SDL_config
   1.260 +		{
   1.261 +			["SDL_AUDIO_DRIVER_ESD"] = 1,
   1.262 +			["SDL_AUDIO_DRIVER_ESD_DYNAMIC"] = '"libesd.so"'
   1.263 +		}
   1.264 +	-- Linux dependency: NAS
   1.265 +	SDL_dependency "linux-nas"
   1.266 +		SDL_os "linux"
   1.267 +		SDL_depfunc "NAS"
   1.268 +		SDL_paths { "/audio/nas/" }
   1.269 +		SDL_config
   1.270 +		{
   1.271 +			["SDL_AUDIO_DRIVER_NAS"] = 1,
   1.272 +			["SDL_AUDIO_DRIVER_NAS_DYNAMIC"] = '"libaudio.so"'
   1.273 +		}
   1.274 +	-- Linux dependency: OSS
   1.275 +	SDL_dependency "linux-oss"
   1.276 +		SDL_os "linux"
   1.277 +		SDL_depfunc "OSS"
   1.278 +		SDL_paths { "/audio/dsp/" }
   1.279 +		SDL_config { ["SDL_AUDIO_DRIVER_OSS"] = 1 }
   1.280 +	-- Linux dependency: X11
   1.281 +	SDL_dependency "linux-x11"
   1.282 +		SDL_os "linux"
   1.283 +		SDL_depfunc "X11"
   1.284 +		SDL_paths { "/video/x11/" }
   1.285 +		SDL_config
   1.286 +		{
   1.287 +			["SDL_VIDEO_DRIVER_X11"] = 1,
   1.288 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC"] = '"libX11.so"',
   1.289 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT"] = '"libXext.so"',
   1.290 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR"] = '"libXcursor.so"',
   1.291 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA"] = '"libXinerama.so"',
   1.292 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2"] = '"libXi.so"',
   1.293 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR"] = '"libXrandr.so"',
   1.294 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS"] = '"libXss.so"',
   1.295 +			["SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE"] = '"libXxf86vm.so"',
   1.296 +			["SDL_VIDEO_DRIVER_X11_XCURSOR"] = 1,
   1.297 +			["SDL_VIDEO_DRIVER_X11_XINERAMA"] = 1,
   1.298 +			["SDL_VIDEO_DRIVER_X11_XINPUT2"] = 1,
   1.299 +			["SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH"] = 1,
   1.300 +			["SDL_VIDEO_DRIVER_X11_XRANDR"] = 1,
   1.301 +			["SDL_VIDEO_DRIVER_X11_XSCRNSAVER"] = 1,
   1.302 +			["SDL_VIDEO_DRIVER_X11_XSHAPE"] = 1,
   1.303 +			["SDL_VIDEO_DRIVER_X11_XVIDMODE"] = 1,
   1.304 +			["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1,
   1.305 +			["SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY"] = 1,
   1.306 +			["SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM"] = 1
   1.307 +		}
   1.308 +	-- SDL2 on Linux
   1.309 +	SDL_dependency "linux"
   1.310 +		SDL_os "linux"
   1.311 +		SDL_depfunc "DBus"
   1.312 +		SDL_config
   1.313 +		{
   1.314 +			["SDL_INPUT_LINUXEV"] = 1,
   1.315 +			["SDL_JOYSTICK_LINUX"] = 1,
   1.316 +			["SDL_HAPTIC_LINUX"] = 1,
   1.317 +			["SDL_THREAD_PTHREAD"] = 1,
   1.318 +			["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1,
   1.319 +			["SDL_TIMER_UNIX"] = 1,
   1.320 +			["SDL_POWER_LINUX"] = 1,
   1.321 +			["SDL_FILESYSTEM_UNIX"] = 1,
   1.322 +		}
   1.323 +		SDL_paths
   1.324 +		{
   1.325 +			"/haptic/linux/",
   1.326 +			"/joystick/linux/",
   1.327 +			"/power/linux/",
   1.328 +			"/thread/pthread/",
   1.329 +			"/timer/unix/",
   1.330 +			"/filesystem/unix/"
   1.331 +		}
   1.332 +		SDL_links
   1.333 +		{
   1.334 +			"m",
   1.335 +			"pthread",
   1.336 +			"rt"
   1.337 +		}
   1.338 +
   1.339 +	-- SDL2 on Cygwin (not quite working yet)
   1.340 +	SDL_dependency "cygwin"
   1.341 +		SDL_os "cygwin"
   1.342 +		SDL_config
   1.343 +		{
   1.344 +			['SDL_JOYSTICK_DISABLED'] = 1,
   1.345 +			['SDL_HAPTIC_DISABLED'] = 1,
   1.346 +			['SDL_LOADSO_DLOPEN'] = 1,
   1.347 +			['SDL_THREAD_PTHREAD'] = 1,
   1.348 +			['SDL_THREAD_PTHREAD_RECURSIVE_MUTEX'] = 1,
   1.349 +			['SDL_TIMER_UNIX'] = 1,
   1.350 +			['SDL_FILESYSTEM_UNIX'] = 1,
   1.351 +			['SDL_POWER_LINUX'] = 1
   1.352 +		}
   1.353 +		SDL_paths
   1.354 +		{
   1.355 +			"/loadso/dlopen/",
   1.356 +			"/power/linux/",
   1.357 +			"/render/opengl/",
   1.358 +			"/thread/pthread/",
   1.359 +			"/timer/unix/",
   1.360 +			"/filesystem/unix/",
   1.361 +			"/libm/"
   1.362 +		}
   1.363 +
   1.364 +	-- SDL2 on iOS
   1.365 +	SDL_dependency "iphoneos"
   1.366 +		SDL_os "ios"
   1.367 +		SDL_config
   1.368 +		{
   1.369 +			["SDL_AUDIO_DRIVER_COREAUDIO"] = 1,
   1.370 +			["SDL_JOYSTICK_DISABLED"] = 0,
   1.371 +			["SDL_HAPTIC_DISABLED"] = 1,
   1.372 +			["SDL_LOADSO_DISABLED"] = 1,
   1.373 +			["SDL_THREAD_PTHREAD"] = 1,
   1.374 +			["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1,
   1.375 +			["SDL_TIMER_UNIX"] = 1,
   1.376 +			["SDL_VIDEO_DRIVER_UIKIT"] = 1,
   1.377 +			["SDL_VIDEO_OPENGL_ES"] = 1,
   1.378 +			["SDL_VIDEO_RENDER_OGL_ES"] = 1,
   1.379 +			["SDL_VIDEO_RENDER_OGL_ES2"] = 1,
   1.380 +			["SDL_POWER_UIKIT"] = 1,
   1.381 +			["SDL_IPHONE_KEYBOARD"] = 1,
   1.382 +			["SDL_FILESYSTEM_COCOA"] = 1
   1.383 +		}
   1.384 +		SDL_paths
   1.385 +		{
   1.386 +			"/audio/coreaudio/",
   1.387 +			"/file/cocoa/",
   1.388 +			"/joystick/iphoneos/",
   1.389 +			"/loadso/dlopen/",
   1.390 +			"/power/uikit/",
   1.391 +			"/render/opengles/",
   1.392 +			"/render/opengles2/",
   1.393 +			"/thread/pthread/",
   1.394 +			"/timer/unix/",
   1.395 +			"/video/uikit/",
   1.396 +			"/filesystem/cocoa/"
   1.397 +		}
   1.398 +		SDL_links
   1.399 +		{
   1.400 +			"$(SDKROOT)/AudioToolbox.framework",
   1.401 +			"$(SDKROOT)/QuartzCore.framework",
   1.402 +			"$(SDKROOT)/OpenGLES.framework",
   1.403 +			"$(SDKROOT)/CoreGraphics.framework",
   1.404 +			"$(SDKROOT)/UIKit.framework",
   1.405 +			"$(SDKROOT)/Foundation.framework",
   1.406 +			"$(SDKROOT)/CoreAudio.framework"
   1.407 +		}
   1.408 \ No newline at end of file