####################################################################################################
# TGUI - Texus' Graphical User Interface
# Copyright (C) 2012-2023 Bruno Van de Velde (vdv_b@tgui.eu)
#
# This software is provided 'as-is', without any express or implied warranty.
# In no event will the authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it freely,
# subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented;
# you must not claim that you wrote the original software.
# If you use this software in a product, an acknowledgment
# in the product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such,
# and must not be misrepresented as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
####################################################################################################
if(TGUI_BACKEND_UPPERCASE STREQUAL "CUSTOM")
if(TGUI_OS_WINDOWS OR TGUI_OS_LINUX OR TGUI_OS_MACOS OR TGUI_OS_ANDROID OR TGUI_OS_IOS)
tgui_set_option(TGUI_HAS_BACKEND_SFML_GRAPHICS FALSE BOOL "TRUE to build the SFML_GRAPHICS backend (uses sfml-graphics for everything)")
tgui_set_option(TGUI_HAS_BACKEND_SDL_RENDERER FALSE BOOL "TRUE to build the SDL_RENDERER backend (SDL2 + SDL2_ttf)")
endif()
if(TGUI_OS_WINDOWS OR TGUI_OS_LINUX OR TGUI_OS_ANDROID OR TGUI_OS_IOS)
tgui_set_option(TGUI_HAS_BACKEND_SDL_GLES2 FALSE BOOL "TRUE to build the SDL_GLES2 backend (SDL2 + OpenGL ES + FreeType)")
tgui_set_option(TGUI_HAS_BACKEND_SDL_TTF_GLES2 FALSE BOOL "TRUE to build the SDL_TTF_GLES2 backend (SDL2 + SDL2_ttf + OpenGL ES)")
tgui_set_option(TGUI_HAS_BACKEND_GLFW_GLES2 FALSE BOOL "TRUE to build the GLFW_GLES2 backend (GLFW + OpenGL ES + FreeType)")
endif()
if(TGUI_OS_WINDOWS OR TGUI_OS_LINUX OR TGUI_OS_MACOS)
tgui_set_option(TGUI_HAS_BACKEND_SFML_OPENGL3 FALSE BOOL "TRUE to build the SFML_OPENGL3 backend (sfml-window + OpenGL + FreeType)")
tgui_set_option(TGUI_HAS_BACKEND_SDL_OPENGL3 FALSE BOOL "TRUE to build the SDL_OPENGL3 backend (SDL2 + OpenGL + FreeType)")
tgui_set_option(TGUI_HAS_BACKEND_SDL_TTF_OPENGL3 FALSE BOOL "TRUE to build the SDL_TTF_OPENGL3 backend (SDL2 + SDL2_ttf + OpenGL)")
tgui_set_option(TGUI_HAS_BACKEND_GLFW_OPENGL3 FALSE BOOL "TRUE to build the GLFW_OPENGL3 backend (GLFW + OpenGL + FreeType)")
endif()
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_WINDOW_SFML FALSE BOOL "TRUE to build the SFML window backend even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_WINDOW_SDL FALSE BOOL "TRUE to build the SDL window backend even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_WINDOW_GLFW FALSE BOOL "TRUE to build the GLFW window backend even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_RENDERER_SFML_GRAPHICS FALSE BOOL "TRUE to build the sfml-graphics renderer even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_RENDERER_SDL_RENDERER FALSE BOOL "TRUE to build the SDL_Renderer renderer even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_RENDERER_OPENGL3 FALSE BOOL "TRUE to build the modern OpenGL renderer even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_RENDERER_GLES2 FALSE BOOL "TRUE to build the OpenGL ES renderer even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_FONT_SFML_GRAPHICS FALSE BOOL "TRUE to build the sf::Font font loader even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_FONT_SDL_TTF FALSE BOOL "TRUE to build the SDL_ttf font loader even when not needed by any selected backend")
tgui_set_option(TGUI_CUSTOM_BACKEND_HAS_FONT_FREETYPE FALSE BOOL "TRUE to build the FreeType font loader even when not needed by any selected backend")
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_WINDOW_SFML)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_WINDOW_SDL)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_WINDOW_GLFW)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_RENDERER_SFML_GRAPHICS)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_RENDERER_SDL_RENDERER)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_RENDERER_OPENGL3)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_RENDERER_GLES2)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_FONT_SFML_GRAPHICS)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_FONT_SDL_TTF)
mark_as_advanced(TGUI_CUSTOM_BACKEND_HAS_FONT_FREETYPE)
else() # TGUI_BACKEND != Custom
unset(TGUI_HAS_BACKEND_SFML_GRAPHICS CACHE)
unset(TGUI_HAS_BACKEND_SFML_OPENGL3 CACHE)
unset(TGUI_HAS_BACKEND_SDL_RENDERER CACHE)
unset(TGUI_HAS_BACKEND_SDL_OPENGL3 CACHE)
unset(TGUI_HAS_BACKEND_SDL_GLES2 CACHE)
unset(TGUI_HAS_BACKEND_SDL_TTF_OPENGL3 CACHE)
unset(TGUI_HAS_BACKEND_SDL_TTF_GLES2 CACHE)
unset(TGUI_HAS_BACKEND_GLFW_OPENGL3 CACHE)
unset(TGUI_HAS_BACKEND_GLFW_GLES2 CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_WINDOW_SFML CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_WINDOW_SDL CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_WINDOW_GLFW CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_RENDERER_SFML_GRAPHICS CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_RENDERER_SDL_RENDERER CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_RENDERER_OPENGL3 CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_RENDERER_GLES2 CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_FONT_SFML_GRAPHICS CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_FONT_SDL_TTF CACHE)
unset(TGUI_CUSTOM_BACKEND_HAS_FONT_FREETYPE CACHE)
if(NOT TGUI_BACKEND IN_LIST TGUI_BACKEND_OPTIONS)
message(FATAL_ERROR "TGUI_BACKEND was set to an unknown backend")
endif()
if(TGUI_BACKEND STREQUAL "SFML_GRAPHICS")
set(TGUI_HAS_BACKEND_SFML_GRAPHICS TRUE)
elseif(TGUI_BACKEND STREQUAL "SFML_OPENGL3")
set(TGUI_HAS_BACKEND_SFML_OPENGL3 TRUE)
elseif(TGUI_BACKEND STREQUAL "SDL_RENDERER")
set(TGUI_HAS_BACKEND_SDL_RENDERER TRUE)
elseif(TGUI_BACKEND STREQUAL "SDL_OPENGL3")
set(TGUI_HAS_BACKEND_SDL_OPENGL3 TRUE)
elseif(TGUI_BACKEND STREQUAL "SDL_GLES2")
set(TGUI_HAS_BACKEND_SDL_GLES2 TRUE)
elseif(TGUI_BACKEND STREQUAL "SDL_TTF_OPENGL3")
set(TGUI_HAS_BACKEND_SDL_TTF_OPENGL3 TRUE)
elseif(TGUI_BACKEND STREQUAL "SDL_TTF_GLES2")
set(TGUI_HAS_BACKEND_SDL_TTF_GLES2 TRUE)
elseif(TGUI_BACKEND STREQUAL "GLFW_OPENGL3")
set(TGUI_HAS_BACKEND_GLFW_OPENGL3 TRUE)
elseif(TGUI_BACKEND STREQUAL "GLFW_GLES2")
set(TGUI_HAS_BACKEND_GLFW_GLES2 TRUE)
else()
message(FATAL_ERROR "FIXME: Backend appeared in TGUI_BACKEND_OPTIONS but isn't being handled here!")
endif()
endif()
# Figure out which backend components are needed
tgui_assign_bool(TGUI_HAS_WINDOW_BACKEND_SFML
TGUI_HAS_BACKEND_SFML_GRAPHICS OR TGUI_HAS_BACKEND_SFML_OPENGL3 OR TGUI_CUSTOM_BACKEND_HAS_WINDOW_SFML)
tgui_assign_bool(TGUI_HAS_WINDOW_BACKEND_SDL
TGUI_HAS_BACKEND_SDL_RENDERER OR TGUI_HAS_BACKEND_SDL_OPENGL3 OR TGUI_HAS_BACKEND_SDL_GLES2
OR TGUI_HAS_BACKEND_SDL_TTF_OPENGL3 OR TGUI_HAS_BACKEND_SDL_TTF_GLES2
OR TGUI_CUSTOM_BACKEND_HAS_WINDOW_SDL OR TGUI_CUSTOM_BACKEND_HAS_RENDERER_SDL_RENDERER)
tgui_assign_bool(TGUI_HAS_WINDOW_BACKEND_GLFW
TGUI_HAS_BACKEND_GLFW_OPENGL3 OR TGUI_HAS_BACKEND_GLFW_GLES2 OR TGUI_CUSTOM_BACKEND_HAS_WINDOW_GLFW)
tgui_assign_bool(TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS
TGUI_HAS_BACKEND_SFML_GRAPHICS OR TGUI_CUSTOM_BACKEND_HAS_RENDERER_SFML_GRAPHICS)
tgui_assign_bool(TGUI_HAS_RENDERER_BACKEND_SDL_RENDERER
TGUI_HAS_BACKEND_SDL_RENDERER OR TGUI_CUSTOM_BACKEND_HAS_RENDERER_SDL_RENDERE