Qt: Relax hard dependency on OpenGL.

This commit is contained in:
waddlesplash 2017-05-16 16:29:47 -04:00 committed by endrift
parent 11afd59cda
commit 36fb807687
3 changed files with 15 additions and 6 deletions

View File

@ -35,12 +35,10 @@ find_package(Qt5OpenGL)
find_package(Qt5Widgets)
if(NOT BUILD_GL AND NOT BUILD_GLES2)
message(WARNING "OpenGL is required to build the Qt port")
set(BUILD_QT OFF PARENT_SCOPE)
return()
message(WARNING "OpenGL is recommended to build the Qt port")
endif()
if(NOT Qt5OpenGL_FOUND OR NOT Qt5Widgets_FOUND)
if(NOT Qt5Widgets_FOUND)
message(WARNING "Cannot find Qt modules")
set(BUILD_QT OFF PARENT_SCOPE)
return()
@ -243,8 +241,11 @@ qt5_wrap_ui(UI_SRC ${UI_FILES})
add_executable(${BINARY_NAME}-qt WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${PLATFORM_SRC} ${UI_SRC} ${AUDIO_SRC} ${RESOURCES})
set_target_properties(${BINARY_NAME}-qt PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/res/info.plist.in COMPILE_DEFINITIONS "${FEATURE_DEFINES};${FUNCTION_DEFINES};${OS_DEFINES};${QT_DEFINES}")
list(APPEND QT_LIBRARIES Qt5::Widgets Qt5::OpenGL)
target_link_libraries(${BINARY_NAME}-qt ${PLATFORM_LIBRARY} ${BINARY_NAME} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
list(APPEND QT_LIBRARIES Qt5::Widgets)
if(BUILD_GL OR BUILD_GLES2)
list(APPEND QT_LIBRARIES Qt5::OpenGL ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY})
endif()
target_link_libraries(${BINARY_NAME}-qt ${PLATFORM_LIBRARY} ${BINARY_NAME} ${QT_LIBRARIES})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
install(TARGETS ${BINARY_NAME}-qt

View File

@ -5,6 +5,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DisplayGL.h"
#if defined(BUILD_GL) || defined(BUILD_GLES)
#include <QApplication>
#include <QResizeEvent>
#include <QTimer>
@ -483,3 +485,5 @@ void PainterGL::clearShaders() {
VideoShader* PainterGL::shaders() {
return &m_shader;
}
#endif

View File

@ -6,6 +6,8 @@
#ifndef QGBA_DISPLAY_GL
#define QGBA_DISPLAY_GL
#if defined(BUILD_GL) || defined(BUILD_GLES)
#include "Display.h"
#ifdef USE_EPOXY
@ -128,3 +130,5 @@ private:
}
#endif
#endif