1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-28 16:20:01 +02:00

qt5: cmake: allow building Tomahawk against Qt4 and Qt5

This commit is contained in:
Dominik Schmidt
2013-01-06 03:52:20 +01:00
parent 033e6a3059
commit 110fb0100d
10 changed files with 146 additions and 116 deletions

View File

@@ -1,26 +1,14 @@
PROJECT( tomahawk )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
IF( "${gui}" STREQUAL "no" )
SET( QT_DONT_USE_QTGUI TRUE )
ENDIF()
IF( UNIX AND NOT APPLE )
SET( QT_USE_QTDBUS TRUE )
ENDIF( UNIX AND NOT APPLE )
SET( QT_USE_QTSQL TRUE )
SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTWEBKIT TRUE )
setup_qt()
INCLUDE( ${QT_USE_FILE} )
INCLUDE( AddAppIconMacro )
include( AddAppIconMacro )
#SET( CMAKE_BUILD_TYPE "Release" )
SET( CMAKE_VERBOSE_MAKEFILE ON )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
IF( NOT CMAKE_BUILD_TYPE STREQUAL "Release" )
MESSAGE( "Building in debug mode, enabling all debug updates" )
SET( DEBUG_BUILD ON )
@@ -164,7 +152,7 @@ SET( final_src ${final_src} ${tomahawkMoc} ${tomahawkSources} ${trans_outfile})
IF( BUILD_GUI )
LIST(APPEND tomahawkSources ${tomahawkSourcesGui})
qt4_wrap_ui( tomahawkUI_H ${tomahawkUI} )
qt_wrap_ui( tomahawkUI_H ${tomahawkUI} )
IF( WITH_CRASHREPORTER )
ADD_SUBDIRECTORY( breakpad/CrashReporter )
@@ -172,7 +160,7 @@ IF( BUILD_GUI )
ENDIF()
kde4_add_app_icon( tomahawkSources "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
qt4_add_resources( RC_SRCS "../resources.qrc" )
qt_add_resources( RC_SRCS "../resources.qrc" )
SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMoc} ${tomahawkSources} ${RC_SRCS} )
@@ -188,6 +176,7 @@ IF( WIN32 )
ENDIF( WIN32 )
SET_TARGET_PROPERTIES(tomahawk PROPERTIES AUTOMOC TRUE)
qt5_use_modules(tomahawk Core Widgets Network Sql WebKitWidgets)
MESSAGE( STATUS "OS_SPECIFIC_LINK_LIBRARIES: ${OS_SPECIFIC_LINK_LIBRARIES}" )

View File

@@ -22,8 +22,6 @@
#include "Zeroconf.h"
#include "Source.h"
#include <QtPlugin>
using namespace Tomahawk;
using namespace Accounts;

View File

@@ -1,26 +1,31 @@
PROJECT( CrashReporter )
cmake_policy(SET CMP0017 NEW)
FIND_PACKAGE( Qt4 REQUIRED )
SET( QT_USE_QTNETWORK TRUE )
setup_qt()
set(crashreporter_SOURCES main.cpp CrashReporter.cpp)
set(crashreporter_UI CrashReporter.ui)
set(crashreporter_RC ../../../resources.qrc)
qt_wrap_ui( crashreporter_UI_HEADERS ${crashreporter_UI} )
qt_add_resources( crashreporter_RC_RCC ${crashreporter_RC} )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} ../../libtomahawk )
add_executable( tomahawk_crash_reporter WIN32
${crashreporter_SOURCES}
${crashreporter_HEADERS_MOC}
${crashreporter_UI_HEADERS}
${crashreporter_RC_RCC}
)
SET( crashreporter_SOURCES main.cpp CrashReporter.cpp )
SET( crashreporter_UI CrashReporter.ui )
SET( crashreporter_RC ../../../resources.qrc )
target_link_libraries(tomahawk_crash_reporter
tomahawklib
${QT_LIBRARIES}
)
QT4_WRAP_UI( crashreporter_UI_HEADERS ${crashreporter_UI} )
QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} )
INCLUDE( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ../../libtomahawk )
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
# translations
include( ${CMAKE_SOURCE_DIR}/lang/translations.cmake )
add_tomahawk_translations( ${TOMAHAWK_TRANSLATION_LANGUAGES} )
ADD_EXECUTABLE( tomahawk_crash_reporter WIN32 ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} ${trans_outfile} )
TARGET_LINK_LIBRARIES( tomahawk_crash_reporter ${QT_LIBRARIES} tomahawklib )
set_target_properties( tomahawk_crash_reporter PROPERTIES AUTOMOC ON)
set_target_properties(tomahawk_crash_reporter PROPERTIES AUTOMOC ON)
install(TARGETS tomahawk_crash_reporter RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR})
qt5_use_modules(tomahawk_crash_reporter Widgets Network)

