Warning, /multimedia/amarok/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 3.4)
0002 
0003 project(Amarok)
0004 
0005 # Remove all warnings, ease the porting to cmake 3.x
0006 if (POLICY CMP0028)
0007     cmake_policy(SET CMP0028 NEW)
0008 endif()
0009 
0010 ###############
0011 
0012 set(KF5_MIN_VERSION "5.41.0")
0013 set(QT_REQUIRED_VERSION "5.10.0")
0014 find_package(PkgConfig REQUIRED)
0015 find_package(ECM ${KF5_MIN_VERSION} REQUIRED CONFIG)
0016 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
0017 
0018 include(KDEInstallDirs)
0019 include(KDECMakeSettings)
0020 #include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
0021 include(KDECompilerSettings NO_POLICY_SCOPE)
0022 include(FeatureSummary)
0023 include(ECMInstallIcons)
0024 include(ECMSetupVersion)
0025 include(ECMAddTests)
0026 include(ECMAddAppIcon)
0027 include(ECMPoQmTools)
0028 include(FindPkgConfig)
0029 include(CMakePushCheckState)
0030 include(GenerateExportHeader)
0031 
0032 find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Core DBus Gui QuickWidgets Qml Sql Svg Test Widgets Xml)
0033 
0034 find_package(Qt5QuickControls2 ${QT_REQUIRED_VERSION})
0035 set_package_properties(Qt5QuickControls2 PROPERTIES TYPE RUNTIME PURPOSE "Needed by the player's context area")
0036 
0037 find_package(Qt5WebEngine ${QT_REQUIRED_VERSION})
0038 set_package_properties(Qt5WebEngine PROPERTIES TYPE OPTIONAL PURPOSE "Needed by the wikipedia applet")
0039 
0040 find_package(Qt5UiTools ${QT_REQUIRED_VERSION})
0041 set_package_properties(Qt5UiTools PROPERTIES TYPE OPTIONAL PURPOSE "Needed by the scripting engine")
0042 
0043 find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
0044     Archive
0045     Attica
0046     Codecs
0047     Config
0048     ConfigWidgets
0049     CoreAddons
0050     Crash
0051     DBusAddons
0052     Declarative
0053     DNSSD
0054     DocTools
0055     GlobalAccel
0056     GuiAddons
0057     I18n
0058     IconThemes
0059     KCMUtils
0060     KIO
0061     NewStuff
0062     Notifications
0063     Package
0064     Solid
0065     TextEditor
0066     ThreadWeaver
0067     WidgetsAddons
0068     WindowSystem
0069 )
0070 
0071 find_package(KF5Kirigami2 ${KF5_MIN_VERSION})
0072 set_package_properties(KF5Kirigami2 PROPERTIES TYPE RUNTIME PURPOSE "Needed by the player's context area")
0073 
0074 ###############
0075 option(WITH_UTILITIES "Enable building of utilities" ON)
0076 option(WITH_PLAYER "Enable building of main Amarok player" ON)
0077 option(WITH_MP3Tunes "Enable mp3tunes in the Amarok player, requires multiple extra dependencies" ON)
0078 option(WITH_IPOD "Enable iPod support in Amarok" ON)
0079 option(WITH_PLAYGROUND "Enable building of playground scripts and applets (WARNING: some of them might have legal issues!)" OFF)
0080 
0081 ############### Taglib
0082 set(TAGLIB_MIN_VERSION "1.7")
0083 find_package(Taglib REQUIRED)
0084 set_package_properties( Taglib PROPERTIES DESCRIPTION "Support for Audio metadata." URL "http://developer.kde.org/~wheeler/taglib.html" TYPE REQUIRED PURPOSE "Required for tag reading" )
0085 
0086 # Check if TagLib is built with ASF and MP4 support
0087 include(CheckCXXSourceCompiles)
0088 cmake_push_check_state()
0089 set(CMAKE_REQUIRED_INCLUDES "${TAGLIB_INCLUDES}")
0090 set(CMAKE_REQUIRED_LIBRARIES "${TAGLIB_LIBRARIES}")
0091 
0092 check_cxx_source_compiles("#include <asftag.h>
0093 int main() { TagLib::ASF::Tag tag; return 0;}" TAGLIB_ASF_FOUND)
0094 if( NOT TAGLIB_ASF_FOUND )
0095     message(FATAL_ERROR "TagLib does not have ASF support compiled in.")
0096 endif()
0097 
0098 check_cxx_source_compiles("#include <mp4tag.h>
0099 int main() { TagLib::MP4::Tag tag(0, 0); return 0;}" TAGLIB_MP4_FOUND)
0100 if( NOT TAGLIB_MP4_FOUND )
0101     message(FATAL_ERROR "TagLib does not have MP4 support compiled in.")
0102 endif()
0103 
0104 check_cxx_source_compiles("#include <modtag.h>
0105 #include <modfile.h>
0106 #include <s3mfile.h>
0107 #include <itfile.h>
0108 #include <xmfile.h>
0109 using namespace TagLib;
0110 int main() { char *s; Mod::Tag tag; Mod::File modfile(s); S3M::File s3mfile(s);
0111 IT::File itfile(s); XM::File xmfile(s); return 0; }" TAGLIB_MOD_FOUND)
0112 
0113 check_cxx_source_compiles("#include <opusfile.h>
0114 int main() { char *s; TagLib::Ogg::Opus::File opusfile(s); return 0;}" TAGLIB_OPUS_FOUND)
0115 cmake_pop_check_state()
0116 
0117 set(TAGLIB-EXTRAS_MIN_VERSION "1.0")
0118 find_package(Taglib-Extras)
0119 set(TAGLIB_EXTRAS_FOUND ${TAGLIB-EXTRAS_FOUND}) # we need a c-compatible name for the include file
0120 
0121 include(CheckTagLibFileName)
0122 
0123 check_taglib_filename(COMPLEX_TAGLIB_FILENAME)
0124 ###############
0125 
0126 
0127 #Needed to conditionally build tests and gui
0128 find_package(Googlemock)
0129 set_package_properties( GOOGLEMOCK PROPERTIES DESCRIPTION "Used in Amarok's tests." URL "https://github.com/google/googlemock" TYPE OPTIONAL )
0130 
0131 if(NOT GOOGLEMOCK_FOUND)
0132     set(BUILD_TESTING OFF)
0133 endif()
0134 
0135 if(BUILD_TESTING)
0136    add_definitions(-DDEBUG)
0137 endif()
0138 
0139 if(WITH_DESKTOP_UI)
0140     add_definitions(-DDESKTOP_UI)
0141 endif()
0142 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
0143 if (CMAKE_COMPILER_IS_GNUCXX)
0144     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")
0145     if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
0146         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--as-needed")
0147     endif()
0148 endif ()
0149 
0150 include_directories(
0151     ${CMAKE_CURRENT_SOURCE_DIR}/shared
0152     ${CMAKE_CURRENT_BINARY_DIR}/shared
0153 )
0154 
0155 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")  # Require C++11
0156 
0157 # WORKAROUND for Clang bug: http://llvm.org/bugs/show_bug.cgi?id=15651
0158 if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND WIN32)
0159     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-delayed-template-parsing")
0160 endif ()
0161 
0162 ####################################################################################
0163 # CMAKE_AUTOMOC
0164 
0165 if(NOT CMAKE_VERSION VERSION_LESS "3.10.0")
0166     # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros.
0167     # 3.10+ lets us provide more macro names that require automoc.
0168     list(APPEND CMAKE_AUTOMOC_MACRO_NAMES AMAROK_EXPORT_SIMPLE_IMPORTER_PLUGIN)
0169 endif()
0170 
0171 add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_TO_ASCII)
0172 
0173 find_package(Phonon4Qt5 4.6.60 REQUIRED NO_MODULE)
0174 add_definitions(-DPHONON_LIB_SONAME=\"${PHONON_LIB_SONAME}\")
0175 
0176 find_package( LibLastFm )
0177 set( LIBLASTFM_MIN_VERSION "1.0.0" )
0178 if( LIBLASTFM_FOUND )
0179     if ( ${LIBLASTFM_MIN_VERSION} VERSION_LESS ${LIBLASTFM_VERSION} )
0180         set( LIBLASTFM_FOUND TRUE )
0181     endif()
0182 endif()
0183 
0184 string( TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER )
0185 if( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug )
0186     set( DEBUG_BUILD_TYPE ON )
0187     add_definitions(-Wall -Wextra)
0188 endif()
0189 
0190 # this needs to be here because also code in shared/ needs config.h. This is also the
0191 # reason why various checks are above why they belong under if( WITH_PLAYER )
0192 configure_file( shared/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/shared/config.h )
0193 
0194 add_subdirectory( data )
0195 add_subdirectory( images )
0196 add_subdirectory( shared )
0197 
0198 if( WITH_PLAYER )
0199     find_package(X11)
0200     find_package(Threads REQUIRED)
0201 
0202     find_package(MySQL)
0203 
0204     if( NOT MySQL_FOUND )
0205         find_package(MariaDB REQUIRED)
0206     endif()
0207 
0208     find_package(MySQLe)
0209     if( MySQLe_FOUND )
0210         set( BUILD_MYSQLE_COLLECTION TRUE )
0211         # zlib is required for mysql embedded
0212         find_package(ZLIB REQUIRED)
0213         set_package_properties( ZLIB PROPERTIES DESCRIPTION "zlib" TYPE REQUIRED )
0214     else()
0215         add_definitions( "-DNO_MYSQL_EMBEDDED" )
0216     endif()
0217 
0218     # We tell users that we need 1.0.3, but we really check just >= 1.0.0. This is because
0219     # upstream forgot to update version in lastfm/global.h, so it looks like 1.0.2. :-(
0220     # will be fixed in liblastfm-1.0.4
0221     set( LIBLASTFM_MIN_VERSION "1.0.3" )
0222     set_package_properties( LibLastFm PROPERTIES DESCRIPTION "Enable Last.Fm service, including scrobbling, song submissions, and suggested song dynamic playlists" URL "http://cdn.last.fm/client/liblastfm-${LIBLASTFM_MIN_VERSION}.tar.gz" TYPE OPTIONAL )
0223 
0224     find_package(FFmpeg)
0225     set_package_properties(FFmpeg PROPERTIES
0226         DESCRIPTION "Libraries and tools for handling multimedia data"
0227         URL "https://www.ffmpeg.org/"
0228         TYPE OPTIONAL
0229         PURPOSE "Enable MusicDNS service"
0230     )
0231 
0232     find_package(LibOFA)
0233     set_package_properties(LibOFA PROPERTIES
0234         DESCRIPTION "Open-source audio fingerprint by MusicIP"
0235         URL "http://code.google.com/p/musicip-libofa/"
0236         TYPE OPTIONAL
0237         PURPOSE "Enable MusicDNS service"
0238     )
0239 
0240     ## gpodder Service
0241     find_package(Mygpo-qt5 1.1.0 CONFIG)
0242     set_package_properties(Mygpo-qt5 PROPERTIES
0243         DESCRIPTION "A Qt/C++ library wrapping the gpodder.net Webservice."
0244         URL "http://wiki.gpodder.org/wiki/Libmygpo-qt"
0245         TYPE OPTIONAL
0246         PURPOSE "Synchronize podcast subscriptions with gpodder.net"
0247     )
0248 
0249     if( WITH_IPOD )
0250         find_package(Ipod)
0251         set(IPOD_MIN_VERSION "0.8.2")
0252         if( IPOD_FOUND AND NOT WIN32 )
0253             if ( ${IPOD_MIN_VERSION} VERSION_LESS ${IPOD_VERSION} )
0254                 set( IPOD_FOUND TRUE )
0255             endif()
0256         endif()
0257         set_package_properties( Ipod PROPERTIES DESCRIPTION "Support Apple iPod/iPad/iPhone audio devices" URL "http://sourceforge.net/projects/gtkpod/" TYPE OPTIONAL )
0258         find_package(GDKPixBuf)
0259         set_package_properties( GDKPixBuf PROPERTIES DESCRIPTION "Support for artwork on iPod audio devices via GDK-PixBuf" URL "http://developer.gnome.org/arch/imaging/gdkpixbuf.html" TYPE OPTIONAL )
0260     endif()
0261 
0262     find_package(Mtp 1.0.0)
0263     set_package_properties(Mtp PROPERTIES
0264         TYPE OPTIONAL
0265         PURPOSE "Enable Support for portable media devices that use the media transfer protocol"
0266     )
0267 
0268     if( WITH_MP3Tunes )
0269         find_package(CURL)
0270         set_package_properties( CURL PROPERTIES DESCRIPTION "Used to transfer data with URLs" URL "https://curl.haxx.se/" TYPE OPTIONAL )
0271 
0272         find_package(LibXml2)
0273         set_package_properties( LibXml2 PROPERTIES DESCRIPTION "LibXML2 is an XML parser required by mp3tunes." URL "http://www.xmlsoft.org" TYPE OPTIONAL )
0274 
0275         find_package(OpenSSL)
0276         find_package(Libgcrypt)
0277         if ( OPENSSL_FOUND OR LIBGCRYPT_FOUND )
0278             set (_mp3tunes_crypto TRUE )
0279         else ()
0280             message( SEND_ERROR "Building with mp3tunes support REQUIRES either OpenSSL or GNU Libgcrypt" )
0281         endif ()
0282         set_package_properties( OpenSSL PROPERTIES DESCRIPTION "OpenSSL or GNU Libgcrypt provides cryptographic functions required by mp3tunes." URL "http://www.openssl.org/ or http://www.gnupg.org/download/#libgcrypt" TYPE OPTIONAL )
0283         set_package_properties( Libgcrypt PROPERTIES DESCRIPTION "OpenSSL or GNU Libgcrypt provides cryptographic functions required by mp3tunes." URL "http://www.openssl.org/ or http://www.gnupg.org/download/#libgcrypt" TYPE OPTIONAL )
0284 
0285         find_package(Loudmouth)
0286         set_package_properties( Loudmouth PROPERTIES DESCRIPTION "Loudmouth is the communication backend needed by mp3tunes for syncing." URL "http://www.loudmouth-project.org" TYPE OPTIONAL )
0287 
0288         include(CheckQtGlib)
0289         set_package_properties( QT5_GLIB PROPERTIES DESCRIPTION "Qt5 must be compiled with glib support for mp3tunes" URL "http://www.trolltech.com" TYPE OPTIONAL )
0290     endif()
0291 
0292     if( WITH_IPOD OR WITH_MP3Tunes )
0293         pkg_search_module( GOBJECT REQUIRED gobject-2.0 )
0294         set_package_properties( GOBJECT PROPERTIES DESCRIPTION "Required by libgpod and mp3tunes." URL "http://www.gtk.org" TYPE OPTIONAL )
0295         pkg_search_module( GLIB2 glib-2.0 )
0296         set_package_properties( GLIB2 PROPERTIES DESCRIPTION "Required by libgpod and mp3tunes" URL "http://www.gtk.org" TYPE OPTIONAL )
0297     endif()
0298 
0299     find_package(PythonInterp)
0300     set_package_properties( PYTHON PROPERTIES DESCRIPTION "Required for generating the autocompletion file for the script console" URL "https://www.python.org" TYPE OPTIONAL )
0301 
0302     find_package(FFTW3 REQUIRED)
0303 
0304     if( BUILD_TESTING AND NOT WIN32 )
0305         enable_testing()
0306         add_subdirectory( tests )
0307     endif()
0308 
0309     add_subdirectory( src )
0310     add_subdirectory( doc )
0311 
0312     feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
0313 
0314     #Do not remove or modify these.  The release script substitutes in for these
0315     #comments with appropriate doc and translation directories.
0316     #PO_SUBDIR
0317 
0318 endif()
0319 
0320 if( WITH_UTILITIES )
0321     add_subdirectory( utilities )
0322 endif()
0323 
0324 if( WITH_PLAYGROUND )
0325     add_subdirectory( playground )
0326     message(STATUS "Included playground subdirectory in configuration")
0327 endif()
0328 
0329 include(CTest)