summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2014-08-19 19:08:01 -0400
committerGravatar bunnei2014-08-19 19:08:01 -0400
commitbc64261d2902cf5e9342c9013d2fe028c3ffd440 (patch)
treef92bd53642e09d2cfbd361b4b6a260539c7d620a
parentMerge pull request #61 from lioncash/kernel-stuff (diff)
parentAdd Qt5 option. Use Qt5 by default. (diff)
downloadyuzu-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.sh2
-rw-r--r--.travis-deps.sh2
-rw-r--r--CMakeLists.txt39
-rw-r--r--externals/qhexedit/CMakeLists.txt7
-rw-r--r--externals/qhexedit/qhexedit_p.cpp4
-rw-r--r--externals/qhexedit/qhexedit_p.h3
-rw-r--r--src/citra_qt/CMakeLists.txt32
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
6if [ "$TRAVIS_OS_NAME" = linux -o -z "$TRAVIS_OS_NAME" ]; then 6if [ "$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
10elif [ "$TRAVIS_OS_NAME" = osx ]; then 10elif [ "$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 -
15elif [ "$TRAVIS_OS_NAME" = osx ]; then 15elif [ "$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
18fi 18fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed790adf7..56f5d02b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
1cmake_minimum_required(VERSION 2.8.6) 1cmake_minimum_required(VERSION 2.8.7)
2 2
3project(citra) 3project(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
34link_directories(${GLFW_LIBRARY_DIRS}) 34link_directories(${GLFW_LIBRARY_DIRS})
35 35
36option(DISABLE_QT4 "Disable Qt4 GUI" OFF) 36option(DISABLE_QT "Disable Qt GUI" OFF)
37if(NOT DISABLE_QT4) 37option(USE_QT5 "Use Qt5 when available" ON)
38 include(FindQt4) 38if (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()
48endif() 60endif()
49 61
@@ -57,7 +69,8 @@ git_branch_name(GIT_BRANCH)
57include_directories(src) 69include_directories(src)
58 70
59# process subdirectories 71# process subdirectories
60if(QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTOPENGL_FOUND AND NOT DISABLE_QT4) 72if(NOT DISABLE_QT)
73 include_directories(externals/qhexedit)
61 add_subdirectory(externals/qhexedit) 74 add_subdirectory(externals/qhexedit)
62endif() 75endif()
63add_subdirectory(src) 76add_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 @@
1set(CMAKE_AUTOMOC ON) 1set(CMAKE_AUTOMOC ON)
2set(CMAKE_INCLUDE_CURRENT_DIR ON)
2 3
3set(SRCS 4set(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
13include_directories(${CMAKE_CURRENT_BINARY_DIR})
14
15add_library(qhexedit STATIC ${SRCS} ${HEADERS}) 14add_library(qhexedit STATIC ${SRCS} ${HEADERS})
15if(USE_QT5)
16 target_link_libraries(qhexedit Qt5::Core Qt5::Widgets)
17endif()
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)
437if (!_readOnly) 435if (!_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
10class QHexEditPrivate : public QWidget 13class 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
17set (HEADERS 17set(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
29qt4_wrap_ui(UI_HDRS 29set(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 37if(USE_QT5)
38include_directories(${CMAKE_CURRENT_BINARY_DIR}) 38 qt5_wrap_ui(UI_HDRS ${UIS})
39else()
40 qt4_wrap_ui(UI_HDRS ${UIS})
41endif()
39 42
40add_executable(citra-qt ${SRCS} ${UI_HDRS}) 43add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
41if (APPLE) 44if(APPLE)
42 set(ICONV_LIBRARY iconv) 45 set(ICONV_LIBRARY iconv)
43else() 46else()
44 set(RT_LIBRARY rt) 47 set(RT_LIBRARY rt)
45endif() 48endif()
46 49
47target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY} ${GLFW_LIBRARIES}) 50target_link_libraries(citra-qt core common video_core qhexedit ${ICONV_LIBRARY} ${COREFOUNDATION_LIBRARY} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${RT_LIBRARY} ${GLEW_LIBRARY})
51if(USE_QT5)
52 target_link_libraries(citra-qt Qt5::Gui Qt5::Widgets Qt5::OpenGL)
53endif()
48 54
49#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir}) 55#install(TARGETS citra-qt RUNTIME DESTINATION ${bindir})