Skip to content

Commit b305812

Browse files
committed
Ensure OPENGLES flag can be used in CMakeLists.txt
1 parent 5a01415 commit b305812

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ endif()
131131
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|Clang|AppleClang")
132132
set(COMMON_FLAGS "-Wall -Wextra -Wno-error \
133133
-Wno-macro-redefined \
134+
-Wno-inconsistent-missing-override \
134135
-Wno-return-type \
135136
-Wno-unused-parameter \
136137
-Wno-unused-function \
@@ -180,6 +181,9 @@ else()
180181
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG ${COMMON_CXX_FLAGS}")
181182
endif()
182183

184+
# Toggle for GLES (Required for many ARM/Mobile platforms)
185+
option(USE_OPENGLES "Use OpenGLES instead of Desktop OpenGL" ON)
186+
183187
# Set game compilation version
184188
set(VERSION us)
185189
set(USE_NETWORKING OFF)
@@ -191,6 +195,7 @@ set(GFX_DEBUG_DISASSEMBLER OFF)
191195
# Add compile definitions for the target
192196
add_compile_definitions(
193197
VERSION_US=1
198+
$<$<BOOL:${USE_OPENGLES}>:USE_OPENGLES>
194199
ENABLE_RUMBLE=1
195200
F3DEX_GBI=1
196201
_LANGUAGE_C
@@ -204,7 +209,11 @@ add_compile_definitions(
204209

205210
# Find necessary libraries
206211
if (UNIX AND NOT APPLE)
207-
find_package(OpenGL REQUIRED)
212+
if (NOT USE_OPENGLES)
213+
find_package(OpenGL REQUIRED)
214+
else()
215+
set(ADDITIONAL_LIBRARY_DEPENDENCIES ${ADDITIONAL_LIBRARY_DEPENDENCIES} GLESv2)
216+
endif()
208217
endif()
209218

210219
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")

0 commit comments

Comments
 (0)