2020-03-30 11:23:25 +00:00
|
|
|
--
|
|
|
|
-- On Linux we build against the system version (libsdl2-dev for building),
|
|
|
|
-- since SDL2 is our robust API there like DirectX is on Windows.
|
|
|
|
--
|
|
|
|
|
|
|
|
local sdl2_sys_includedirs = {}
|
|
|
|
local third_party_path = os.getcwd()
|
|
|
|
|
|
|
|
if os.istarget("windows") then
|
|
|
|
-- build ourselves
|
|
|
|
include("SDL2-static.lua")
|
|
|
|
else
|
|
|
|
-- use system libraries
|
|
|
|
local result, code, what = os.outputof("sdl2-config --cflags")
|
|
|
|
if result then
|
|
|
|
for inc in string.gmatch(result, "-I([%S]+)") do
|
|
|
|
table.insert(sdl2_sys_includedirs, inc)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
error("Failed to run 'sdl2-config'. Are libsdl2 development files installed?")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Call this function in project scope to include the SDL2 headers.
|
|
|
|
--
|
|
|
|
function sdl2_include()
|
|
|
|
filter("platforms:Windows")
|
|
|
|
includedirs({
|
|
|
|
path.getrelative(".", third_party_path) .. "/SDL2/include",
|
|
|
|
})
|
2021-10-06 21:55:58 +00:00
|
|
|
filter("platforms:Linux or platforms:Mac")
|
2020-03-30 11:23:25 +00:00
|
|
|
includedirs(sdl2_sys_includedirs)
|
|
|
|
filter({})
|
|
|
|
end
|