diff options
| -rw-r--r-- | .travis-build.sh | 2 | ||||
| -rw-r--r-- | .travis-deps.sh | 2 | ||||
| -rw-r--r-- | CMakeLists.txt | 39 | ||||
| -rw-r--r-- | externals/qhexedit/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | externals/qhexedit/qhexedit_p.cpp | 4 | ||||
| -rw-r--r-- | externals/qhexedit/qhexedit_p.h | 3 | ||||
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 32 | 
7 files changed, 56 insertions, 33 deletions
| diff --git a/.travis-build.sh b/.travis-build.sh index 35a908bfb..672d282cc 100644 --- a/.travis-build.sh +++ b/.travis-build.sh @@ -5,7 +5,7 @@ set -e  #if OS is linux or is not set  if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then       mkdir build && cd build -    cmake ..  +    cmake -DUSE_QT5=OFF ..       make -j4  elif [ "$TRAVIS_OS_NAME" = osx ]; then      mkdir build && cd build diff --git a/.travis-deps.sh b/.travis-deps.sh index 326ba2d09..04450a4c8 100644 --- a/.travis-deps.sh +++ b/.travis-deps.sh @@ -14,5 +14,5 @@ if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then      cd -	  elif [ "$TRAVIS_OS_NAME" = osx ]; then      brew tap homebrew/versions -    brew install glew qt glfw3 pkgconfig +    brew install glew qt5 glfw3 pkgconfig  fi diff --git a/CMakeLists.txt b/CMakeLists.txt index ed790adf7..56f5d02b0 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 OSX  link_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.txt index 29ed5d2ba..b1f631f95 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(SRCS              commands.cpp @@ -10,6 +11,8 @@ set(HEADERS              qhexedit.h              qhexedit_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.cpp index c16f4ce4d..2a6885de8 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.h index 138139b90..1c2c11cc2 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 QWidget diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 5ce4e3f16..ff1fbc460 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -14,7 +14,7 @@ set(SRCS              config/controller_config.cpp              config/controller_config_util.cpp) -set (HEADERS +set(HEADERS              bootmanager.hxx              debugger/callstack.hxx              debugger/disassembler.hxx @@ -26,24 +26,30 @@ set (HEADERS              config/controller_config.hxx              config/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}) | 
