VERY experimental Nintendo Switch 2 emulator
C++
Add Qt5 option. Use Qt5 by default.
Sacha90f23020f53c
diff --git a/.travis-build.sh b/.travis-build.shindex 35a908bfb9..672d282cc4 100644--- a/.travis-build.sh+++ b/.travis-build.sh@@ -5,7 +5,7 @@ set -e#if OS is linux or is not setif [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; thenmkdir build && cd build- cmake ..+ cmake -DUSE_QT5=OFF ..make -j4elif [ "$TRAVIS_OS_NAME" = osx ]; thenmkdir build && cd builddiff --git a/.travis-deps.sh b/.travis-deps.shindex 326ba2d090..04450a4c82 100644--- a/.travis-deps.sh+++ b/.travis-deps.sh@@ -14,5 +14,5 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; thencd -elif [ "$TRAVIS_OS_NAME" = osx ]; thenbrew tap homebrew/versions- brew install glew qt glfw3 pkgconfig+ brew install glew qt5 glfw3 pkgconfigfidiff --git a/CMakeLists.txt b/CMakeLists.txtindex ed790adf7f..56f5d02b03 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1,4 +1,4 @@-cmake_minimum_required(VERSION 2.8.6)+cmake_minimum_required(VERSION 2.8.7)project(citra)@@ -33,17 +33,29 @@ include_directories(${GLEW_INCLUDE_PATH})# workaround for GLFW linking on OSXlink_directories(${GLFW_LIBRARY_DIRS})-option(DISABLE_QT4 "Disable Qt4 GUI" OFF)-if(NOT DISABLE_QT4)- include(FindQt4)- find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL)-- if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND)- include(${QT_USE_FILE})- include_directories(${QT_INCLUDES})- include_directories(externals/qhexedit)- else()- message("Qt4 libraries not found! Disabling Qt4 GUI")+option(DISABLE_QT "Disable Qt GUI" OFF)+option(USE_QT5 "Use Qt5 when available" ON)+if (NOT DISABLE_QT)+ if(USE_QT5)+ find_package(Qt5Gui)+ find_package(Qt5Widgets)+ find_package(Qt5OpenGL)+ if(NOT Qt5Gui_FOUND OR NOT Qt5Widgets_FOUND OR NOT Qt5OpenGL_FOUND)+ message("Qt5 libraries not found! Using Qt4 instead.")+ set(USE_QT5 OFF)+ endif()+ endif()+ if(NOT USE_QT5)+ include(FindQt4)+ find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL)++ if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND)+ include(${QT_USE_FILE})+ include_directories(${QT_INCLUDES})+ else()+ message("Qt4 libraries not found! Disabling Qt GUI")+ set(DISABLE_QT ON)+ endif()endif()endif()@@ -57,7 +69,8 @@ git_branch_name(GIT_BRANCH)include_directories(src)# process subdirectories-if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND AND NOT DISABLE_QT4)+if(NOT DISABLE_QT)+ include_directories(externals/qhexedit)add_subdirectory(externals/qhexedit)endif()add_subdirectory(src)diff --git a/externals/qhexedit/CMakeLists.txt b/externals/qhexedit/CMakeLists.txtindex 29ed5d2ba9..b1f631f959 100644--- a/externals/qhexedit/CMakeLists.txt+++ b/externals/qhexedit/CMakeLists.txt@@ -1,4 +1,5 @@set(CMAKE_AUTOMOC ON)+set(CMAKE_INCLUDE_CURRENT_DIR ON)set(SRCScommands.cpp@@ -10,6 +11,8 @@ set(HEADERSqhexedit.hqhexedit_p.h)-include_directories(${CMAKE_CURRENT_BINARY_DIR})-add_library(qhexedit STATIC ${SRCS} ${HEADERS})+if(USE_QT5)+ target_link_libraries(qhexedit Qt5::Core Qt5::Widgets)+endif()+diff --git a/externals/qhexedit/qhexedit_p.cpp b/externals/qhexedit/qhexedit_p.cppindex c16f4ce4d3..2a6885de8f 100644--- a/externals/qhexedit/qhexedit_p.cpp+++ b/externals/qhexedit/qhexedit_p.cpp@@ -1,5 +1,3 @@-#include <QtGui>-#include "qhexedit_p.h"#include "commands.h"@@ -437,7 +435,7 @@ void QHexEditPrivate::keyPressEvent(QKeyEvent *event)if (!_readOnly){/* Hex input */- int key = int(event->text()[0].toAscii());+ int key = int(event->text()[0].toLatin1());if ((key>='0' && key<='9') || (key>='a' && key <= 'f')){if (getSelectionBegin() != getSelectionEnd())diff --git a/externals/qhexedit/qhexedit_p.h b/externals/qhexedit/qhexedit_p.hindex 138139b90d..1c2c11cc24 100644--- a/externals/qhexedit/qhexedit_p.h+++ b/externals/qhexedit/qhexedit_p.h@@ -5,6 +5,9 @@#include <QtGui>+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)+#include <QtWidgets>+#endif#include "xbytearray.h"class QHexEditPrivate : public QWidgetdiff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txtindex 5ce4e3f16e..ff1fbc4602 100644--- a/src/citra_qt/CMakeLists.txt+++ b/src/citra_qt/CMakeLists.txt@@ -14,7 +14,7 @@ set(SRCSconfig/controller_config.cppconfig/controller_config_util.cpp)-set (HEADERS+set(HEADERSbootmanager.hxxdebugger/callstack.hxxdebugger/disassembler.hxx@@ -26,24 +26,30 @@ set (HEADERSconfig/controller_config.hxxconfig/controller_config_util.hxx)-qt4_wrap_ui(UI_HDRS- debugger/callstack.ui- debugger/disassembler.ui- debugger/registers.ui- hotkeys.ui- main.ui- config/controller_config.ui)+set(UIS+ debugger/callstack.ui+ debugger/disassembler.ui+ debugger/registers.ui+ hotkeys.ui+ main.ui+ config/controller_config.ui)-# add uic results to include directories-include_directories(${CMAKE_CURRENT_BINARY_DIR})+if(USE_QT5)+ qt5_wrap_ui(UI_HDRS ${UIS})+else()+ qt4_wrap_ui(UI_HDRS ${UIS})+endif()-add_executable(citra-qt ${SRCS} ${UI_HDRS})-if (APPLE)+add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})+if(APPLE)set(ICONV_LIBRARY iconv)else()set(RT_LIBRARY rt)endif()-target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY} ${GLFW_LIBRARIES})+target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY})+if(USE_QT5)+ target_link_libraries(citra-qt Qt5::Gui Qt5::Widgets Qt5::OpenGL)+endif()#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})