forked from suyu/suyu
Add Qt5 option. Use Qt5 by default.
This commit is contained in:
parent
e9c5c563a5
commit
90f23020f5
7 changed files with 55 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
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})
|
||||
include_directories(externals/qhexedit)
|
||||
else()
|
||||
message("Qt4 libraries not found! Disabling Qt4 GUI")
|
||||
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)
|
||||
|
|
7
externals/qhexedit/CMakeLists.txt
vendored
7
externals/qhexedit/CMakeLists.txt
vendored
|
@ -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()
|
||||
|
||||
|
|
4
externals/qhexedit/qhexedit_p.cpp
vendored
4
externals/qhexedit/qhexedit_p.cpp
vendored
|
@ -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())
|
||||
|
|
3
externals/qhexedit/qhexedit_p.h
vendored
3
externals/qhexedit/qhexedit_p.h
vendored
|
@ -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
|
||||
|
|
|
@ -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})
|
||||
|
|
Loading…
Reference in a new issue