From 549193bdd03e485b811a0b1a7bc19268f6ea2ca3 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Thu, 15 Oct 2015 13:14:51 +0200 Subject: [PATCH 1/2] Use ECMAddAppIcon instead of the copy of the kde4 macro. --- CMakeLists.txt | 15 ++- CMakeModules/AddAppIconMacro.cmake | 114 ------------------ ...4x1024.png => 1024x1024-tomahawk-icon.png} | Bin ...ng => 128x128-tomahawk-grayscale-icon.png} | Bin ...-128x128.png => 128x128-tomahawk-icon.png} | Bin ...28.png => 128x128-tomahawk-white-icon.png} | Bin ...icon-16x16.png => 16x16-tomahawk-icon.png} | Bin ...-256x256.png => 256x256-tomahawk-icon.png} | Bin ...icon-32x32.png => 32x32-tomahawk-icon.png} | Bin ...-512x512.png => 512x512-tomahawk-icon.png} | Bin ...icon-64x64.png => 64x64-tomahawk-icon.png} | Bin resources.qrc | 18 +-- src/crashreporter/resources.qrc | 2 +- src/tomahawk/CMakeLists.txt | 7 +- src/tomahawk/CMakeLists.win32.cmake | 2 +- 15 files changed, 27 insertions(+), 131 deletions(-) delete mode 100644 CMakeModules/AddAppIconMacro.cmake rename data/icons/{tomahawk-icon-1024x1024.png => 1024x1024-tomahawk-icon.png} (100%) rename data/icons/{tomahawk-grayscale-icon-128x128.png => 128x128-tomahawk-grayscale-icon.png} (100%) rename data/icons/{tomahawk-icon-128x128.png => 128x128-tomahawk-icon.png} (100%) rename data/icons/{tomahawk-white-icon-128x128.png => 128x128-tomahawk-white-icon.png} (100%) rename data/icons/{tomahawk-icon-16x16.png => 16x16-tomahawk-icon.png} (100%) rename data/icons/{tomahawk-icon-256x256.png => 256x256-tomahawk-icon.png} (100%) rename data/icons/{tomahawk-icon-32x32.png => 32x32-tomahawk-icon.png} (100%) rename data/icons/{tomahawk-icon-512x512.png => 512x512-tomahawk-icon.png} (100%) rename data/icons/{tomahawk-icon-64x64.png => 64x64-tomahawk-icon.png} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7098f2e2a..988790ad3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ PROJECT( tomahawk ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8.6 ) -SET( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) CMAKE_POLICY(SET CMP0017 NEW) IF ( CMAKE_VERSION VERSION_EQUAL 2.8.12 OR CMAKE_VERSION VERSION_GREATER 2.8.12 ) @@ -11,6 +10,11 @@ CMAKE_POLICY(SET CMP0022 NEW) CMAKE_POLICY(SET CMP0023 OLD) ENDIF() +find_package(ECM 1.7.0 REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) + + + INCLUDE(CMakeDependentOption) ### @@ -64,8 +68,11 @@ macro(tomahawk_add_c_flags FLAGS) set( TOMAHAWK_C_FLAGS "${TOMAHAWK_C_FLAGS} ${FLAGS}") endmacro() -# enforce proper symbol exporting on all platforms -tomahawk_add_definitions( "-fvisibility=hidden" ) +if(NOT WIN32) + # enforce proper symbol exporting on all platforms but Windows + tomahawk_add_c_flags( "-fvisibility=hidden" ) +endif() + # enforce using constBegin, constEnd for const-iterators tomahawk_add_definitions( "-DQT_STRICT_ITERATORS" ) @@ -162,7 +169,7 @@ if( NOT BUILD_WITH_QT4 ) find_package(Qt5WebKitWidgets REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5Xml REQUIRED) - find_package(Qt5X11Extras NO_MODULE) + find_package(Qt5X11Extras NO_MODULE QUIET) if(Qt5X11Extras_FOUND) set(HAVE_X11 TRUE) diff --git a/CMakeModules/AddAppIconMacro.cmake b/CMakeModules/AddAppIconMacro.cmake deleted file mode 100644 index fe7fb6779..000000000 --- a/CMakeModules/AddAppIconMacro.cmake +++ /dev/null @@ -1,114 +0,0 @@ -SET(WINDRES_EXECUTABLE ${CMAKE_RC_COMPILER}) - -# This macro is taken from kdelibs/cmake/modules/KDE4Macros.cmake. -# -# Copyright (c) 2006-2009 Alexander Neundorf, -# Copyright (c) 2006, 2007, Laurent Montel, -# Copyright (c) 2007 Matthias Kretz -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file [in KDE repositories]. - - -# adds application icon to target source list -# for detailed documentation see the top of FindKDE4Internal.cmake -macro (TOMAHAWK_ADD_APP_ICON appsources outfilename pattern) - set (_outfilename ${CMAKE_CURRENT_BINARY_DIR}/${outfilename}) - - if (WIN32) - if(NOT WINCE) - find_program(PNG2ICO_EXECUTABLE NAMES png2ico) - else(NOT WINCE) - find_program(PNG2ICO_EXECUTABLE NAMES png2ico PATHS ${HOST_BINDIR} NO_DEFAULT_PATH ) - endif(NOT WINCE) - find_program(WINDRES_EXECUTABLE NAMES windres) - if(MSVC) - set(WINDRES_EXECUTABLE TRUE) - endif(MSVC) - if (PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) - string(REPLACE "*" "(.*)" pattern_rx "${pattern}") - file(GLOB files "${pattern}") - foreach (it ${files}) - string(REGEX REPLACE "${pattern_rx}" "\\1" fn "${it}") - if (fn MATCHES ".*16.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*16.*") - if (fn MATCHES ".*32.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*32.*") - if (fn MATCHES ".*48.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*48.*") - if (fn MATCHES ".*64.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*64.*") - if (fn MATCHES ".*128.*" ) - list (APPEND _icons ${it}) - endif (fn MATCHES ".*128.*") - endforeach (it) - if (_icons) - add_custom_command(OUTPUT ${_outfilename}.ico ${_outfilename}.rc - COMMAND ${PNG2ICO_EXECUTABLE} ARGS --rcfile ${_outfilename}.rc ${_outfilename}.ico ${_icons} - DEPENDS ${PNG2ICO_EXECUTABLE} ${_icons} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - if (MINGW) - add_custom_command(OUTPUT ${_outfilename}_res.o - COMMAND ${WINDRES_EXECUTABLE} ARGS -i ${_outfilename}.rc -o ${_outfilename}_res.o --include-dir=${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${WINDRES_EXECUTABLE} ${_outfilename}.rc - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - list(APPEND ${appsources} ${_outfilename}_res.o) - else(MINGW) - list(APPEND ${appsources} ${_outfilename}.rc) - endif(MINGW) - else(_icons) - message(STATUS "Unable to find a related icon that matches pattern ${pattern} for variable ${appsources} - application will not have an application icon!") - endif(_icons) - else(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) - message(STATUS "Unable to find the png2ico or windres utilities - application will not have an application icon!") - endif(PNG2ICO_EXECUTABLE AND WINDRES_EXECUTABLE) - endif(WIN32) - if (APPLE) - # first convert image to a tiff using the Mac OS X "sips" utility, - # then use tiff2icns to convert to an icon - find_program(SIPS_EXECUTABLE NAMES sips) - find_program(TIFF2ICNS_EXECUTABLE NAMES tiff2icns) - if (SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE) - file(GLOB_RECURSE files "${pattern}") - # we can only test for the 128-icon like that - we don't use patterns anymore - foreach (it ${files}) - if (it MATCHES ".*128.*" ) - set (_icon ${it}) - endif (it MATCHES ".*128.*") - endforeach (it) - - if (_icon) - - # first, get the basename of our app icon - add_custom_command(OUTPUT ${_outfilename}.icns ${_outfilename}.tiff - COMMAND ${SIPS_EXECUTABLE} -s format tiff ${_icon} --out ${_outfilename}.tiff - COMMAND ${TIFF2ICNS_EXECUTABLE} ${_outfilename}.tiff ${_outfilename}.icns - DEPENDS ${_icon} - ) - - # This will register the icon into the bundle - set(MACOSX_BUNDLE_ICON_FILE ${appsources}.icns) - - # Append the icns file to the sources list so it will be a dependency to the - # main target - list(APPEND ${appsources} ${_outfilename}.icns) - - # Install the icon into the Resources dir in the bundle - set_source_files_properties(${_outfilename}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) - - else(_icon) - # TODO - try to scale a non-128 icon...? Try to convert an SVG on the fly? - message(STATUS "Unable to find an 128x128 icon that matches pattern ${pattern} for variable ${appsources} - application will not have an application icon!") - endif(_icon) - - else(SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE) - message(STATUS "Unable to find the sips and tiff2icns utilities - application will not have an application icon!") - endif(SIPS_EXECUTABLE AND TIFF2ICNS_EXECUTABLE) - endif(APPLE) -endmacro (TOMAHAWK_ADD_APP_ICON) diff --git a/data/icons/tomahawk-icon-1024x1024.png b/data/icons/1024x1024-tomahawk-icon.png similarity index 100% rename from data/icons/tomahawk-icon-1024x1024.png rename to data/icons/1024x1024-tomahawk-icon.png diff --git a/data/icons/tomahawk-grayscale-icon-128x128.png b/data/icons/128x128-tomahawk-grayscale-icon.png similarity index 100% rename from data/icons/tomahawk-grayscale-icon-128x128.png rename to data/icons/128x128-tomahawk-grayscale-icon.png diff --git a/data/icons/tomahawk-icon-128x128.png b/data/icons/128x128-tomahawk-icon.png similarity index 100% rename from data/icons/tomahawk-icon-128x128.png rename to data/icons/128x128-tomahawk-icon.png diff --git a/data/icons/tomahawk-white-icon-128x128.png b/data/icons/128x128-tomahawk-white-icon.png similarity index 100% rename from data/icons/tomahawk-white-icon-128x128.png rename to data/icons/128x128-tomahawk-white-icon.png diff --git a/data/icons/tomahawk-icon-16x16.png b/data/icons/16x16-tomahawk-icon.png similarity index 100% rename from data/icons/tomahawk-icon-16x16.png rename to data/icons/16x16-tomahawk-icon.png diff --git a/data/icons/tomahawk-icon-256x256.png b/data/icons/256x256-tomahawk-icon.png similarity index 100% rename from data/icons/tomahawk-icon-256x256.png rename to data/icons/256x256-tomahawk-icon.png diff --git a/data/icons/tomahawk-icon-32x32.png b/data/icons/32x32-tomahawk-icon.png similarity index 100% rename from data/icons/tomahawk-icon-32x32.png rename to data/icons/32x32-tomahawk-icon.png diff --git a/data/icons/tomahawk-icon-512x512.png b/data/icons/512x512-tomahawk-icon.png similarity index 100% rename from data/icons/tomahawk-icon-512x512.png rename to data/icons/512x512-tomahawk-icon.png diff --git a/data/icons/tomahawk-icon-64x64.png b/data/icons/64x64-tomahawk-icon.png similarity index 100% rename from data/icons/tomahawk-icon-64x64.png rename to data/icons/64x64-tomahawk-icon.png diff --git a/resources.qrc b/resources.qrc index 97f269ac6..32d94e29d 100644 --- a/resources.qrc +++ b/resources.qrc @@ -50,12 +50,12 @@ data/images/starred.svg data/images/star-unstarred.svg data/images/apply-check.svg - data/icons/tomahawk-icon-16x16.png - data/icons/tomahawk-icon-32x32.png - data/icons/tomahawk-icon-64x64.png - data/icons/tomahawk-icon-128x128.png - data/icons/tomahawk-icon-256x256.png - data/icons/tomahawk-icon-512x512.png + data/icons/16x16-tomahawk-icon.png + data/icons/32x32-tomahawk-icon.png + data/icons/64x64-tomahawk-icon.png + data/icons/128x128-tomahawk-icon.png + data/icons/256x256-tomahawk-icon.png + data/icons/512x512-tomahawk-icon.png data/sql/dbmigrate-22_to_23.sql data/sql/dbmigrate-23_to_24.sql data/sql/dbmigrate-24_to_25.sql @@ -85,7 +85,7 @@ data/images/spotifycore-logo.png data/images/share.svg data/images/process-stop.svg - data/icons/tomahawk-grayscale-icon-128x128.png + data/icons/128x128-tomahawk-grayscale-icon.png data/images/collection.svg data/misc/tomahawk_pubkey.pem data/images/jump-link.svg @@ -160,9 +160,9 @@ data/images/ipv6-logo.svg data/images/whatsnew.svg data/images/copy.svg - data/icons/tomahawk-icon-1024x1024.png + data/icons/1024x1024-tomahawk-icon.png data/images/plugins.svg - data/icons/tomahawk-white-icon-128x128.png + data/icons/128x128-tomahawk-white-icon.png data/images/repeat-all.svg data/images/repeat-one.svg data/images/downloads.svg diff --git a/src/crashreporter/resources.qrc b/src/crashreporter/resources.qrc index 537470572..5ddffd173 100644 --- a/src/crashreporter/resources.qrc +++ b/src/crashreporter/resources.qrc @@ -1,5 +1,5 @@ - ../../data/icons/tomahawk-icon-128x128.png + ../../data/icons/128x128-tomahawk-icon.png diff --git a/src/tomahawk/CMakeLists.txt b/src/tomahawk/CMakeLists.txt index 08e8d8f7c..5bdaee8f0 100644 --- a/src/tomahawk/CMakeLists.txt +++ b/src/tomahawk/CMakeLists.txt @@ -3,7 +3,7 @@ CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) set(TOMAHAWK_APPLICATION_TARGET "tomahahawk-bin") -include( AddAppIconMacro ) +include( ECMAddAppIcon ) # SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) # SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) @@ -148,7 +148,10 @@ IF( BUILD_GUI ) qt_wrap_ui( tomahawkUI_H ${tomahawkUI} ) ENDIF() -tomahawk_add_app_icon( tomahawkSources Tomahawk "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" ) +file( GLOB_RECURSE TOMAHAWK_ICONS "${CMAKE_SOURCE_DIR}/data/icons/*-tomahawk-icon.png" ) + +ecm_add_app_icon( tomahawkSources ICONS ${TOMAHAWK_ICONS} ) + qt_add_resources( RC_SRCS "../../resources.qrc" ) SET( final_src ${final_src} ${tomahawkUI_H} ${tomahawkMoc} ${tomahawkSources} ${RC_SRCS} ) diff --git a/src/tomahawk/CMakeLists.win32.cmake b/src/tomahawk/CMakeLists.win32.cmake index cd883d2df..485391cf6 100644 --- a/src/tomahawk/CMakeLists.win32.cmake +++ b/src/tomahawk/CMakeLists.win32.cmake @@ -1,6 +1,6 @@ ADD_DEFINITIONS( -DNOMINMAX ) ADD_DEFINITIONS( -DWIN32_LEAN_AND_MEAN ) -ADD_DEFINITIONS( -static-libgcc ) +set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc" ) ADD_DEFINITIONS( -DUNICODE ) SET( OS_SPECIFIC_LINK_LIBRARIES From b0fac41c27c7829241e7aac7aa85e6c618793fb6 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Thu, 5 Nov 2015 17:07:10 +0100 Subject: [PATCH 2/2] Get rid of warnings --- CMakeLists.txt | 11 ++++++----- src/tomahawk/CMakeLists.txt | 3 --- thirdparty/kdsingleapplicationguard/CMakeLists.txt | 3 +++ thirdparty/libcrashreporter-qt | 2 +- thirdparty/qt-certificate-addon/CMakeLists.txt | 4 +++- thirdparty/qxt/qxtweb-standalone/CMakeLists.txt | 2 ++ 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 988790ad3..63816bdb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,15 @@ PROJECT( tomahawk ) -CMAKE_MINIMUM_REQUIRED( VERSION 2.8.6 ) +CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) CMAKE_POLICY(SET CMP0017 NEW) - -IF ( CMAKE_VERSION VERSION_EQUAL 2.8.12 OR CMAKE_VERSION VERSION_GREATER 2.8.12 ) CMAKE_POLICY(SET CMP0022 NEW) # TODO: -# Update to NEW and fix things up when we can depend on 2.8.12 +# Update to NEW and fix things up CMAKE_POLICY(SET CMP0023 OLD) -ENDIF() + +# TODO: +# Disable automatic qtmain linking +CMAKE_POLICY(SET CMP0020 OLD) find_package(ECM 1.7.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) diff --git a/src/tomahawk/CMakeLists.txt b/src/tomahawk/CMakeLists.txt index 5bdaee8f0..92a7afac5 100644 --- a/src/tomahawk/CMakeLists.txt +++ b/src/tomahawk/CMakeLists.txt @@ -1,6 +1,3 @@ -PROJECT( tomahawk ) -CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) - set(TOMAHAWK_APPLICATION_TARGET "tomahahawk-bin") include( ECMAddAppIcon ) diff --git a/thirdparty/kdsingleapplicationguard/CMakeLists.txt b/thirdparty/kdsingleapplicationguard/CMakeLists.txt index 8354f5240..af4cf8704 100644 --- a/thirdparty/kdsingleapplicationguard/CMakeLists.txt +++ b/thirdparty/kdsingleapplicationguard/CMakeLists.txt @@ -1,4 +1,7 @@ cmake_minimum_required(VERSION 2.6) + +cmake_policy(SET CMP0020 OLD) + project(kdsingleapplicationguard) list(APPEND kdsingleapplicationguard_INCLUDE_DIRECTORIES diff --git a/thirdparty/libcrashreporter-qt b/thirdparty/libcrashreporter-qt index e8fffe61e..0dc4a719c 160000 --- a/thirdparty/libcrashreporter-qt +++ b/thirdparty/libcrashreporter-qt @@ -1 +1 @@ -Subproject commit e8fffe61e7c94ce88e59b80579754c4a46da65ea +Subproject commit 0dc4a719ca98f3bf942a8e722478c8bf1b192cb4 diff --git a/thirdparty/qt-certificate-addon/CMakeLists.txt b/thirdparty/qt-certificate-addon/CMakeLists.txt index fa6909dcc..570319a36 100644 --- a/thirdparty/qt-certificate-addon/CMakeLists.txt +++ b/thirdparty/qt-certificate-addon/CMakeLists.txt @@ -1,5 +1,7 @@ -cmake_minimum_required(VERSION 2.6) project(qtcertificateaddon) +cmake_minimum_required(VERSION 2.6) +cmake_policy(SET CMP0020 OLD) + add_subdirectory( src ) diff --git a/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt b/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt index cc79bb0af..654a6aab5 100644 --- a/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt +++ b/thirdparty/qxt/qxtweb-standalone/CMakeLists.txt @@ -1,6 +1,8 @@ PROJECT(libqxtweb-standalone) CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR) +CMAKE_POLICY(SET CMP0020 OLD) + IF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 ) CMAKE_POLICY(SET CMP0017 NEW) ENDIF( ${CMAKE_VERSION} VERSION_GREATER 2.8.3 )