gr-fosphor/qt: Qt5 - Switch to linking to Qt5

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2019-12-02 16:20:08 +01:00
parent 2e4089a1d1
commit ef55b4f5af
4 changed files with 13 additions and 158 deletions

View File

@ -112,10 +112,15 @@ endif()
# Optional
find_package(GLFW3)
find_package(Qt4 4.2.0 COMPONENTS QtCore QtGui QtOpenGL)
if (QT_FOUND)
include(GrSetupQt4)
endif (QT_FOUND)
set(Qt5_REQUIRED_COMPONENTS Core Gui OpenGL)
find_package(Qt5 5.9.0 COMPONENTS ${Qt5_REQUIRED_COMPONENTS})
if (Qt5_FOUND)
foreach(module ${Qt5_REQUIRED_COMPONENTS})
list(APPEND Qt5_INCLUDE_DIRS ${Qt5${module}_INCLUDE_DIRS})
list(APPEND Qt5_LIBRARY_DIRS ${Qt5${module}_LIBRARY_DIRS})
list(APPEND Qt5_LIBRARIES ${Qt5${module}_LIBRARIES})
endforeach(module)
endif (Qt5_FOUND)
########################################################################
# Find gnuradio build dependencies
@ -149,7 +154,7 @@ GR_REGISTER_COMPONENT("GLFW" ENABLE_GLFW
)
GR_REGISTER_COMPONENT("QT" ENABLE_QT
QT_FOUND
Qt5_FOUND
)
GR_REGISTER_COMPONENT("WX" ENABLE_WX

View File

@ -1,150 +0,0 @@
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
if(DEFINED __INCLUDED_GR_USEQT4_CMAKE)
return()
endif()
set(__INCLUDED_GR_USEQT4_CMAKE TRUE)
# This file is derived from the default "UseQt4" file provided by
# CMake. This version sets the variables "QT_INCLUDE_DIRS",
# "QT_LIBRARIES", and "QT_LIBRARIES_PLUGINS" depending on those
# requested during the "find_package(Qt4 ...)" function call, but
# without actually adding them to the include or library search
# directories ("include_directories" or "link_directories"). The
# adding in is done by the CMakeLists.txt build scripts in the using
# project.
# Copyright from the original file, as required by the license.
################################################################
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
################################################################
ADD_DEFINITIONS(${QT_DEFINITIONS})
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
SET(QT_INCLUDE_DIRS ${QT_INCLUDE_DIR})
SET(QT_LIBRARIES "")
SET(QT_LIBRARIES_PLUGINS "")
IF (QT_USE_QTMAIN)
IF (Q_WS_WIN)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
ENDIF (Q_WS_WIN)
ENDIF (QT_USE_QTMAIN)
IF(QT_DONT_USE_QTGUI)
SET(QT_USE_QTGUI 0)
ELSE(QT_DONT_USE_QTGUI)
SET(QT_USE_QTGUI 1)
ENDIF(QT_DONT_USE_QTGUI)
IF(QT_DONT_USE_QTCORE)
SET(QT_USE_QTCORE 0)
ELSE(QT_DONT_USE_QTCORE)
SET(QT_USE_QTCORE 1)
ENDIF(QT_DONT_USE_QTCORE)
IF (QT_USE_QT3SUPPORT)
ADD_DEFINITIONS(-DQT3_SUPPORT)
ENDIF (QT_USE_QT3SUPPORT)
# list dependent modules, so dependent libraries are added
SET(QT_QT3SUPPORT_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
SET(QT_QTSVG_MODULE_DEPENDS QTGUI QTXML QTCORE)
SET(QT_QTUITOOLS_MODULE_DEPENDS QTGUI QTXML QTCORE)
SET(QT_QTHELP_MODULE_DEPENDS QTGUI QTSQL QTXML QTNETWORK QTCORE)
IF(QT_QTDBUS_FOUND)
SET(QT_PHONON_MODULE_DEPENDS QTGUI QTDBUS QTCORE)
ELSE(QT_QTDBUS_FOUND)
SET(QT_PHONON_MODULE_DEPENDS QTGUI QTCORE)
ENDIF(QT_QTDBUS_FOUND)
SET(QT_QTDBUS_MODULE_DEPENDS QTXML QTCORE)
SET(QT_QTXMLPATTERNS_MODULE_DEPENDS QTNETWORK QTCORE)
SET(QT_QAXCONTAINER_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QAXSERVER_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTSCRIPTTOOLS_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTWEBKIT_MODULE_DEPENDS QTXMLPATTERNS QTGUI QTCORE)
SET(QT_QTDECLARATIVE_MODULE_DEPENDS QTSCRIPT QTSVG QTSQL QTXMLPATTERNS QTGUI QTCORE)
SET(QT_QTMULTIMEDIA_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTOPENGL_MODULE_DEPENDS QTGUI QTCORE)
SET(QT_QTSCRIPT_MODULE_DEPENDS QTCORE)
SET(QT_QTGUI_MODULE_DEPENDS QTCORE)
SET(QT_QTTEST_MODULE_DEPENDS QTCORE)
SET(QT_QTXML_MODULE_DEPENDS QTCORE)
SET(QT_QTSQL_MODULE_DEPENDS QTCORE)
SET(QT_QTNETWORK_MODULE_DEPENDS QTCORE)
# Qt modules (in order of dependence)
FOREACH(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
QAXSERVER QAXCONTAINER QTDECLARATIVE QTSCRIPT QTSVG QTUITOOLS QTHELP
QTWEBKIT PHONON QTSCRIPTTOOLS QTMULTIMEDIA QTXMLPATTERNS QTGUI QTTEST
QTDBUS QTXML QTSQL QTNETWORK QTCORE)
IF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
IF (QT_${module}_FOUND)
IF(QT_USE_${module})
STRING(REPLACE "QT" "" qt_module_def "${module}")
ADD_DEFINITIONS(-DQT_${qt_module_def}_LIB)
SET(QT_INCLUDE_DIRS ${QT_INCLUDE_DIRS} ${QT_${module}_INCLUDE_DIR})
ENDIF(QT_USE_${module})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
SET(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})
IF(QT_IS_STATIC)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIB_DEPENDENCIES})
ENDIF(QT_IS_STATIC)
FOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
SET(QT_USE_${depend_module}_DEPENDS 1)
ENDFOREACH(depend_module ${QT_${module}_MODULE_DEPENDS})
ELSE (QT_${module}_FOUND)
MESSAGE("Qt ${module} library not found.")
ENDIF (QT_${module}_FOUND)
ENDIF (QT_USE_${module} OR QT_USE_${module}_DEPENDS)
ENDFOREACH(module)

