all repos — mgba @ 87d26d39f9758d53b5677b6fc71cdd3ea679ecea

mGBA Game Boy Advance Emulator

All: Clean up OpenGL detection
Jeffrey Pfau jeffrey@endrift.com
Sat, 13 Jun 2015 03:01:43 -0700
commit

87d26d39f9758d53b5677b6fc71cdd3ea679ecea

parent

fe845d1ee8f35b03281625b82b95dd45518c9706

3 files changed, 11 insertions(+), 6 deletions(-)

jump to
M CMakeLists.txtCMakeLists.txt

@@ -16,6 +16,7 @@ set(BUILD_LIBRETRO OFF CACHE BOOL "Build libretro core")

set(BUILD_PERF OFF CACHE BOOL "Build performance profiling tool") set(BUILD_STATIC OFF CACHE BOOL "Build a static library") set(BUILD_SHARED ON CACHE BOOL "Build a shared library") +set(BUILD_GL ON CACHE STRING "Build with OpenGL") file(GLOB ARM_SRC ${CMAKE_SOURCE_DIR}/src/arm/*.c) file(GLOB GBA_SRC ${CMAKE_SOURCE_DIR}/src/gba/*.c) file(GLOB GBA_CHEATS_SRC ${CMAKE_SOURCE_DIR}/src/gba/cheats/*.c)

@@ -146,6 +147,12 @@ list(APPEND LIBEDIT_LIBRARIES -ltermcap)

endif() else() find_feature(USE_CLI_DEBUGGER "libedit") +endif() +if(BUILD_GL) + find_package(OpenGL QUIET) + if(NOT OPENGL_FOUND) + set(BUILD_GL OFF) + endif() endif() find_feature(USE_FFMPEG "libavcodec;libavformat;libavresample;libavutil;libswscale") find_feature(USE_PNG "ZLIB;PNG")

@@ -398,6 +405,10 @@ install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-256.png DESTINATION share/icons/hicolor/256x256/apps RENAME mgba.png COMPONENT lib${BINARY_NAME})

install(FILES ${CMAKE_SOURCE_DIR}/res/mgba-512.png DESTINATION share/icons/hicolor/512x512/apps RENAME mgba.png COMPONENT lib${BINARY_NAME}) endif() set_target_properties(${BINARY_NAME} PROPERTIES VERSION ${LIB_VERSION_STRING} SOVERSION ${LIB_VERSION_ABI} COMPILE_DEFINITIONS "${FEATURE_DEFINES}") + +if(BUILD_GL) + add_definitions(-DBUILD_GL) +endif() if(BUILD_LIBRETRO) file(GLOB RETRO_SRC ${CMAKE_SOURCE_DIR}/src/platform/libretro/*.c)
M src/platform/qt/CMakeLists.txtsrc/platform/qt/CMakeLists.txt

@@ -31,7 +31,6 @@

find_package(Qt5Multimedia) find_package(Qt5OpenGL) find_package(Qt5Widgets) -find_package(OpenGL) if(NOT Qt5OpenGL_FOUND OR NOT Qt5Widgets_FOUND OR NOT OPENGL_FOUND) message(WARNING "Cannot find Qt modules")
M src/platform/sdl/CMakeLists.txtsrc/platform/sdl/CMakeLists.txt

@@ -1,5 +1,4 @@

set(SDL_VERSION "2" CACHE STRING "Version of SDL to use (1.2 or 2)") -set(BUILD_GL ON CACHE STRING "Build with OpenGL") if (SDL_VERSION EQUAL "2") include(FindPkgConfig)

@@ -66,12 +65,8 @@ list(APPEND MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/pandora-sdl.c)

else() list(APPEND MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/sw-sdl.c) if(BUILD_GL) - find_package(OpenGL) - endif() - if(OPENGL_FOUND) list(APPEND MAIN_SRC ${CMAKE_SOURCE_DIR}/src/platform/sdl/gl-sdl.c) list(APPEND PLATFORM_SRC ${CMAKE_SOURCE_DIR}/src/platform/opengl/gl.c) - add_definitions(-DBUILD_GL) include_directories(${OPENGL_INCLUDE_DIR}) endif() endif()