trunk/scripts/src/osd/sdl.lua
r245336 | r245337 | |
1 | 1 | function maintargetosdoptions(_target) |
| 2 | if _OPTIONS["NO_X11"]~="1" then |
| 3 | links { |
| 4 | "X11", |
| 5 | "Xinerama", |
| 6 | } |
| 7 | end |
| 8 | |
| 9 | if _OPTIONS["NO_USE_XINPUT"]~="1" then |
| 10 | links { |
| 11 | "Xext", |
| 12 | "Xi", |
| 13 | } |
| 14 | end |
| 15 | |
2 | 16 | if _OPTIONS["targetos"]=="windows" then |
3 | 17 | linkoptions{ |
4 | 18 | "-municode", |
r245336 | r245337 | |
13 | 27 | "QtCore4", |
14 | 28 | } |
15 | 29 | end |
16 | | end |
17 | | if _OPTIONS["targetos"]=="linux" then |
| 30 | elseif _OPTIONS["targetos"]=="linux" then |
18 | 31 | if (USE_QT == 1) then |
19 | 32 | links { |
20 | 33 | "QtGui", |
r245336 | r245337 | |
34 | 47 | end |
35 | 48 | |
36 | 49 | |
| 50 | newoption { |
| 51 | trigger = "NO_X11", |
| 52 | description = "Disable use of X11", |
| 53 | allowed = { |
| 54 | { "0", "Enable X11" }, |
| 55 | { "1", "Disable X11" }, |
| 56 | }, |
| 57 | } |
| 58 | |
| 59 | if not _OPTIONS["NO_X11"] then |
| 60 | if _OPTIONS["targetos"]=="windows" or _OPTIONS["targetos"]=="macosx" or _OPTIONS["targetos"]=="haiku" or _OPTIONS["targetos"]=="emscripten" or _OPTIONS["targetos"]=="os2" then |
| 61 | _OPTIONS["NO_X11"] = "1" |
| 62 | else |
| 63 | _OPTIONS["NO_X11"] = "0" |
| 64 | end |
| 65 | end |
| 66 | |
| 67 | newoption { |
| 68 | trigger = "NO_USE_XINPUT", |
| 69 | description = "Disable use of Xinput", |
| 70 | allowed = { |
| 71 | { "0", "Enable Xinput" }, |
| 72 | { "1", "Disable Xinput" }, |
| 73 | }, |
| 74 | } |
| 75 | |
| 76 | if not _OPTIONS["NO_USE_XINPUT"] then |
| 77 | _OPTIONS["NO_USE_XINPUT"] = "1" |
| 78 | end |
| 79 | |
| 80 | newoption { |
| 81 | trigger = "SDL_LIBVER", |
| 82 | description = "Choose SDL version", |
| 83 | allowed = { |
| 84 | { "sdl", "SDL" }, |
| 85 | { "sdl2", "SDL 2" }, |
| 86 | }, |
| 87 | } |
| 88 | |
| 89 | if not _OPTIONS["SDL_LIBVER"] then |
| 90 | if _OPTIONS["targetos"]=="os2" then |
| 91 | _OPTIONS["SDL_LIBVER"] = "sdl" |
| 92 | else |
| 93 | _OPTIONS["SDL_LIBVER"] = "sdl2" |
| 94 | end |
| 95 | end |
| 96 | |
| 97 | newoption { |
| 98 | trigger = "SDL_INSTALL_ROOT", |
| 99 | description = "Equivalent to the ./configure --prefix=<path>", |
| 100 | } |
| 101 | |
| 102 | newoption { |
| 103 | trigger = "SDL_FRAMEWORK_PATH", |
| 104 | description = "Location of SDL framework for custom OS X installations", |
| 105 | } |
| 106 | |
| 107 | if not _OPTIONS["SDL_FRAMEWORK_PATH"] then |
| 108 | _OPTIONS["SDL_FRAMEWORK_PATH"] = "/Library/Frameworks/" |
| 109 | end |
| 110 | |
| 111 | newoption { |
| 112 | trigger = "MACOSX_USE_LIBSDL", |
| 113 | description = "Use SDL library on OS (rather than framework)", |
| 114 | allowed = { |
| 115 | { "0", "Use framework" }, |
| 116 | { "1", "Use library" }, |
| 117 | }, |
| 118 | } |
| 119 | |
| 120 | if not _OPTIONS["MACOSX_USE_LIBSDL"] then |
| 121 | _OPTIONS["MACOSX_USE_LIBSDL"] = "0" |
| 122 | end |
| 123 | |
| 124 | |
| 125 | if _OPTIONS["NO_X11"]~="1" and _OPTIONS["SDL_LIBVER"]=="sdl" then |
| 126 | links { |
| 127 | "X11" |
| 128 | } |
| 129 | end |
| 130 | |
| 131 | if _OPTIONS["targetos"]=="macosx" and _OPTIONS["MACOSX_USE_LIBSDL"]~="1" then |
| 132 | buildoptions { |
| 133 | "-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"], |
| 134 | } |
| 135 | linkoptions { |
| 136 | "-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"], |
| 137 | } |
| 138 | if _OPTIONS["SDL_LIBVER"]=="sdl2" then |
| 139 | links { |
| 140 | "SDL2.framework", |
| 141 | } |
| 142 | else |
| 143 | links { |
| 144 | "SDL.framework", |
| 145 | } |
| 146 | end |
| 147 | end |
| 148 | |
37 | 149 | configuration { "mingw*" } |
38 | 150 | linkoptions { |
39 | 151 | "-Wl,--allow-multiple-definition", |
r245336 | r245337 | |
78 | 190 | |
79 | 191 | if _OPTIONS["targetos"]=="macosx" then |
80 | 192 | files { |
81 | | --MAME_DIR .. "src/osd/sdl/SDLMain_tmpl.m", |
82 | 193 | MAME_DIR .. "src/osd/modules/debugger/debugosx.m", |
83 | 194 | MAME_DIR .. "src/osd/modules/debugger/osx/breakpointsview.m", |
84 | 195 | MAME_DIR .. "src/osd/modules/debugger/osx/consoleview.m", |
r245336 | r245337 | |
98 | 209 | MAME_DIR .. "src/osd/modules/debugger/osx/registersview.m", |
99 | 210 | MAME_DIR .. "src/osd/modules/debugger/osx/watchpointsview.m", |
100 | 211 | } |
| 212 | if _OPTIONS["SDL_LIBVER"]=="sdl" then |
| 213 | -- SDLMain_tmpl isn't necessary for SDL2 |
| 214 | files { |
| 215 | MAME_DIR .. "src/osd/sdl/SDLMain_tmpl.m", |
| 216 | } |
| 217 | end |
101 | 218 | end |
102 | 219 | |
103 | 220 | files { |
r245336 | r245337 | |
107 | 224 | MAME_DIR .. "src/osd/sdl/window.c", |
108 | 225 | MAME_DIR .. "src/osd/sdl/output.c", |
109 | 226 | MAME_DIR .. "src/osd/sdl/watchdog.c", |
| 227 | MAME_DIR .. "src/osd/modules/lib/osdobj_common.c", |
110 | 228 | MAME_DIR .. "src/osd/modules/render/drawsdl.c", |
111 | | --ifeq ($(SDL_LIBVER),sdl2) |
112 | | MAME_DIR .. "src/osd/modules/render/draw13.c", |
113 | | --endif |
| 229 | MAME_DIR .. "src/osd/modules/render/drawogl.c", |
114 | 230 | MAME_DIR .. "src/osd/modules/debugger/none.c", |
115 | 231 | MAME_DIR .. "src/osd/modules/debugger/debugint.c", |
116 | 232 | MAME_DIR .. "src/osd/modules/debugger/debugwin.c", |
117 | 233 | MAME_DIR .. "src/osd/modules/debugger/debugqt.c", |
118 | | MAME_DIR .. "src/osd/modules/render/drawogl.c", |
119 | 234 | MAME_DIR .. "src/osd/modules/opengl/gl_shader_tool.c", |
120 | 235 | MAME_DIR .. "src/osd/modules/opengl/gl_shader_mgr.c", |
| 236 | MAME_DIR .. "src/osd/modules/font/font_sdl.c", |
| 237 | MAME_DIR .. "src/osd/modules/font/font_windows.c", |
| 238 | MAME_DIR .. "src/osd/modules/font/font_osx.c", |
| 239 | MAME_DIR .. "src/osd/modules/font/font_none.c", |
| 240 | MAME_DIR .. "src/osd/modules/netdev/taptun.c", |
| 241 | MAME_DIR .. "src/osd/modules/netdev/pcap.c", |
| 242 | MAME_DIR .. "src/osd/modules/netdev/none.c", |
| 243 | MAME_DIR .. "src/osd/modules/midi/portmidi.c", |
| 244 | MAME_DIR .. "src/osd/modules/midi/none.c", |
| 245 | MAME_DIR .. "src/osd/modules/sound/js_sound.c", |
| 246 | MAME_DIR .. "src/osd/modules/sound/direct_sound.c", |
| 247 | MAME_DIR .. "src/osd/modules/sound/sdl_sound.c", |
| 248 | MAME_DIR .. "src/osd/modules/sound/none.c", |
121 | 249 | } |
| 250 | if _OPTIONS["SDL_LIBVER"]=="sdl2" then |
| 251 | files { |
| 252 | MAME_DIR .. "src/osd/modules/render/draw13.c", |
| 253 | } |
| 254 | end |
122 | 255 | |
123 | | if (USE_QT == 1) then |
| 256 | if USE_QT == 1 then |
124 | 257 | files { |
125 | 258 | MAME_DIR .. "src/osd/modules/debugger/qt/debuggerview.c", |
126 | 259 | MAME_DIR .. "src/osd/modules/debugger/qt/windowqt.c", |
r245336 | r245337 | |
144 | 277 | } |
145 | 278 | end |
146 | 279 | |
147 | | if (USE_BGFX == 1) then |
| 280 | if USE_BGFX == 1 then |
148 | 281 | files { |
149 | 282 | MAME_DIR .. "src/osd/modules/render/drawbgfx.c", |
150 | 283 | } |
151 | 284 | end |
152 | 285 | |
153 | | files { |
154 | | MAME_DIR .. "src/osd/modules/lib/osdobj_common.c", |
155 | | MAME_DIR .. "src/osd/modules/font/font_sdl.c", |
156 | | MAME_DIR .. "src/osd/modules/font/font_windows.c", |
157 | | MAME_DIR .. "src/osd/modules/font/font_osx.c", |
158 | | MAME_DIR .. "src/osd/modules/font/font_none.c", |
159 | | MAME_DIR .. "src/osd/modules/netdev/taptun.c", |
160 | | MAME_DIR .. "src/osd/modules/netdev/pcap.c", |
161 | | MAME_DIR .. "src/osd/modules/netdev/none.c", |
162 | | MAME_DIR .. "src/osd/modules/midi/portmidi.c", |
163 | | MAME_DIR .. "src/osd/modules/midi/none.c", |
164 | | MAME_DIR .. "src/osd/modules/sound/js_sound.c", |
165 | | MAME_DIR .. "src/osd/modules/sound/direct_sound.c", |
166 | | MAME_DIR .. "src/osd/modules/sound/sdl_sound.c", |
167 | | MAME_DIR .. "src/osd/modules/sound/none.c", |
168 | | } |
169 | | |
| 286 | |
170 | 287 | project ("ocore_" .. _OPTIONS["osd"]) |
171 | 288 | uuid (os.uuid("ocore_" .. _OPTIONS["osd"])) |
172 | 289 | kind "StaticLib" |
r245336 | r245337 | |
189 | 306 | MAME_DIR .. "src/osd/sdl", |
190 | 307 | } |
191 | 308 | |
192 | | if _OPTIONS["targetos"]=="linux" then |
193 | | BASE_TARGETOS = "unix" |
194 | | SDLOS_TARGETOS = "unix" |
195 | | SYNC_IMPLEMENTATION = "tc" |
196 | | end |
197 | | |
198 | | if _OPTIONS["targetos"]=="windows" then |
199 | | BASE_TARGETOS = "win32" |
200 | | SDLOS_TARGETOS = "win32" |
201 | | SYNC_IMPLEMENTATION = "windows" |
202 | | end |
203 | | |
204 | | if _OPTIONS["targetos"]=="macosx" then |
205 | | BASE_TARGETOS = "unix" |
206 | | SDLOS_TARGETOS = "macosx" |
207 | | SYNC_IMPLEMENTATION = "ntc" |
208 | | end |
209 | | |
210 | 309 | files { |
211 | 310 | MAME_DIR .. "src/osd/strconv.c", |
212 | 311 | MAME_DIR .. "src/osd/sdl/sdldir.c", |
r245336 | r245337 | |
228 | 327 | MAME_DIR .. "src/osd/sdl/osxutils.m", |
229 | 328 | } |
230 | 329 | end |
| 330 | |
| 331 | |
| 332 | -------------------------------------------------- |
| 333 | -- testkeys |
| 334 | -------------------------------------------------- |
| 335 | |
| 336 | if _OPTIONS["with-tools"] then |
| 337 | project("testkeys") |
| 338 | uuid ("744cec21-c3b6-4d69-93cb-6811fed0ffe3") |
| 339 | kind "ConsoleApp" |
| 340 | |
| 341 | options { |
| 342 | "ForceCPP", |
| 343 | } |
| 344 | |
| 345 | dofile("sdl_cfg.lua") |
| 346 | |
| 347 | includedirs { |
| 348 | MAME_DIR .. "src/lib/util", |
| 349 | } |
| 350 | targetdir(MAME_DIR) |
| 351 | |
| 352 | links { |
| 353 | "ocore_" .. _OPTIONS["osd"], |
| 354 | } |
| 355 | |
| 356 | includeosd() |
| 357 | |
| 358 | files { |
| 359 | MAME_DIR .. "src/osd/sdl/testkeys.c", |
| 360 | } |
| 361 | |
| 362 | if _OPTIONS["targetos"]=="windows" then |
| 363 | linkoptions{ |
| 364 | "-municode", |
| 365 | } |
| 366 | files { |
| 367 | MAME_DIR .. "src/osd/sdl/main.c", |
| 368 | } |
| 369 | elseif _OPTIONS["targetos"]=="macosx" and _OPTIONS["SDL_LIBVER"]=="sdl" then |
| 370 | -- SDLMain_tmpl isn't necessary for SDL2 |
| 371 | files { |
| 372 | MAME_DIR .. "src/osd/sdl/SDLMain_tmpl.m", |
| 373 | } |
| 374 | end |
| 375 | end |
trunk/scripts/src/osd/sdl_cfg.lua
r245336 | r245337 | |
| 1 | BASE_TARGETOS = "unix" |
| 2 | SDLOS_TARGETOS = "unix" |
| 3 | SYNC_IMPLEMENTATION = "tc" |
| 4 | if _OPTIONS["targetos"]=="openbsd" then |
| 5 | SYNC_IMPLEMENTATION = "ntc" |
| 6 | elseif _OPTIONS["targetos"]=="netbsd" then |
| 7 | SYNC_IMPLEMENTATION = "ntc" |
| 8 | elseif _OPTIONS["targetos"]=="haiku" then |
| 9 | SYNC_IMPLEMENTATION = "ntc" |
| 10 | elseif _OPTIONS["targetos"]=="emscripten" then |
| 11 | SYNC_IMPLEMENTATION = "mini" |
| 12 | elseif _OPTIONS["targetos"]=="windows" then |
| 13 | BASE_TARGETOS = "win32" |
| 14 | SDLOS_TARGETOS = "win32" |
| 15 | SYNC_IMPLEMENTATION = "windows" |
| 16 | elseif _OPTIONS["targetos"]=="macosx" then |
| 17 | SDLOS_TARGETOS = "macosx" |
| 18 | SYNC_IMPLEMENTATION = "ntc" |
| 19 | elseif _OPTIONS["targetos"]=="os2" then |
| 20 | BASE_TARGETOS = "os2" |
| 21 | SDLOS_TARGETOS = "os2" |
| 22 | SYNC_IMPLEMENTATION = "os2" |
| 23 | end |
| 24 | |
1 | 25 | forcedincludes { |
2 | 26 | MAME_DIR .. "src/osd/sdl/sdlprefix.h" |
3 | 27 | } |
r245336 | r245337 | |
2 | 26 | |
| 27 | if _OPTIONS["NO_X11"]=="1" then |
| 28 | defines { |
| 29 | "SDLMAME_NO_X11", |
| 30 | } |
| 31 | else |
| 32 | defines { |
| 33 | "SDLMAME_X11", |
| 34 | } |
| 35 | includedirs { |
| 36 | "/usr/X11/include", |
| 37 | "/usr/X11R6/include", |
| 38 | "/usr/openwin/include", |
| 39 | } |
| 40 | end |
| 41 | |
| 42 | if _OPTIONS["NO_USE_XINPUT"]=="1" then |
| 43 | defines { |
| 44 | "USE_XINPUT=0", |
| 45 | } |
| 46 | else |
| 47 | defines { |
| 48 | "USE_XINPUT=1", |
| 49 | "USE_XINPUT_DEBUG=0", |
| 50 | } |
| 51 | end |
| 52 | |
| 53 | if _OPTIONS["SDL_LIBVER"]=="sdl2" then |
| 54 | defines { |
| 55 | "SDLMAME_SDL2=1", |
| 56 | } |
| 57 | else |
| 58 | defines { |
| 59 | "SDLMAME_SDL2=0", |
| 60 | } |
| 61 | end |
| 62 | |
| 63 | if USE_BGFX == 1 then |
| 64 | defines { |
| 65 | "USE_BGFX" |
| 66 | } |
| 67 | end |
| 68 | |
| 69 | defines { |
| 70 | "OSD_SDL", |
| 71 | } |
| 72 | |
| 73 | if BASE_TARGETOS=="unix" then |
| 74 | defines { |
| 75 | "SDLMAME_UNIX", |
| 76 | } |
| 77 | end |
| 78 | |
3 | 79 | if _OPTIONS["targetos"]=="windows" then |
4 | 80 | defines { |
5 | | "OSD_SDL", |
6 | 81 | "SDLMAME_WIN32", |
7 | 82 | "UNICODE", |
8 | 83 | "_UNICODE", |
9 | | "SDLMAME_SDL2=1", |
10 | | "USE_XINPUT=0", |
11 | 84 | "USE_OPENGL=1", |
r245336 | r245337 | |
21 | 94 | "-I$(shell qmake -query QT_INSTALL_HEADERS)/QtGui", |
22 | 95 | "-I$(shell qmake -query QT_INSTALL_HEADERS)", |
23 | 96 | } |
24 | | end |
25 | | |
26 | | if _OPTIONS["targetos"]=="linux" then |
| 97 | elseif _OPTIONS["targetos"]=="linux" then |
27 | 98 | defines { |
28 | | "OSD_SDL", |
29 | | "SDLMAME_UNIX", |
30 | | "SDLMAME_X11", |
31 | | "SDLMAME_SDL2=1", |
32 | | "USE_XINPUT=0", |
33 | 99 | "USE_OPENGL=1", |
34 | 100 | "USE_QTDEBUG=" .. USE_QT, |
35 | 101 | "SDLMAME_NET_TAPTUN", |
36 | 102 | } |
37 | 103 | |
38 | | if (USE_BGFX == 1) then |
39 | | defines { |
40 | | "USE_BGFX" |
41 | | } |
42 | | end |
43 | | |
44 | 104 | buildoptions { |
45 | 105 | '$(shell pkg-config --cflags QtGui)', |
46 | 106 | } |
47 | | end |
48 | | |
49 | | if _OPTIONS["targetos"]=="macosx" then |
| 107 | elseif _OPTIONS["targetos"]=="macosx" then |
50 | 108 | defines { |
51 | | "OSD_SDL", |
52 | | "SDLMAME_UNIX", |
53 | 109 | "SDLMAME_MACOSX", |
54 | 110 | "SDLMAME_DARWIN", |
55 | | "SDLMAME_SDL2=1", |
56 | | "USE_XINPUT=0", |
57 | 111 | "USE_OPENGL=1", |
58 | 112 | "USE_QTDEBUG=0", |
59 | 113 | "SDLMAME_NET_PCAP", |
60 | 114 | } |
61 | | |
62 | | if (USE_BGFX == 1) then |
63 | | defines { |
64 | | "USE_BGFX" |
65 | | } |
66 | | end |
| 115 | elseif _OPTIONS["targetos"]=="os2" then |
| 116 | defines { |
| 117 | "SDLMAME_OS2", |
| 118 | } |
67 | 119 | end |