Updated the CMake configuration for the new GLES3 renderer.

This commit is contained in:
Leon Styhre 2022-03-14 00:04:38 +01:00
parent a7db474a64
commit 4f21d94aa5

View file

@ -29,9 +29,8 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils
${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages) ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages)
# Define the options. # Define the options.
option(GL "Set to ON if targeting Desktop OpenGL" ${GL}) option(GL "Set to ON if targeting Desktop OpenGL 3.3" ${GL})
option(GLES1 "Set to ON if targeting OpenGL ES 1.0" ${GLES1}) option(GLES "Set to ON if targeting OpenGL ES 3.0" ${GLES})
option(GLES "Set to ON if targeting OpenGL ES 2.0" ${GLES})
option(RPI "Set to ON to enable Raspberry Pi specific build" ${RPI}) option(RPI "Set to ON to enable Raspberry Pi specific build" ${RPI})
option(BUNDLED_CERTS "Set to ON to use bundled TLS/SSL certificates" ${BUNDLED_CERTS}) option(BUNDLED_CERTS "Set to ON to use bundled TLS/SSL certificates" ${BUNDLED_CERTS})
option(CEC "Set to ON to enable CEC" ${CEC}) option(CEC "Set to ON to enable CEC" ${CEC})
@ -60,6 +59,27 @@ if(CLANG_TIDY)
endif() endif()
endif() endif()
#---------------------------------------------------------------------------------------------------
# Raspberry Pi setup.
# Raspberry Pi OS 32-bit (armv7l).
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
set(RPI ON)
set(RPI_32 ON)
set(GLES ON)
set(BCMHOST ON)
message("-- Building on a Raspberry Pi (32-bit OS)")
endif()
# Raspberry Pi OS 64-bit (aarch64).
if(EXISTS "/usr/include/bcm_host.h")
set(RPI ON)
set(RPI_64 ON)
set(GLES ON)
set(BCMHOST ON)
message("-- Building on a Raspberry Pi (64-bit OS)")
endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Emscripten WebAssembly build. # Emscripten WebAssembly build.
@ -71,7 +91,7 @@ endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# OpenGL setup. # OpenGL setup.
if(GLES1 OR GLES) if(GLES)
set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used") set(GLSYSTEM "Embedded OpenGL" CACHE STRING "The OpenGL system to be used")
else() else()
set(GLSYSTEM "Desktop OpenGL" CACHE STRING "The OpenGL system to be used") set(GLSYSTEM "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
@ -79,38 +99,12 @@ endif()
set_property(CACHE GLSYSTEM PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL") set_property(CACHE GLSYSTEM PROPERTY STRINGS "Desktop OpenGL" "Embedded OpenGL")
#---------------------------------------------------------------------------------------------------
# Raspberry Pi setup.
# Raspberry Pi OS 32-bit (armv7l).
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h")
set(RPI ON)
set(RPI_32 ON)
set(BCMHOST ON)
message("-- Building on a Raspberry Pi (32-bit OS)")
endif()
# Raspberry Pi OS 64-bit (aarch64).
if(EXISTS "/usr/include/bcm_host.h")
set(RPI ON)
set(RPI_64 ON)
set(BCMHOST ON)
message("-- Building on a Raspberry Pi (64-bit OS)")
endif()
# On the Raspberry Pi, desktop OpenGL 2.1 or OpenGL ES 2.0 should be used.
if(GLES1 AND RPI)
message(FATAL_ERROR "-- The OpenGL ES 1.0 renderer is not supported on Raspberry Pi")
endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Package dependencies. # Package dependencies.
if(GLSYSTEM MATCHES "Desktop OpenGL") if(GLSYSTEM MATCHES "Desktop OpenGL")
set(OpenGL_GL_PREFERENCE "GLVND") set(OpenGL_GL_PREFERENCE "GLVND")
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
elseif(GLES1)
find_package(OpenGLES REQUIRED)
elseif(GLES AND NOT EMSCRIPTEN) elseif(GLES AND NOT EMSCRIPTEN)
find_package(OpenGLES2 REQUIRED) find_package(OpenGLES2 REQUIRED)
endif() endif()
@ -281,12 +275,8 @@ endif()
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
# Preprocessor directives. # Preprocessor directives.
if(GLSYSTEM MATCHES "Desktop OpenGL") if(GLES)
add_definitions(-DUSE_OPENGL_21) add_definitions(-DUSE_OPENGLES)
elseif(GLES1)
add_definitions(-DUSE_OPENGLES_10)
elseif(GLES)
add_definitions(-DUSE_OPENGLES_20)
endif() endif()
if(RPI) if(RPI)
@ -526,8 +516,6 @@ endif()
# OpenGL. # OpenGL.
if(GLSYSTEM MATCHES "Desktop OpenGL") if(GLSYSTEM MATCHES "Desktop OpenGL")
list(APPEND COMMON_LIBRARIES ${OPENGL_LIBRARIES}) list(APPEND COMMON_LIBRARIES ${OPENGL_LIBRARIES})
elseif(GLES1)
list(APPEND COMMON_LIBRARIES EGL ${OPENGLES_LIBRARIES})
elseif(GLES) elseif(GLES)
list(APPEND COMMON_LIBRARIES ${OPENGLES2_LIBRARIES}) list(APPEND COMMON_LIBRARIES ${OPENGLES2_LIBRARIES})
endif() endif()