SDL2.lua 10 KB

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