mirror of
https://github.com/GayPizzaSpecifications/padlab.git
synced 2025-08-03 21:21:33 +00:00
old backend selector
This commit is contained in:
@ -2,25 +2,12 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
|
||||
project(padlab C)
|
||||
set(TARGET padlab)
|
||||
|
||||
option(USE_METAL "use Metal for drawing" ${APPLE})
|
||||
if (USE_METAL)
|
||||
option(USE_OPENGL "Use OpenGL for drawing (WIP)" OFF)
|
||||
option(USE_OPENGL_LEGACY "Use legacy OpenGL for drawing" OFF)
|
||||
if (USE_OPENGL)
|
||||
message(FATAL_ERROR "USE_METAL and USE_OPENGL are both ON but only one backend can be used at a time, turn one OFF and regenerate. (or delete cache and try again)")
|
||||
elseif (USE_OPENGL_LEGACY)
|
||||
message(FATAL_ERROR "USE_METAL and USE_OPENGL_LEGACY are both ON but only one backend can be used at a time, turn one OFF and regenerate. (or delete cache and try again)")
|
||||
endif()
|
||||
else()
|
||||
option(USE_OPENGL "Use OpenGL for drawing (WIP)" OFF)
|
||||
if (USE_OPENGL)
|
||||
option(USE_OPENGL_LEGACY "Use legacy OpenGL for drawing" OFF)
|
||||
if (USE_OPENGL_LEGACY)
|
||||
message(FATAL_ERROR "USE_OPENGL and USE_OPENGL_LEGACY are both ON but only one backend can be used at a time, turn one OFF and regenerate. (or delete cache and try again)")
|
||||
endif()
|
||||
else()
|
||||
option(USE_OPENGL_LEGACY "Use legacy OpenGL for drawing" ON)
|
||||
endif()
|
||||
set(GFX_BACKEND "OPENGL_LEGACY" CACHE STRING "Graphics API to render with: \"SDL\", \"OPENGL_LEGACY\" 1.1 compatibility profile, \"OPENGL\" 3.3 core profile (WIP), \"METAL\"")
|
||||
|
||||
set(GL_BACKENDS OPENGL_LEGACY OPENGL)
|
||||
set(BACKENDS SDL ${GL_BACKENDS} METAL)
|
||||
if (NOT GFX_BACKEND IN_LIST BACKENDS)
|
||||
message(FATAL_ERROR "\"${GFX_BACKEND}\" is not a valid graphics backend, GFX_BACKEND may be one of: ${BACKENDS}")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
@ -33,7 +20,7 @@ elseif (MSVC)
|
||||
endif()
|
||||
|
||||
find_package(SDL2 REQUIRED)
|
||||
if (USE_OPENGL OR USE_OPENGL_LEGACY)
|
||||
if (GFX_BACKEND IN_LIST GL_BACKENDS)
|
||||
if (NOT DEFINED OpenGL_GL_PREFERENCE)
|
||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user