All: Clean up OpenGL detection

This commit is contained in:
Jeffrey Pfau 2015-06-13 03:01:43 -07:00
parent fe845d1ee8
commit 87d26d39f9
3 changed files with 11 additions and 6 deletions

View File

@ -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)
@ -147,6 +148,12 @@ if(CMAKE_SYSTEM_NAME MATCHES .*BSD)
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")
find_feature(USE_LIBZIP "libzip")
@ -399,6 +406,10 @@ if(UNIX AND NOT APPLE)
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)
add_library(${BINARY_NAME}_libretro SHARED ${CORE_SRC} ${RETRO_SRC})

View File

@ -31,7 +31,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
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")

View File

@ -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 @@ if(BUILD_PANDORA)
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()