diff options
| author | 2014-08-19 19:08:01 -0400 | |
|---|---|---|
| committer | 2014-08-19 19:08:01 -0400 | |
| commit | bc64261d2902cf5e9342c9013d2fe028c3ffd440 (patch) | |
| tree | f92bd53642e09d2cfbd361b4b6a260539c7d620a | |
| parent | Merge pull request #61 from lioncash/kernel-stuff (diff) | |
| parent | Add Qt5 option. Use Qt5 by default. (diff) | |
| download | yuzu-bc64261d2902cf5e9342c9013d2fe028c3ffd440.tar.gz yuzu-bc64261d2902cf5e9342c9013d2fe028c3ffd440.tar.xz yuzu-bc64261d2902cf5e9342c9013d2fe028c3ffd440.zip | |
Merge pull request #60 from xsacha/qt5
Use Qt5 by default for citra-qt project.
| -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 | |||
| 5 | #if OS is linux or is not set | 5 | #if OS is linux or is not set |
| 6 | if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then | 6 | if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then |
| 7 | mkdir build && cd build | 7 | mkdir build && cd build |
| 8 | cmake .. | 8 | cmake -DUSE_QT5=OFF .. |
| 9 | make -j4 | 9 | make -j4 |
| 10 | elif [ "$TRAVIS_OS_NAME" = osx ]; then | 10 | elif [ "$TRAVIS_OS_NAME" = osx ]; then |
| 11 | mkdir build && cd build | 11 | 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 | |||
| 14 | cd - | 14 | cd - |
| 15 | elif [ "$TRAVIS_OS_NAME" = osx ]; then | 15 | elif [ "$TRAVIS_OS_NAME" = osx ]; then |
| 16 | brew tap homebrew/versions | 16 | brew tap homebrew/versions |
| 17 | brew install glew qt glfw3 pkgconfig | 17 | brew install glew qt5 glfw3 pkgconfig |
| 18 | fi | 18 | fi |
diff --git a/CMakeLists.txt b/CMakeLists.txt index ed790adf7..56f5d02b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | cmake_minimum_required(VERSION 2.8.6) | 1 | cmake_minimum_required(VERSION 2.8.7) |
| 2 | 2 | ||
| 3 | project(citra) | 3 | project(citra) |
| 4 | 4 | ||
| @@ -33,17 +33,29 @@ include_directories(${GLEW_INCLUDE_PATH}) | |||
| 33 | # workaround for GLFW linking on OSX | 33 | # workaround for GLFW linking on OSX |
| 34 | link_directories(${GLFW_LIBRARY_DIRS}) | 34 | link_directories(${GLFW_LIBRARY_DIRS}) |
| 35 | 35 | ||
| 36 | option(DISABLE_QT4 "Disable Qt4 GUI" OFF) | 36 | option(DISABLE_QT "Disable Qt GUI" OFF) |
| 37 | if(NOT DISABLE_QT4) | 37 | option(USE_QT5 "Use Qt5 when available" ON) |
| 38 | include(FindQt4) | 38 | if (NOT DISABLE_QT) |
| 39 | find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL) | 39 | if(USE_QT5) |
| 40 | 40 | find_package(Qt5Gui) | |
| 41 | if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND) | 41 | find_package(Qt5Widgets) |
| 42 | include(${QT_USE_FILE}) | 42 | find_package(Qt5OpenGL) |
| 43 | include_directories(${QT_INCLUDES}) | 43 | if(NOT Qt5Gui_FOUND OR NOT Qt5Widgets_FOUND OR NOT Qt5OpenGL_FOUND) |
| 44 | include_directories(externals/qhexedit) | 44 | message("Qt5 libraries not found! Using Qt4 instead.") |
| 45 | else() | 45 | set(USE_QT5 OFF) |
| 46 | message("Qt4 libraries not found! Disabling Qt4 GUI") | 46 | endif() |
| 47 | endif() | ||
| 48 | if(NOT USE_QT5) | ||
| 49 | include(FindQt4) | ||
| 50 | find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL) | ||
| 51 | |||
| 52 | if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND) | ||
| 53 | include(${QT_USE_FILE}) | ||
| 54 | include_directories(${QT_INCLUDES}) | ||
| 55 | else() | ||
| 56 | message("Qt4 libraries not found! Disabling Qt GUI") | ||
| 57 | set(DISABLE_QT ON) | ||
| 58 | endif() | ||
| 47 | endif() | 59 | endif() |
| 48 | endif() | 60 | endif() |
| 49 | 61 | ||
| @@ -57,7 +69,8 @@ git_branch_name(GIT_BRANCH) | |||
| 57 | include_directories(src) | 69 | include_directories(src) |
| 58 | 70 | ||
| 59 | # process subdirectories | 71 | # process subdirectories |
| 60 | if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND AND NOT DISABLE_QT4) | 72 | if(NOT DISABLE_QT) |
| 73 | include_directories(externals/qhexedit) | ||
| 61 | add_subdirectory(externals/qhexedit) | 74 | add_subdirectory(externals/qhexedit) |
| 62 | endif() | 75 | endif() |
| 63 | add_subdirectory(src) | 76 | 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 @@ | |||
| 1 | set(CMAKE_AUTOMOC ON) | 1 | set(CMAKE_AUTOMOC ON) |
| 2 | set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
| 2 | 3 | ||
| 3 | set(SRCS | 4 | set(SRCS |
| 4 | commands.cpp | 5 | commands.cpp |
| @@ -10,6 +11,8 @@ set(HEADERS | |||
| 10 | qhexedit.h | 11 | qhexedit.h |
| 11 | qhexedit_p.h) | 12 | qhexedit_p.h) |
| 12 | 13 | ||
| 13 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
| 14 | |||
| 15 | add_library(qhexedit STATIC ${SRCS} ${HEADERS}) | 14 | add_library(qhexedit STATIC ${SRCS} ${HEADERS}) |
| 15 | if(USE_QT5) | ||
| 16 | target_link_libraries(qhexedit Qt5::Core Qt5::Widgets) | ||
| 17 | endif() | ||
| 18 | |||
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 @@ | |||
| 1 | #include <QtGui> | ||
| 2 | |||
| 3 | #include "qhexedit_p.h" | 1 | #include "qhexedit_p.h" |
| 4 | #include "commands.h" | 2 | #include "commands.h" |
| 5 | 3 | ||
| @@ -437,7 +435,7 @@ void QHexEditPrivate::keyPressEvent(QKeyEvent *event) | |||
| 437 | if (!_readOnly) | 435 | if (!_readOnly) |
| 438 | { | 436 | { |
| 439 | /* Hex input */ | 437 | /* Hex input */ |
| 440 | int key = int(event->text()[0].toAscii()); | 438 | int key = int(event->text()[0].toLatin1()); |
| 441 | if ((key>='0' && key<='9') || (key>='a' && key <= 'f')) | 439 | if ((key>='0' && key<='9') || (key>='a' && key <= 'f')) |
| 442 | { | 440 | { |
| 443 | if (getSelectionBegin() != getSelectionEnd()) | 441 | 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 @@ | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | #include <QtGui> | 7 | #include <QtGui> |
| 8 | #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) | ||
| 9 | #include <QtWidgets> | ||
| 10 | #endif | ||
| 8 | #include "xbytearray.h" | 11 | #include "xbytearray.h" |
| 9 | 12 | ||
| 10 | class QHexEditPrivate : public QWidget | 13 | 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 | |||
| 14 | config/controller_config.cpp | 14 | config/controller_config.cpp |
| 15 | config/controller_config_util.cpp) | 15 | config/controller_config_util.cpp) |
| 16 | 16 | ||
| 17 | set (HEADERS | 17 | set(HEADERS |
| 18 | bootmanager.hxx | 18 | bootmanager.hxx |
| 19 | debugger/callstack.hxx | 19 | debugger/callstack.hxx |
| 20 | debugger/disassembler.hxx | 20 | debugger/disassembler.hxx |
| @@ -26,24 +26,30 @@ set (HEADERS | |||
| 26 | config/controller_config.hxx | 26 | config/controller_config.hxx |
| 27 | config/controller_config_util.hxx) | 27 | config/controller_config_util.hxx) |
| 28 | 28 | ||
| 29 | qt4_wrap_ui(UI_HDRS | 29 | set(UIS |
| 30 | debugger/callstack.ui | 30 | debugger/callstack.ui |
| 31 | debugger/disassembler.ui | 31 | debugger/disassembler.ui |
| 32 | debugger/registers.ui | 32 | debugger/registers.ui |
| 33 | hotkeys.ui | 33 | hotkeys.ui |
| 34 | main.ui | 34 | main.ui |
| 35 | config/controller_config.ui) | 35 | config/controller_config.ui) |
| 36 | 36 | ||
| 37 | # add uic results to include directories | 37 | if(USE_QT5) |
| 38 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | 38 | qt5_wrap_ui(UI_HDRS ${UIS}) |
| 39 | else() | ||
| 40 | qt4_wrap_ui(UI_HDRS ${UIS}) | ||
| 41 | endif() | ||
| 39 | 42 | ||
| 40 | add_executable(citra-qt ${SRCS} ${UI_HDRS}) | 43 | add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) |
| 41 | if (APPLE) | 44 | if(APPLE) |
| 42 | set(ICONV_LIBRARY iconv) | 45 | set(ICONV_LIBRARY iconv) |
| 43 | else() | 46 | else() |
| 44 | set(RT_LIBRARY rt) | 47 | set(RT_LIBRARY rt) |
| 45 | endif() | 48 | endif() |
| 46 | 49 | ||
| 47 | target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) | 50 | target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY}) |
| 51 | if(USE_QT5) | ||
| 52 | target_link_libraries(citra-qt Qt5::Gui Qt5::Widgets Qt5::OpenGL) | ||
| 53 | endif() | ||
| 48 | 54 | ||
| 49 | #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) | 55 | #install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) |