~ Initial SDL2 implementation

Limitation
- Dependent projects need to set NAZARA_PLATFORM_SDL2 if nazara has been build with SDL2 since OpenGL.hpp (and maybe some other headers) exposes platform details
- SDL2 window doesn't supports async window since the API isn't fitting for now
- Contexts parameters can't be changed until we close all the SDL windows (SDL limitation)
This commit is contained in:
REMqb
2019-04-03 21:17:06 +02:00
parent ffc58e9806
commit 848f05a420
42 changed files with 2943 additions and 1268 deletions

View File

@@ -24,3 +24,6 @@ ServerMode = false
-- Builds modules as one united library (useless on POSIX systems)
UniteModules = false
-- Use SDL2 platform
PlatformSDL2 = true

View File

@@ -387,6 +387,7 @@ function NazaraBuild:Initialize()
if (f) then
MODULE = {}
self:SetupModuleTable(MODULE)
Config = self.Config
f()
@@ -529,6 +530,7 @@ function NazaraBuild:LoadConfig()
AddBoolOption("PremakeProject", "premakeproject", "Add a PremakeProject as a shortcut to call Premake")
AddBoolOption("ServerMode", "server", "Excludes client-only modules/tools/examples")
AddBoolOption("UniteModules", "united", "Builds all the modules as one united library")
AddBoolOption("PlatformSDL2", "platform-sdl2", "Use SDL2 instead of native APIs")
-- AdditionalCompilationOptions
do

View File

@@ -7,27 +7,41 @@ MODULE.Libraries = {
"NazaraUtility"
}
MODULE.OsFiles.Windows = {
"../src/Nazara/Platform/Win32/**.hpp",
"../src/Nazara/Platform/Win32/**.cpp"
}
if Config.PlatformSDL2 then
table.insert(MODULE.Defines, "NAZARA_PLATFORM_SDL2")
MODULE.OsFiles.Posix = {
"../src/Nazara/Platform/X11/**.hpp",
"../src/Nazara/Platform/X11/**.cpp"
}
table.insert(MODULE.Files, "../src/Nazara/Platform/SDL2/**.hpp")
table.insert(MODULE.Files, "../src/Nazara/Platform/SDL2/**.cpp")
MODULE.OsLibraries.Windows = {
"gdi32"
}
table.insert(MODULE.Libraries, "SDL2")
MODULE.OsLibraries.Posix = {
"X11",
"xcb",
"xcb-cursor",
"xcb-ewmh",
"xcb-icccm",
"xcb-keysyms",
"xcb-randr"
}
MODULE.FilesExcluded = {
"../src/Nazara/Platform/Win32/**",
"../src/Nazara/Platform/X11/**"
}
else
MODULE.OsFiles.Windows = {
"../src/Nazara/Platform/Win32/**.hpp",
"../src/Nazara/Platform/Win32/**.cpp"
}
MODULE.OsFiles.Posix = {
"../src/Nazara/Platform/X11/**.hpp",
"../src/Nazara/Platform/X11/**.cpp"
}
MODULE.OsLibraries.Windows = {
"gdi32"
}
MODULE.OsLibraries.Posix = {
"X11",
"xcb",
"xcb-cursor",
"xcb-ewmh",
"xcb-icccm",
"xcb-keysyms",
"xcb-randr"
}
end

View File

@@ -12,23 +12,35 @@ MODULE.Libraries = {
"NazaraPlatform"
}
MODULE.OsFiles.Windows = {
"../src/Nazara/Renderer/Win32/**.hpp",
"../src/Nazara/Renderer/Win32/**.cpp"
}
if Config.PlatformSDL2 then
table.insert(MODULE.Defines, "NAZARA_PLATFORM_SDL2")
MODULE.OsFiles.Posix = {
"../src/Nazara/Renderer/GLX/**.hpp",
"../src/Nazara/Renderer/GLX/**.cpp"
}
table.insert(MODULE.Files, "../src/Nazara/Renderer/SDL2/**.hpp")
table.insert(MODULE.Files, "../src/Nazara/Renderer/SDL2/**.cpp")
MODULE.OsLibraries.Windows = {
"gdi32",
"opengl32",
"winmm"
}
MODULE.FilesExcluded = {
"../src/Nazara/Renderer/Win32/**",
"../src/Nazara/Renderer/GLX/**.cpp"
}
else
MODULE.OsFiles.Windows = {
"../src/Nazara/Renderer/Win32/**.hpp",
"../src/Nazara/Renderer/Win32/**.cpp"
}
MODULE.OsLibraries.Posix = {
"GL",
"X11"
}
MODULE.OsFiles.Posix = {
"../src/Nazara/Renderer/GLX/**.hpp",
"../src/Nazara/Renderer/GLX/**.cpp"
}
MODULE.OsLibraries.Windows = {
"gdi32",
"opengl32",
"winmm"
}
MODULE.OsLibraries.Posix = {
"GL",
"X11"
}
end