@@ -131,6 +131,7 @@ endif()
131131if ("${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} " )
181182endif ()
182183
184+ # Toggle for GLES (Required for many ARM/Mobile platforms)
185+ option (USE_OPENGLES "Use OpenGLES instead of Desktop OpenGL" OFF )
186+
183187# Set game compilation version
184188set (VERSION us)
185189set (USE_NETWORKING OFF )
@@ -191,6 +195,7 @@ set(GFX_DEBUG_DISASSEMBLER OFF)
191195# Add compile definitions for the target
192196add_compile_definitions (
193197 VERSION_US=1
198+ $<$<BOOL :${USE_OPENGLES} >:USE_OPENGLES >
194199 ENABLE_RUMBLE=1
195200 F3DEX_GBI=1
196201 _LANGUAGE_C
@@ -202,10 +207,6 @@ add_compile_definitions(
202207 SPAGHETTI_VERSION= "${PROJECT_VERSION} "
203208)
204209
205- # Find necessary libraries
206- if (UNIX AND NOT APPLE )
207- find_package (OpenGL REQUIRED )
208- endif ()
209210
210211if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
211212 configure_file ( ${CMAKE_CURRENT_SOURCE_DIR} /properties.h.in ${CMAKE_CURRENT_SOURCE_DIR} /properties.h @ONLY )
@@ -315,6 +316,25 @@ else()
315316 add_executable (${PROJECT_NAME} ${ALL_FILES} )
316317endif ()
317318
319+ ################################################################################
320+ # OpenGL / OpenGLES library
321+ ################################################################################
322+ if (UNIX AND NOT APPLE )
323+ if (USE_OPENGLES)
324+ find_library (GLESv2_LIBRARY GLESv2 REQUIRED )
325+
326+ target_link_libraries (${PROJECT_NAME} PRIVATE
327+ ${GLESv2_LIBRARY}
328+ )
329+
330+ target_compile_definitions (${PROJECT_NAME} PRIVATE
331+ USE_OPENGLES=1
332+ )
333+ else ()
334+ find_package (OpenGL REQUIRED )
335+ target_link_libraries (${PROJECT_NAME} PRIVATE OpenGL::GL )
336+ endif ()
337+ endif ()
318338
319339################################################################################
320340# MSVC runtime library
@@ -398,10 +418,13 @@ include_directories(
398418 ${CMAKE_CURRENT_SOURCE_DIR} /libultraship/include
399419 ${CMAKE_CURRENT_SOURCE_DIR} /libultraship/include/libultraship
400420 ${SDL2_INCLUDE_DIRS}
401- ${GLEW_INCLUDE_DIRS}
402421 ${dr_libs_SOURCE_DIR}
403422)
404423
424+ if (NOT USE_OPENGLES)
425+ include_directories (${GLEW_INCLUDE_DIRS} )
426+ endif ()
427+
405428add_subdirectory (libultraship ${CMAKE_CURRENT_SOURCE_DIR} /libultraship )
406429add_dependencies (${PROJECT_NAME} libultraship )
407430target_link_libraries (${PROJECT_NAME} PRIVATE libultraship )
0 commit comments