Skip to content

Commit

Permalink
Merge pull request #17 from tribal-tec/qt5
Browse files Browse the repository at this point in the history
Port to Qt5
  • Loading branch information
tribal-tec committed May 12, 2015
2 parents 4772084 + 61e0dc4 commit fc6bfa0
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CMake/common
Makefile
CMakeLists.txt.user
CMakeLists.txt.user*
build/
Lunchbox/
___*
2 changes: 1 addition & 1 deletion CMake/CPackConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set(CPACK_COMPONENT_DESKTOPSTREAMER_DEPENDS Deflect)
set(CPACK_COMPONENTS_ALL desktopstreamer lib)

# Linux Debian specific settings
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-core, libqt4-gui, libqt4-network, libturbojpeg" )
set(CPACK_DEBIAN_PACKAGE_DEPENDS "qtbase5-dev, libturbojpeg" )
set(CPACK_DEB_COMPONENT_INSTALL ON) # Set this to package only components in CPACK_COMPONENTS_ALL
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) # Don't make a separate package for each component

Expand Down
10 changes: 6 additions & 4 deletions CMake/Deflect.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@
set(DEFLECT_PACKAGE_VERSION 0.4)
set(DEFLECT_REPO_URL https://github.com/BlueBrain/Deflect.git)

set(DEFLECT_DEPENDS REQUIRED Boost LibJpegTurbo Qt4
OPTIONAL GLUT OpenGL Lunchbox)
set(QT5CONCURRENT_CMAKE_INCLUDE "BEFORE SYSTEM")
set(DEFLECT_DEPENDS REQUIRED Boost LibJpegTurbo Qt5Concurrent Qt5Core Qt5Network
Qt5Widgets
OPTIONAL GLUT Lunchbox OpenGL)
set(DEFLECT_BOOST_COMPONENTS "date_time program_options unit_test_framework serialization system thread")
set(DEFLECT_QT4_COMPONENTS "QtCore QtGui QtNetwork")
set(DEFLECT_DEB_DEPENDS libjpeg-turbo8-dev libturbojpeg freeglut3-dev
libboost-test-dev libboost-date-time-dev libboost-program-options-dev
libboost-serialization-dev libboost-system-dev libboost-thread-dev)
set(DEFLECT_PORT_DEPENDS boost freeglut)
set(DEFLECT_SUBPROJECT ON)

if(CI_BUILD_COMMIT)
set(DEFLECT_REPO_TAG ${CI_BUILD_COMMIT})
else()
set(DEFLECT_REPO_TAG master)
endif()
set(DEFLECT_FORCE_BUILD ON)
set(DEFLECT_SOURCE ${CMAKE_SOURCE_DIR})
set(DEFLECT_SOURCE ${CMAKE_SOURCE_DIR})
114 changes: 99 additions & 15 deletions CMake/FindPackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ endmacro()

common_package(Boost 1.41.0 REQUIRED COMPONENTS date_time program_options unit_test_framework serialization system thread)
common_package(LibJpegTurbo 1.2.1 REQUIRED )
common_package(Qt4 4.8 REQUIRED COMPONENTS QtCore QtGui QtNetwork)
common_package(Qt5Concurrent REQUIRED )
common_package(Qt5Core REQUIRED )
common_package(Qt5Network REQUIRED )
common_package(Qt5Widgets REQUIRED )
common_package(GLUT )
common_package(OpenGL )
common_package(Lunchbox )
Expand All @@ -80,6 +83,9 @@ if(Boost_name)
if(NOT "${${Boost_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(SYSTEM ${${Boost_name}_INCLUDE_DIRS})
endif()
if(NOT "${${Boost_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(SYSTEM ${${Boost_name}_INCLUDE_DIR})
endif()
endif()

if(LIBJPEGTURBO_FOUND)
Expand All @@ -99,24 +105,96 @@ if(LibJpegTurbo_name)
if(NOT "${${LibJpegTurbo_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(${${LibJpegTurbo_name}_INCLUDE_DIRS})
endif()
if(NOT "${${LibJpegTurbo_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(${${LibJpegTurbo_name}_INCLUDE_DIR})
endif()
endif()

if(QT4_FOUND)
set(Qt4_name QT4)
set(Qt4_FOUND TRUE)
elseif(Qt4_FOUND)
set(Qt4_name Qt4)
set(QT4_FOUND TRUE)
if(QT5CONCURRENT_FOUND)
set(Qt5Concurrent_name QT5CONCURRENT)
set(Qt5Concurrent_FOUND TRUE)
elseif(Qt5Concurrent_FOUND)
set(Qt5Concurrent_name Qt5Concurrent)
set(QT5CONCURRENT_FOUND TRUE)
endif()
if(Qt5Concurrent_name)
list(APPEND FIND_PACKAGES_DEFINES DEFLECT_USE_QT5CONCURRENT)
if(NOT COMMON_LIBRARY_TYPE MATCHES "SHARED")
list(APPEND DEFLECT_DEPENDENT_LIBRARIES Qt5Concurrent)
endif()
set(FIND_PACKAGES_FOUND "${FIND_PACKAGES_FOUND} Qt5Concurrent")
link_directories(${${Qt5Concurrent_name}_LIBRARY_DIRS})
if(NOT "${${Qt5Concurrent_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(BEFORE SYSTEM ${${Qt5Concurrent_name}_INCLUDE_DIRS})
endif()
if(NOT "${${Qt5Concurrent_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(BEFORE SYSTEM ${${Qt5Concurrent_name}_INCLUDE_DIR})
endif()
endif()

if(QT5CORE_FOUND)
set(Qt5Core_name QT5CORE)
set(Qt5Core_FOUND TRUE)
elseif(Qt5Core_FOUND)
set(Qt5Core_name Qt5Core)
set(QT5CORE_FOUND TRUE)
endif()
if(Qt4_name)
list(APPEND FIND_PACKAGES_DEFINES DEFLECT_USE_QT4)
if(Qt5Core_name)
list(APPEND FIND_PACKAGES_DEFINES DEFLECT_USE_QT5CORE)
if(NOT COMMON_LIBRARY_TYPE MATCHES "SHARED")
list(APPEND DEFLECT_DEPENDENT_LIBRARIES Qt4)
list(APPEND DEFLECT_DEPENDENT_LIBRARIES Qt5Core)
endif()
set(FIND_PACKAGES_FOUND "${FIND_PACKAGES_FOUND} Qt5Core")
link_directories(${${Qt5Core_name}_LIBRARY_DIRS})
if(NOT "${${Qt5Core_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(${${Qt5Core_name}_INCLUDE_DIRS})
endif()
set(FIND_PACKAGES_FOUND "${FIND_PACKAGES_FOUND} Qt4")
link_directories(${${Qt4_name}_LIBRARY_DIRS})
if(NOT "${${Qt4_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(SYSTEM ${${Qt4_name}_INCLUDE_DIRS})
if(NOT "${${Qt5Core_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(${${Qt5Core_name}_INCLUDE_DIR})
endif()
endif()

if(QT5NETWORK_FOUND)
set(Qt5Network_name QT5NETWORK)
set(Qt5Network_FOUND TRUE)
elseif(Qt5Network_FOUND)
set(Qt5Network_name Qt5Network)
set(QT5NETWORK_FOUND TRUE)
endif()
if(Qt5Network_name)
list(APPEND FIND_PACKAGES_DEFINES DEFLECT_USE_QT5NETWORK)
if(NOT COMMON_LIBRARY_TYPE MATCHES "SHARED")
list(APPEND DEFLECT_DEPENDENT_LIBRARIES Qt5Network)
endif()
set(FIND_PACKAGES_FOUND "${FIND_PACKAGES_FOUND} Qt5Network")
link_directories(${${Qt5Network_name}_LIBRARY_DIRS})
if(NOT "${${Qt5Network_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(${${Qt5Network_name}_INCLUDE_DIRS})
endif()
if(NOT "${${Qt5Network_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(${${Qt5Network_name}_INCLUDE_DIR})
endif()
endif()

if(QT5WIDGETS_FOUND)
set(Qt5Widgets_name QT5WIDGETS)
set(Qt5Widgets_FOUND TRUE)
elseif(Qt5Widgets_FOUND)
set(Qt5Widgets_name Qt5Widgets)
set(QT5WIDGETS_FOUND TRUE)
endif()
if(Qt5Widgets_name)
list(APPEND FIND_PACKAGES_DEFINES DEFLECT_USE_QT5WIDGETS)
if(NOT COMMON_LIBRARY_TYPE MATCHES "SHARED")
list(APPEND DEFLECT_DEPENDENT_LIBRARIES Qt5Widgets)
endif()
set(FIND_PACKAGES_FOUND "${FIND_PACKAGES_FOUND} Qt5Widgets")
link_directories(${${Qt5Widgets_name}_LIBRARY_DIRS})
if(NOT "${${Qt5Widgets_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(${${Qt5Widgets_name}_INCLUDE_DIRS})
endif()
if(NOT "${${Qt5Widgets_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(${${Qt5Widgets_name}_INCLUDE_DIR})
endif()
endif()

Expand All @@ -137,6 +215,9 @@ if(GLUT_name)
if(NOT "${${GLUT_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(${${GLUT_name}_INCLUDE_DIRS})
endif()
if(NOT "${${GLUT_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(${${GLUT_name}_INCLUDE_DIR})
endif()
endif()

if(OPENGL_FOUND)
Expand All @@ -156,6 +237,9 @@ if(OpenGL_name)
if(NOT "${${OpenGL_name}_INCLUDE_DIRS}" MATCHES "-NOTFOUND")
include_directories(${${OpenGL_name}_INCLUDE_DIRS})
endif()
if(NOT "${${OpenGL_name}_INCLUDE_DIR}" MATCHES "-NOTFOUND")
include_directories(${${OpenGL_name}_INCLUDE_DIR})
endif()
endif()

if(LUNCHBOX_FOUND)
Expand All @@ -182,7 +266,7 @@ endif()

set(DEFLECT_BUILD_DEBS autoconf;automake;cmake;doxygen;freeglut3-dev;git;git-review;libboost-date-time-dev;libboost-program-options-dev;libboost-serialization-dev;libboost-system-dev;libboost-test-dev;libboost-thread-dev;libjpeg-turbo8-dev;libturbojpeg;pkg-config;subversion)

set(DEFLECT_DEPENDS Boost;LibJpegTurbo;Qt4;GLUT;OpenGL;Lunchbox)
set(DEFLECT_DEPENDS Boost;LibJpegTurbo;Qt5Concurrent;Qt5Core;Qt5Network;Qt5Widgets;GLUT;Lunchbox;OpenGL)

# Write defines.h and options.cmake
if(NOT PROJECT_INCLUDE_NAME)
Expand Down
18 changes: 15 additions & 3 deletions CMake/FindRequired.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,21 @@ common_package(LibJpegTurbo 1.2.1 QUIET)
if(NOT LibJpegTurbo_FOUND AND NOT LIBJPEGTURBO_FOUND)
set(FIND_REQUIRED_FAILED "${FIND_REQUIRED_FAILED} LibJpegTurbo")
endif()
common_package(Qt4 4.8 COMPONENTS QtCore QtGui QtNetwork QUIET)
if(NOT Qt4_FOUND AND NOT QT4_FOUND)
set(FIND_REQUIRED_FAILED "${FIND_REQUIRED_FAILED} Qt4")
common_package(Qt5Concurrent QUIET)
if(NOT Qt5Concurrent_FOUND AND NOT QT5CONCURRENT_FOUND)
set(FIND_REQUIRED_FAILED "${FIND_REQUIRED_FAILED} Qt5Concurrent")
endif()
common_package(Qt5Core QUIET)
if(NOT Qt5Core_FOUND AND NOT QT5CORE_FOUND)
set(FIND_REQUIRED_FAILED "${FIND_REQUIRED_FAILED} Qt5Core")
endif()
common_package(Qt5Network QUIET)
if(NOT Qt5Network_FOUND AND NOT QT5NETWORK_FOUND)
set(FIND_REQUIRED_FAILED "${FIND_REQUIRED_FAILED} Qt5Network")
endif()
common_package(Qt5Widgets QUIET)
if(NOT Qt5Widgets_FOUND AND NOT QT5WIDGETS_FOUND)
set(FIND_REQUIRED_FAILED "${FIND_REQUIRED_FAILED} Qt5Widgets")
endif()

if(FIND_REQUIRED_FAILED)
Expand Down
2 changes: 1 addition & 1 deletion CMake/depends.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
config.bluebrain https://github.com/BlueBrain/config.git master
config.bluebrain https://github.com/BlueBrain/config.git master
6 changes: 3 additions & 3 deletions apps/DesktopStreamer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ set(DESKTOPSTREAMER_SOURCES
MainWindow.cpp
)

set(DESKTOPSTREAMER_LINK_LIBRARIES Deflect ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
set(DESKTOPSTREAMER_LINK_LIBRARIES Deflect ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES})

set(DESKTOPSTREAMER_RESOURCES resources.qrc)

qt4_wrap_cpp(MOC_OUTFILES ${DESKTOPSTREAMER_MOC_HEADERS})
qt4_add_resources(QRC_SOURCES ${DESKTOPSTREAMER_RESOURCES})
qt5_wrap_cpp(MOC_OUTFILES ${DESKTOPSTREAMER_MOC_HEADERS})
qt5_add_resources(QRC_SOURCES ${DESKTOPSTREAMER_RESOURCES})

if(APPLE)
set(DESKTOPSTREAMER_APP_NAME DesktopStreamer)
Expand Down
2 changes: 1 addition & 1 deletion apps/DesktopStreamer/DesktopSelectionRectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#ifndef DESKTOP_SELECTION_RECTANGLE_H
#define DESKTOP_SELECTION_RECTANGLE_H

#include <QtGui>
#include <QtWidgets>

class DesktopSelectionRectangle : public QObject, public QGraphicsRectItem
{
Expand Down
2 changes: 1 addition & 1 deletion apps/DesktopStreamer/DesktopSelectionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#ifndef DESKTOP_SELECTION_VIEW_H
#define DESKTOP_SELECTION_VIEW_H

#include <QtGui>
#include <QtWidgets>

class DesktopSelectionRectangle;

Expand Down
2 changes: 1 addition & 1 deletion apps/DesktopStreamer/DesktopSelectionWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#ifndef DESKTOP_SELECTION_WINDOW_H
#define DESKTOP_SELECTION_WINDOW_H

#include <QtGui>
#include <QtWidgets>

class DesktopSelectionView;

Expand Down
2 changes: 1 addition & 1 deletion apps/DesktopStreamer/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H

#include <QtGui>
#include <QtWidgets>

#ifdef __APPLE__
# include "AppNapSuspender.h"
Expand Down
7 changes: 4 additions & 3 deletions deflect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ set(DEFLECT_MOC_HEADERS
StreamPrivate.h
)

qt4_wrap_cpp(MOC_OUTFILES ${DEFLECT_MOC_HEADERS})
qt5_wrap_cpp(MOC_OUTFILES ${DEFLECT_MOC_HEADERS})

set(DEFLECT_SOURCES
${MOC_OUTFILES}
Expand All @@ -68,8 +68,9 @@ set(DEFLECT_SOURCES
)

set(DEFLECT_LINK_LIBRARIES
${QT_QTCORE_LIBRARY}
${QT_QTNETWORK_LIBRARY}
${Qt5Concurrent_LIBRARIES}
${Qt5Core_LIBRARIES}
${Qt5Network_LIBRARIES}
${Boost_THREAD_LIBRARY}
${Boost_SYSTEM_LIBRARY}
)
Expand Down
2 changes: 1 addition & 1 deletion deflect/NetworkListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ PixelStreamDispatcher& NetworkListener::getPixelStreamDispatcher()
return _impl->pixelStreamDispatcher;
}

void NetworkListener::incomingConnection(int socketHandle)
void NetworkListener::incomingConnection(qintptr socketHandle)
{
QThread* workerThread = new QThread(this);
NetworkListenerWorker* worker = new NetworkListenerWorker(socketHandle);
Expand Down
2 changes: 1 addition & 1 deletion deflect/NetworkListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public slots:
detail::NetworkListener* _impl;

/** Re-implemented handling of connections from QTCPSocket. */
void incomingConnection( int socketHandle ) final;
void incomingConnection( qintptr socketHandle ) final;

signals:
void pixelStreamerClosed( QString uri );
Expand Down
4 changes: 2 additions & 2 deletions tests/mock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ set(MOCK_SOURCES
MockNetworkListener.cpp
)

qt4_wrap_cpp(MOC_OUTFILES ${MOCK_MOC_HEADERS})
qt5_wrap_cpp(MOC_OUTFILES ${MOCK_MOC_HEADERS})

set(IGNORE_LIB_TARGETS Mock)
add_library(Mock SHARED ${MOC_OUTFILES} ${MOCK_HEADERS} ${MOCK_SOURCES})
set_target_properties(Mock PROPERTIES
COMPILE_DEFINITIONS "DEFLECT_SHARED")
target_link_libraries(Mock ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY})
target_link_libraries(Mock ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES})
2 changes: 1 addition & 1 deletion tests/mock/MockNetworkListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ MockNetworkListener::~MockNetworkListener()
{
}

void MockNetworkListener::incomingConnection(int handle)
void MockNetworkListener::incomingConnection(qintptr handle)
{
QTcpSocket tcpSocket;
tcpSocket.setSocketDescriptor(handle);
Expand Down
2 changes: 1 addition & 1 deletion tests/mock/MockNetworkListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MockNetworkListener : public QTcpServer
DEFLECT_API virtual ~MockNetworkListener();

protected:
void incomingConnection(int handle) final;
void incomingConnection(qintptr handle) final;

private:
int32_t protocolVersion_;
Expand Down
2 changes: 1 addition & 1 deletion tests/perf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if(NOT WIN32) # tests want to be with DLLs on Windows - no rpath
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()

set(TEST_LIBRARIES Deflect ${Boost_LIBRARIES} ${QT_QTGUI_LIBRARY})
set(TEST_LIBRARIES Deflect ${Boost_LIBRARIES} ${Qt5Widgets_LIBRARIES})
set(PERF_TEST_SOURCES benchmarkStreamer.cpp streamTests.cpp)

# Create executables but do not add them to the tests target
Expand Down

0 comments on commit fc6bfa0

Please sign in to comment.