SDL2.lua 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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. 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. "/dynapi/",
  67. "/events/",
  68. "/file/",
  69. "/haptic/",
  70. "/joystick/",
  71. "/power/",
  72. "/render/",
  73. "/render/software/",
  74. "/stdlib/",
  75. "/thread/",
  76. "/timer/",
  77. "/video/",
  78. "/video/dummy/"
  79. }
  80. -- SDL2 on Windows
  81. SDL_dependency "windows"
  82. SDL_os "windows|mingw"
  83. SDL_links { "imm32", "oleaut32", "winmm", "version" }
  84. -- these are the links that Visual Studio includes by default
  85. SDL_links { "kernel32", "user32", "gdi32", "winspool",
  86. "comdlg32", "advapi32", "shell32", "ole32",
  87. "oleaut32", "uuid", "odbc32", "odbccp32" }
  88. SDL_config
  89. {
  90. ["SDL_LOADSO_WINDOWS"] = 1,
  91. ["SDL_THREAD_WINDOWS"] = 1,
  92. ["SDL_TIMER_WINDOWS"] = 1,
  93. ["SDL_VIDEO_DRIVER_WINDOWS"] = 1,
  94. ["SDL_POWER_WINDOWS"] = 1,
  95. ["SDL_AUDIO_DRIVER_WINMM"] = 1,
  96. ["SDL_FILESYSTEM_WINDOWS"] = 1
  97. }
  98. SDL_paths
  99. {
  100. "/audio/winmm/",
  101. "/core/windows/",
  102. "/libm/",
  103. "/loadso/windows/",
  104. "/power/windows/",
  105. "/thread/windows/",
  106. "/timer/windows/",
  107. "/video/windows/",
  108. "/filesystem/windows/"
  109. }
  110. SDL_files
  111. {
  112. -- these files have to be specified uniquely to avoid double
  113. -- and incorrect linking
  114. "/thread/generic/SDL_syscond.c",
  115. "/thread/generic/SDL_sysmutex_c.h"
  116. }
  117. -- DirectX dependency
  118. SDL_dependency "directx"
  119. SDL_os "windows|mingw"
  120. SDL_depfunc "DirectX"
  121. SDL_config
  122. {
  123. ["SDL_AUDIO_DRIVER_DSOUND"] = 1,
  124. ["SDL_AUDIO_DRIVER_XAUDIO2"] = 1,
  125. ["SDL_JOYSTICK_DINPUT"] = 1,
  126. ["SDL_HAPTIC_DINPUT"] = 1,
  127. ["SDL_VIDEO_RENDER_D3D"] = 1
  128. }
  129. SDL_paths
  130. {
  131. "/audio/directsound/",
  132. "/audio/xaudio2/",
  133. "/render/direct3d/",
  134. -- these two depend on Xinput
  135. "/haptic/windows/",
  136. "/joystick/windows/",
  137. }
  138. -- in case DirectX was not found
  139. SDL_dependency "notdirectx"
  140. SDL_os "windows|mingw"
  141. SDL_notdepfunc "DirectX"
  142. SDL_config
  143. {
  144. -- enable dummy systems (same as disabling them)
  145. ["SDL_HAPTIC_DUMMY"] = 1,
  146. ["SDL_JOYSTICK_DUMMY"] = 1
  147. }
  148. SDL_paths
  149. {
  150. -- since we don't have Xinput
  151. "/haptic/dummy/",
  152. "/joystick/dummy/",
  153. }
  154. -- OpenGL dependency
  155. SDL_dependency "opengl"
  156. SDL_depfunc "OpenGL"
  157. SDL_config
  158. {
  159. ["SDL_VIDEO_OPENGL"] = 1,
  160. ["SDL_VIDEO_RENDER_OGL"] = 1
  161. }
  162. SDL_paths { "/render/opengl/" }
  163. -- WGL dependency for OpenGL on Windows
  164. SDL_dependency "opengl-windows"
  165. SDL_os "windows|mingw"
  166. SDL_depfunc "OpenGL"
  167. SDL_config { ["SDL_VIDEO_OPENGL_WGL"] = 1 }
  168. -- GLX dependency for OpenGL on Linux
  169. SDL_dependency "opengl-linux"
  170. SDL_os "linux"
  171. SDL_depfunc "OpenGL"
  172. SDL_config { ["SDL_VIDEO_OPENGL_GLX"] = 1 }
  173. -- SDL2 on Mac OS X
  174. SDL_dependency "macosx"
  175. SDL_os "macosx"
  176. SDL_config
  177. {
  178. ["SDL_AUDIO_DRIVER_COREAUDIO"] = 1,
  179. ["SDL_JOYSTICK_IOKIT"] = 1,
  180. ["SDL_HAPTIC_IOKIT"] = 1,
  181. ["SDL_LOADSO_DLOPEN"] = 1,
  182. ["SDL_THREAD_PTHREAD"] = 1,
  183. ["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1,
  184. ["SDL_TIMER_UNIX"] = 1,
  185. ["SDL_VIDEO_DRIVER_COCOA"] = 1,
  186. ["SDL_POWER_MACOSX"] = 1,
  187. ["SDL_FILESYSTEM_COCOA"] = 1
  188. }
  189. SDL_paths
  190. {
  191. "/audio/coreaudio/",
  192. "/file/cocoa/",
  193. "/haptic/darwin/",
  194. "/joystick/darwin/",
  195. "/loadso/dlopen/",
  196. "/power/macosx/",
  197. "/render/opengl/",
  198. "/thread/pthread/",
  199. "/timer/unix/",
  200. "/video/cocoa/",
  201. "/video/x11/",
  202. "/filesystem/cocoa/"
  203. }
  204. SDL_links
  205. {
  206. "AudioToolbox.framework",
  207. "AudioUnit.framework",
  208. "Cocoa.framework",
  209. "CoreAudio.framework",
  210. "IOKit.framework",
  211. "Carbon.framework",
  212. "ForceFeedback.framework",
  213. "CoreFoundation.framework"
  214. }
  215. -- Linux dependency: DLOpen
  216. SDL_dependency "linux-dlopen"
  217. SDL_os "linux"
  218. SDL_depfunc "DLOpen"
  219. SDL_paths { "/loadso/dlopen/" }
  220. SDL_config { ["SDL_LOADSO_DLOPEN"] = 1 }
  221. -- Linux dependency: ALSA
  222. SDL_dependency "linux-alsa"
  223. SDL_os "linux"
  224. SDL_depfunc "ALSA"
  225. SDL_paths { "/audio/alsa/" }
  226. SDL_config
  227. {
  228. ["SDL_AUDIO_DRIVER_ALSA"] = 1,
  229. ["SDL_AUDIO_DRIVER_ALSA_DYNAMIC"] = '"libasound.so"'
  230. }
  231. -- Linux dependency: PulseAudio
  232. SDL_dependency "linux-pulseaudio"
  233. SDL_os "linux"
  234. SDL_depfunc "PulseAudio"
  235. SDL_paths { "/audio/pulseaudio/" }
  236. SDL_config
  237. {
  238. ["SDL_AUDIO_DRIVER_PULSEAUDIO"] = 1,
  239. ["SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC"] = '"libpulse-simple.so"'
  240. }
  241. -- Linux dependency: ESD
  242. SDL_dependency "linux-esd"
  243. SDL_os "linux"
  244. SDL_depfunc "ESD"
  245. SDL_paths { "/audio/esd/" }
  246. SDL_config
  247. {
  248. ["SDL_AUDIO_DRIVER_ESD"] = 1,
  249. ["SDL_AUDIO_DRIVER_ESD_DYNAMIC"] = '"libesd.so"'
  250. }
  251. -- Linux dependency: NAS
  252. SDL_dependency "linux-nas"
  253. SDL_os "linux"
  254. SDL_depfunc "NAS"
  255. SDL_paths { "/audio/nas/" }
  256. SDL_config
  257. {
  258. ["SDL_AUDIO_DRIVER_NAS"] = 1,
  259. ["SDL_AUDIO_DRIVER_NAS_DYNAMIC"] = '"libaudio.so"'
  260. }
  261. -- Linux dependency: OSS
  262. SDL_dependency "linux-oss"
  263. SDL_os "linux"
  264. SDL_depfunc "OSS"
  265. SDL_paths { "/audio/dsp/" }
  266. SDL_config { ["SDL_AUDIO_DRIVER_OSS"] = 1 }
  267. -- Linux dependency: X11
  268. SDL_dependency "linux-x11"
  269. SDL_os "linux"
  270. SDL_depfunc "X11"
  271. SDL_paths { "/video/x11/" }
  272. SDL_config
  273. {
  274. ["SDL_VIDEO_DRIVER_X11"] = 1,
  275. ["SDL_VIDEO_DRIVER_X11_DYNAMIC"] = '"libX11.so"',
  276. ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT"] = '"libXext.so"',
  277. ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR"] = '"libXcursor.so"',
  278. ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA"] = '"libXinerama.so"',
  279. ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2"] = '"libXi.so"',
  280. ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR"] = '"libXrandr.so"',
  281. ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS"] = '"libXss.so"',
  282. ["SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE"] = '"libXxf86vm.so"',
  283. ["SDL_VIDEO_DRIVER_X11_XCURSOR"] = 1,
  284. ["SDL_VIDEO_DRIVER_X11_XINERAMA"] = 1,
  285. ["SDL_VIDEO_DRIVER_X11_XINPUT2"] = 1,
  286. ["SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH"] = 1,
  287. ["SDL_VIDEO_DRIVER_X11_XRANDR"] = 1,
  288. ["SDL_VIDEO_DRIVER_X11_XSCRNSAVER"] = 1,
  289. ["SDL_VIDEO_DRIVER_X11_XSHAPE"] = 1,
  290. ["SDL_VIDEO_DRIVER_X11_XVIDMODE"] = 1,
  291. ["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1,
  292. ["SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY"] = 1,
  293. ["SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM"] = 1
  294. }
  295. -- SDL2 on Linux
  296. SDL_dependency "linux"
  297. SDL_os "linux"
  298. SDL_depfunc "DBus"
  299. SDL_config
  300. {
  301. ["SDL_INPUT_LINUXEV"] = 1,
  302. ["SDL_JOYSTICK_LINUX"] = 1,
  303. ["SDL_HAPTIC_LINUX"] = 1,
  304. ["SDL_THREAD_PTHREAD"] = 1,
  305. ["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1,
  306. ["SDL_TIMER_UNIX"] = 1,
  307. ["SDL_POWER_LINUX"] = 1,
  308. ["SDL_FILESYSTEM_UNIX"] = 1,
  309. }
  310. SDL_paths
  311. {
  312. "/haptic/linux/",
  313. "/joystick/linux/",
  314. "/power/linux/",
  315. "/thread/pthread/",
  316. "/timer/unix/",
  317. "/filesystem/unix/"
  318. }
  319. SDL_links
  320. {
  321. "m",
  322. "pthread",
  323. "rt"
  324. }
  325. -- SDL2 on Cygwin (not quite working yet)
  326. SDL_dependency "cygwin"
  327. SDL_os "cygwin"
  328. SDL_config
  329. {
  330. ['SDL_JOYSTICK_DISABLED'] = 1,
  331. ['SDL_HAPTIC_DISABLED'] = 1,
  332. ['SDL_LOADSO_DLOPEN'] = 1,
  333. ['SDL_THREAD_PTHREAD'] = 1,
  334. ['SDL_THREAD_PTHREAD_RECURSIVE_MUTEX'] = 1,
  335. ['SDL_TIMER_UNIX'] = 1,
  336. ['SDL_FILESYSTEM_UNIX'] = 1,
  337. ['SDL_POWER_LINUX'] = 1
  338. }
  339. SDL_paths
  340. {
  341. "/loadso/dlopen/",
  342. "/power/linux/",
  343. "/render/opengl/",
  344. "/thread/pthread/",
  345. "/timer/unix/",
  346. "/filesystem/unix/",
  347. "/libm/"
  348. }
  349. -- SDL2 on iOS
  350. SDL_dependency "iphoneos"
  351. SDL_os "ios"
  352. SDL_config
  353. {
  354. ["SDL_AUDIO_DRIVER_COREAUDIO"] = 1,
  355. ["SDL_JOYSTICK_DISABLED"] = 0,
  356. ["SDL_HAPTIC_DISABLED"] = 1,
  357. ["SDL_LOADSO_DISABLED"] = 1,
  358. ["SDL_THREAD_PTHREAD"] = 1,
  359. ["SDL_THREAD_PTHREAD_RECURSIVE_MUTEX"] = 1,
  360. ["SDL_TIMER_UNIX"] = 1,
  361. ["SDL_VIDEO_DRIVER_UIKIT"] = 1,
  362. ["SDL_VIDEO_OPENGL_ES"] = 1,
  363. ["SDL_VIDEO_RENDER_OGL_ES"] = 1,
  364. ["SDL_VIDEO_RENDER_OGL_ES2"] = 1,
  365. ["SDL_POWER_UIKIT"] = 1,
  366. ["SDL_IPHONE_KEYBOARD"] = 1,
  367. ["SDL_FILESYSTEM_COCOA"] = 1
  368. }
  369. SDL_paths
  370. {
  371. "/audio/coreaudio/",
  372. "/file/cocoa/",
  373. "/joystick/iphoneos/",
  374. "/loadso/dlopen/",
  375. "/power/uikit/",
  376. "/render/opengles/",
  377. "/render/opengles2/",
  378. "/thread/pthread/",
  379. "/timer/unix/",
  380. "/video/uikit/",
  381. "/filesystem/cocoa/"
  382. }
  383. SDL_links
  384. {
  385. "$(SDKROOT)/AudioToolbox.framework",
  386. "$(SDKROOT)/QuartzCore.framework",
  387. "$(SDKROOT)/OpenGLES.framework",
  388. "$(SDKROOT)/CoreGraphics.framework",
  389. "$(SDKROOT)/UIKit.framework",
  390. "$(SDKROOT)/Foundation.framework",
  391. "$(SDKROOT)/CoreAudio.framework"
  392. }