summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/src/osd/sdl_cfg.lua
blob: 2636438d3e59cb4dcdcc4673e79bb4b375affff4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
forcedincludes {
	MAME_DIR .. "src/osd/sdl/sdlprefix.h"
}

if SDL_NETWORK~="" and not _OPTIONS["DONT_USE_NETWORK"] then
	defines {
		"SDLMAME_NET_" .. string.upper(SDL_NETWORK),
	}
end

if _OPTIONS["NO_OPENGL"]~="1" and _OPTIONS["USE_DISPATCH_GL"]~="1" and _OPTIONS["MESA_INSTALL_ROOT"] then
	includedirs {
		path.join(_OPTIONS["MESA_INSTALL_ROOT"],"include"),
	}
end


if _OPTIONS["NO_X11"]=="1" then
	defines {
		"SDLMAME_NO_X11",
	}
else
	defines {
		"SDLMAME_X11",
	}
	includedirs {
		"/usr/X11/include",
		"/usr/X11R6/include",
		"/usr/openwin/include",
	}
end

if _OPTIONS["NO_USE_XINPUT"]=="1" then
	defines {
		"USE_XINPUT=0",
	}
else
	defines {
		"USE_XINPUT=1",
		"USE_XINPUT_DEBUG=0",
	}
end

if _OPTIONS["NO_USE_MIDI"]~="1" and _OPTIONS["targetos"]=="linux" then
	buildoptions {
		string.gsub(os.outputof("pkg-config --cflags alsa"), '[\r\n]+', ' '),
	}
end

if _OPTIONS["SDL_LIBVER"]=="sdl2" then
	defines {
		"SDLMAME_SDL2=1",
	}
	if _OPTIONS["SDL2_MULTIAPI"]=="1" then
		defines {
			"SDL2_MULTIAPI",
		}
	end
else
	defines {
		"SDLMAME_SDL2=0",
	}
end

defines {
	"OSD_SDL",
	"SYNC_IMPLEMENTATION=" .. SYNC_IMPLEMENTATION,
}

if BASE_TARGETOS=="unix" then
	defines {
		"SDLMAME_UNIX",
	}
	if _OPTIONS["targetos"]=="macosx" then
		if _OPTIONS["MACOSX_USE_LIBSDL"]~="1" then
			buildoptions {
				"-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"],
			}
		else
			defines {
				"NO_SDL_GLEXT",
				"MACOSX_USE_LIBSDL",
			}
			buildoptions {
				string.gsub(os.outputof(sdlconfigcmd() .. " --cflags | sed 's:/SDL::'"), '[\r\n]+', ' '),
			}
		end
	else
		buildoptions {
			string.gsub(os.outputof(sdlconfigcmd() .. " --cflags"), '[\r\n]+', ' '),
		}
		if _OPTIONS["targetos"]~="emscripten" then
			buildoptions {
				string.gsub(os.outputof("pkg-config --cflags fontconfig"), '[\r\n]+', ' '),
			}
		end
	end
end

if _OPTIONS["targetos"]=="windows" then
	defines {
		"UNICODE",
		"_UNICODE",
		"main=utf8_main",
	}

	configuration { "vs*" }
		includedirs {
			path.join(_OPTIONS["SDL_INSTALL_ROOT"],"include")
		}
	configuration { }

elseif _OPTIONS["targetos"]=="linux" then
	buildoptions {
		'$(shell pkg-config --cflags QtGui)',
	}
elseif _OPTIONS["targetos"]=="macosx" then
	defines {
		"SDLMAME_MACOSX",
		"SDLMAME_DARWIN",
	}
elseif _OPTIONS["targetos"]=="freebsd" then
	buildoptions {
		-- /usr/local/include is not considered a system include director on FreeBSD.  GL.h resides there and throws warnings
		"-isystem /usr/local/include",
	}
elseif _OPTIONS["targetos"]=="os2" then
	buildoptions {
		string.gsub(os.outputof(sdlconfigcmd() .. " --cflags"), '[\r\n]+', ' '),
	}
end