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) find_package(Qt5Widgets)
if(NOT BUILD_GL AND NOT BUILD_GLES2) if(NOT BUILD_GL AND NOT BUILD_GLES2)
message(WARNING "OpenGL is required to build the Qt port") message(WARNING "OpenGL is recommended to build the Qt port")
set(BUILD_QT OFF PARENT_SCOPE)
return()
endif() endif()
if(NOT Qt5OpenGL_FOUND OR NOT Qt5Widgets_FOUND) if(NOT Qt5Widgets_FOUND)
message(WARNING "Cannot find Qt modules") message(WARNING "Cannot find Qt modules")
set(BUILD_QT OFF PARENT_SCOPE) set(BUILD_QT OFF PARENT_SCOPE)
return() 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}) 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}") 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) list(APPEND QT_LIBRARIES Qt5::Widgets)
target_link_libraries(${BINARY_NAME}-qt ${PLATFORM_LIBRARY} ${BINARY_NAME} ${QT_LIBRARIES} ${OPENGL_LIBRARY} ${OPENGLES2_LIBRARY}) 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) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE)
install(TARGETS ${BINARY_NAME}-qt install(TARGETS ${BINARY_NAME}-qt

View File

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

View File

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