Add support for SDL2

This commit is contained in:
Anonymous Maarten
2018-08-08 19:55:45 +02:00
parent 75dbb7e67e
commit 86571b650b
8 changed files with 511 additions and 16 deletions

View File

@@ -1,17 +1,35 @@
newoption {
trigger = "glewdir",
value = "path",
value = "PATH",
description = "Directory of GLEW",
default = "C:/Users/aap/src/glew-2.1.0",
}
newoption {
trigger = "gfxlib",
value = "LIBRARY",
description = "Choose a particular development library",
default = "glfw",
allowed = {
{ "glfw", "GLFW" },
{ "sdl2", "SDL2" },
},
}
newoption {
trigger = "glfwdir",
value = "path",
value = "PATH",
description = "Directory of glfw",
default = "C:/Users/aap/src/glfw-3.2.1.bin.WIN64",
}
newoption {
trigger = "sdl2dir",
value = "PATH",
description = "Directory of sdl2",
default = "C:/Users/aap/src/SDL2-2.0.8",
}
workspace "librw"
location "build"
language "C++"
@@ -25,6 +43,9 @@ workspace "librw"
platforms { "linux-x86-null", "linux-x86-gl3",
"linux-amd64-null", "linux-amd64-gl3",
"ps2" }
if _OPTIONS["gfxlib"] == "sdl2" then
includedirs { "/usr/include/SDL2" }
end
filter {}
filter "configurations:Debug"
@@ -40,6 +61,9 @@ workspace "librw"
defines { "RW_NULL" }
filter { "platforms:*gl3" }
defines { "RW_GL3" }
if _OPTIONS["gfxlib"] == "sdl2" then
defines { "LIBRW_SDL2" }
end
filter { "platforms:*d3d9" }
defines { "RW_D3D9" }
filter { "platforms:ps2" }
@@ -64,6 +88,7 @@ workspace "librw"
defines { "GLEW_STATIC" }
includedirs { path.join(_OPTIONS["glewdir"], "include") }
includedirs { path.join(_OPTIONS["glfwdir"], "include") }
includedirs { path.join(_OPTIONS["sdl2dir"], "include") }
filter "action:vs*"
buildoptions { "/wd4996", "/wd4244" }
@@ -91,16 +116,28 @@ project "dumprwtree"
function findlibs()
filter { "platforms:linux*gl3" }
links { "GL", "GLEW", "glfw" }
links { "GL", "GLEW" }
if _OPTIONS["gfxlib"] == "glfw" then
links { "glfw" }
else
links { "SDL2" }
end
filter { "platforms:win*gl3" }
defines { "GLEW_STATIC" }
filter { "platforms:win-amd64-gl3" }
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") }
libdirs { path.join(_OPTIONS["glfwdir"], "lib-vc2015") }
libdirs { path.join(_OPTIONS["sdl2dir"], "lib/x64") }
filter { "platforms:win-x86-gl3" }
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }
libdirs { path.join(_OPTIONS["sdl2dir"], "lib/x86") }
filter { "platforms:win*gl3" }
links { "glew32s", "glfw3", "opengl32" }
links { "glew32s", "opengl32" }
if _OPTIONS["gfxlib"] == "glfw" then
links { "glfw3" }
else
links { "SDL2" }
end
filter { "platforms:*d3d9" }
links { "d3d9", "Xinput9_1_0" }
filter {}