View File

@@ -1,17 +1,22 @@
IF(BUILD_GUI AND X11_FOUND)
INCLUDE_DIRECTORIES( ${THIRDPARTY_DIR}/libqnetwm )
SET(fdo_srcs
fdonotify/FdoNotifyPlugin.cpp
fdonotify/ImageConverter.cpp
${THIRDPARTY_DIR}/libqnetwm/libqnetwm/netwm.cpp
)
SET(FDO_LINK_LIBRARIES ${LINK_LIBRARIES} ${X11_LIBRARIES})
# don't build with Qt5 because QX11Info is missing there
if(NOT Qt5Core_DIR)
add_tomahawk_plugin(fdonotify
TYPE infoplugin EXPORT_MACRO INFOPLUGINDLLEXPORT_PRO
SOURCES "${fdo_srcs}" LINK_LIBRARIES "${FDO_LINK_LIBRARIES}"
)
ENDIF()
IF(BUILD_GUI AND X11_FOUND)
INCLUDE_DIRECTORIES( ${THIRDPARTY_DIR}/libqnetwm )
SET(fdo_srcs
fdonotify/FdoNotifyPlugin.cpp
fdonotify/ImageConverter.cpp
${THIRDPARTY_DIR}/libqnetwm/libqnetwm/netwm.cpp
)
SET(FDO_LINK_LIBRARIES ${LINK_LIBRARIES} ${X11_LIBRARIES})
add_tomahawk_plugin(fdonotify
TYPE infoplugin EXPORT_MACRO INFOPLUGINDLLEXPORT_PRO
SOURCES "${fdo_srcs}" LINK_LIBRARIES "${FDO_LINK_LIBRARIES}"
)
ENDIF()
endif()
SET(mpris_srcs
mpris/MprisPluginRootAdaptor.cpp

View File

@@ -48,7 +48,6 @@
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusMessage>
#include <QtGui/QImage>
#include <QtPlugin>
namespace Tomahawk
{

View File

@@ -1,17 +1,6 @@
project( tomahawklib )
SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTSQL TRUE )
SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTSVG TRUE )
SET( QT_USE_QTUITOOLS TRUE )
IF( UNIX AND NOT APPLE )
SET( QT_USE_QTDBUS TRUE )
ENDIF( UNIX AND NOT APPLE )
include( ${QT_USE_FILE} )
setup_qt()
add_definitions( ${QT_DEFINITIONS} )
add_definitions( -DQT_SHARED )
@@ -358,7 +347,6 @@ include_directories(
${PHONON_INCLUDES}
${LIBPORTFWD_INCLUDE_DIR}
${THIRDPARTY_DIR}/qxt/qxtweb-standalone/qxtweb
${QuaZip_INCLUDE_DIR}
)
@@ -373,14 +361,6 @@ IF(LIBATTICA_FOUND)
LIST(APPEND LINK_LIBRARIES ${LIBATTICA_LIBRARIES} ${QuaZip_LIBRARIES} )
ENDIF(LIBATTICA_FOUND)
IF( UNIX AND NOT APPLE )
IF( BUILD_GUI AND X11_FOUND )
INCLUDE_DIRECTORIES( ${THIRDPARTY_DIR}/libqnetwm )
SET( libSources ${libSources} ${THIRDPARTY_DIR}/libqnetwm/libqnetwm/netwm.cpp )
LIST(APPEND LINK_LIBRARIES ${X11_LIBRARIES} )
ENDIF()
ENDIF( UNIX AND NOT APPLE )
IF( WIN32 )
SET( OS_SPECIFIC_LINK_LIBRARIES
${OS_SPECIFIC_LINK_LIBRARIES}
@@ -437,12 +417,13 @@ IF(BUILD_GUI)
LIST(APPEND libSources ${libGuiSources} )
ENDIF()
qt4_wrap_ui( libUI_H ${libUI} )
qt_wrap_ui(libUI_H ${libUI})
SET( libSources ${libSources} ${libUI_H} )
ADD_LIBRARY( tomahawklib SHARED ${libSources})
add_library( tomahawklib SHARED ${libSources})
set_target_properties(tomahawklib PROPERTIES AUTOMOC TRUE)
qt5_use_modules(tomahawklib Widgets Network Sql WebKitWidgets Concurrent Xml UiTools Svg)
IF(QCA2_FOUND)
LIST(APPEND LINK_LIBRARIES ${QCA2_LIBRARIES} )