Add options for GL and GLES selection

Fallback to autodetect or OpenGL Desktop if no option is selected.
This commit is contained in:
gizmo98 2017-08-19 14:33:50 +02:00
parent 471b1e66a6
commit 43c9043856

View file

@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 2.8)
option(GLES "Set to ON if targeting OpenGL ES" ${GLES})
option(GL "Set to ON if targeting Desktop OpenGL" ${GL})
project(emulationstation-all)
#-------------------------------------------------------------------------------
@ -11,33 +14,30 @@ LIST(APPEND CMAKE_MODULE_PATH
#-------------------------------------------------------------------------------
#set up OpenGL system variable
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "OpenGL ES")
if(GLES)
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
elseif(GL)
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
#-------------------------------------------------------------------------------
#check if we're running on Raspberry Pi
MESSAGE("Looking for bcm_host.h")
if(EXISTS "/opt/vc/include/bcm_host.h")
elseif(EXISTS "/opt/vc/include/bcm_host.h")
MESSAGE("bcm_host.h found")
set(BCMHOST found)
set(GLSystem "OpenGL ES")
else()
MESSAGE("bcm_host.h not found")
endif()
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
#-------------------------------------------------------------------------------
#check if we're running on olinuxino / odroid / etc
MESSAGE("Looking for libMali.so")
if(EXISTS "/usr/lib/libMali.so" OR
EXISTS "/usr/lib/arm-linux-gnueabihf/libMali.so" OR
EXISTS "/usr/lib/aarch64-linux-gnu/libMali.so" OR
EXISTS "/usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so" OR
EXISTS "/usr/lib/arm-linux-gnueabihf/libmali.so")
elseif(EXISTS "/usr/lib/libMali.so" OR
EXISTS "/usr/lib/arm-linux-gnueabihf/libMali.so" OR
EXISTS "/usr/lib/aarch64-linux-gnu/libMali.so" OR
EXISTS "/usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so" OR
EXISTS "/usr/lib/arm-linux-gnueabihf/libmali.so")
MESSAGE("libMali.so found")
set(GLSystem "OpenGL ES")
set(GLSystem "OpenGL ES" CACHE STRING "The OpenGL system to be used")
else()
MESSAGE("libMali.so not found")
endif()
set(GLSystem "Desktop OpenGL" CACHE STRING "The OpenGL system to be used")
endif(GLES)
set_property(CACHE GLSystem PROPERTY STRINGS "Desktop OpenGL" "OpenGL ES")
#finding necessary packages
#-------------------------------------------------------------------------------