View File

@ -3,7 +3,7 @@
<name>QT fosphor sink</name>
<key>fosphor_qt_sink_c</key>
<category>Instrumentation/QT</category>
<import>from PyQt4 import Qt</import>
<import>from PyQt5 import Qt</import>
<import>import sip</import>
<import>from gnuradio import fosphor</import>
<import>from gnuradio.fft import window</import>

View File

@ -67,7 +67,7 @@ endif(ENABLE_GLFW)
if(ENABLE_QT)
set(CMAKE_AUTOMOC ON)
include_directories(${QT_INCLUDE_DIRS})
include_directories(${Qt5_INCLUDE_DIRS})
endif(ENABLE_QT)
list(APPEND fosphor_sources
@ -100,7 +100,7 @@ list(APPEND fosphor_libraries
list_cond_append(ENABLE_PYTHON fosphor_libraries ${PYTHON_LIBRARY})
list_cond_append(ENABLE_GLFW fosphor_libraries ${GLFW3_LIBRARIES})
list_cond_append(ENABLE_QT fosphor_libraries ${QT_LIBRARIES})
list_cond_append(ENABLE_QT fosphor_libraries ${Qt5_LIBRARIES})
add_library(gnuradio-fosphor SHARED ${fosphor_sources})
target_link_libraries(gnuradio-fosphor ${fosphor_libraries})