From 36fb807687480a75085559889d4796e093185d1b Mon Sep 17 00:00:00 2001 From: waddlesplash Date: Tue, 16 May 2017 16:29:47 -0400 Subject: [PATCH] Qt: Relax hard dependency on OpenGL. --- src/platform/qt/CMakeLists.txt | 13 +++++++------ src/platform/qt/DisplayGL.cpp | 4 ++++ src/platform/qt/DisplayGL.h | 4 ++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index 25069a1dc..3c1d7e665 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -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 diff --git a/src/platform/qt/DisplayGL.cpp b/src/platform/qt/DisplayGL.cpp index da3333fd4..26dd88d65 100644 --- a/src/platform/qt/DisplayGL.cpp +++ b/src/platform/qt/DisplayGL.cpp @@ -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 #include #include @@ -483,3 +485,5 @@ void PainterGL::clearShaders() { VideoShader* PainterGL::shaders() { return &m_shader; } + +#endif diff --git a/src/platform/qt/DisplayGL.h b/src/platform/qt/DisplayGL.h index 0a7227c01..437bea7a0 100644 --- a/src/platform/qt/DisplayGL.h +++ b/src/platform/qt/DisplayGL.h @@ -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