[SDL2] On Win, build and link statically.
Keep using system lib dynamically on Unix.
This commit is contained in:
36
third_party/SDL2.lua
vendored
Normal file
36
third_party/SDL2.lua
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
--
|
||||
-- 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",
|
||||
})
|
||||
filter("platforms:Linux")
|
||||
includedirs(sdl2_sys_includedirs)
|
||||
filter({})
|
||||
end
|
||||
Reference in New Issue
Block a user