2018-02-27 18:06:05 +01:00
|
|
|
# Strawberry Music Player
|
|
|
|
# Copyright 2013, Jonas Kvinge <jonas@strawbs.net>
|
|
|
|
#
|
|
|
|
# Strawberry 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 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Strawberry 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 Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
project(strawberry)
|
|
|
|
cmake_minimum_required(VERSION 2.8.11)
|
2019-01-07 18:02:50 +01:00
|
|
|
if(CMAKE_VERSION VERSION_GREATER 3.0)
|
2018-07-11 17:23:44 +02:00
|
|
|
cmake_policy(SET CMP0054 NEW)
|
|
|
|
endif()
|
2018-02-27 18:06:05 +01:00
|
|
|
|
|
|
|
include(CheckCXXCompilerFlag)
|
2019-07-31 20:05:38 +02:00
|
|
|
include(CheckCXXSourceRuns)
|
2018-02-27 18:06:05 +01:00
|
|
|
include(CheckIncludeFiles)
|
|
|
|
include(FindPkgConfig)
|
|
|
|
include(cmake/C++11Compat.cmake)
|
|
|
|
include(cmake/Version.cmake)
|
2018-05-10 15:29:28 +02:00
|
|
|
include(cmake/Summary.cmake)
|
2018-02-27 18:06:05 +01:00
|
|
|
include(cmake/OptionalSource.cmake)
|
2018-05-15 00:25:30 +02:00
|
|
|
include(cmake/ParseArguments.cmake)
|
2018-05-10 15:29:28 +02:00
|
|
|
include(cmake/Rpm.cmake)
|
2018-07-16 02:57:57 +02:00
|
|
|
include(cmake/Deb.cmake)
|
2019-01-04 01:22:32 +01:00
|
|
|
include(cmake/Dmg.cmake)
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2018-05-14 17:57:37 +02:00
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
2018-10-31 19:41:52 +01:00
|
|
|
set(LINUX ON)
|
2018-05-14 17:57:37 +02:00
|
|
|
endif()
|
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
2018-10-31 19:41:52 +01:00
|
|
|
set(FREEBSD ON)
|
2018-05-14 17:57:37 +02:00
|
|
|
endif()
|
|
|
|
if (${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
|
2018-10-31 19:41:52 +01:00
|
|
|
set(OPENBSD ON)
|
2018-05-14 17:57:37 +02:00
|
|
|
endif()
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2018-05-14 17:57:37 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2018-02-27 18:06:05 +01:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
|
|
|
|
2018-05-10 15:29:28 +02:00
|
|
|
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
|
|
|
add_definitions(-DNDEBUG)
|
|
|
|
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
|
|
|
#add_definitions(-DQT_NO_WARNING_OUTPUT)
|
2018-10-31 19:41:52 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
|
|
|
set(DEBUG ON)
|
|
|
|
endif()
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2018-02-27 18:06:05 +01:00
|
|
|
if (CMAKE_CXX_COMPILER MATCHES ".*clang")
|
|
|
|
set(CMAKE_COMPILER_IS_CLANGXX 1)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-uninitialized")
|
2018-05-14 17:57:37 +02:00
|
|
|
endif()
|
2018-02-27 18:06:05 +01:00
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++")
|
2018-05-14 17:57:37 +02:00
|
|
|
endif(APPLE)
|
2018-02-27 18:06:05 +01:00
|
|
|
|
|
|
|
find_program(CCACHE_EXECUTABLE NAMES ccache)
|
|
|
|
if (CCACHE_EXECUTABLE)
|
|
|
|
message(STATUS "ccache found: will be used for compilation and linkage")
|
|
|
|
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_EXECUTABLE})
|
|
|
|
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE})
|
|
|
|
endif ()
|
2018-05-10 15:29:28 +02:00
|
|
|
find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt5 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
|
|
|
|
find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt5)
|
2018-02-27 18:06:05 +01:00
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
|
|
|
pkg_check_modules(GIO REQUIRED gio-2.0)
|
|
|
|
pkg_check_modules(GOBJECT REQUIRED gobject-2.0)
|
|
|
|
pkg_check_modules(CDIO libcdio)
|
2018-05-10 15:29:28 +02:00
|
|
|
find_package(Threads)
|
2019-04-16 17:48:11 +02:00
|
|
|
find_package(GnuTLS)
|
2018-05-10 15:29:28 +02:00
|
|
|
find_package(Boost REQUIRED)
|
|
|
|
find_package(Protobuf REQUIRED)
|
|
|
|
find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf)
|
|
|
|
if(LINUX)
|
|
|
|
find_package(ALSA REQUIRED)
|
2018-07-16 01:20:29 +02:00
|
|
|
pkg_check_modules(DBUS REQUIRED dbus-1)
|
2018-05-14 17:57:37 +02:00
|
|
|
else(LINUX)
|
|
|
|
find_package(ALSA)
|
2018-07-16 01:20:29 +02:00
|
|
|
pkg_check_modules(DBUS dbus-1)
|
2018-05-10 15:29:28 +02:00
|
|
|
endif(LINUX)
|
2019-01-01 20:07:29 +01:00
|
|
|
if (UNIX AND NOT APPLE)
|
2018-07-05 19:11:47 +02:00
|
|
|
find_package(X11)
|
2019-01-01 20:07:29 +01:00
|
|
|
pkg_check_modules(XCB xcb)
|
2018-07-05 19:11:47 +02:00
|
|
|
endif()
|
2018-07-03 20:32:28 +02:00
|
|
|
if(X11_FOUND)
|
|
|
|
set(HAVE_X11 ON)
|
|
|
|
endif()
|
2018-02-27 18:06:05 +01:00
|
|
|
pkg_check_modules(GSTREAMER gstreamer-1.0)
|
|
|
|
pkg_check_modules(GSTREAMER_BASE gstreamer-base-1.0)
|
|
|
|
pkg_check_modules(GSTREAMER_AUDIO gstreamer-audio-1.0)
|
2018-05-15 00:25:30 +02:00
|
|
|
pkg_check_modules(GSTREAMER_APP gstreamer-app-1.0)
|
2018-02-27 18:06:05 +01:00
|
|
|
pkg_check_modules(GSTREAMER_TAG gstreamer-tag-1.0)
|
2019-09-07 23:34:13 +02:00
|
|
|
pkg_check_modules(GSTREAMER_PBUTILS gstreamer-pbutils-1.0)
|
2018-02-27 18:06:05 +01:00
|
|
|
pkg_check_modules(LIBXINE libxine)
|
|
|
|
pkg_check_modules(LIBVLC libvlc)
|
|
|
|
pkg_check_modules(PHONON phonon4qt5)
|
2019-07-30 22:45:22 +02:00
|
|
|
pkg_check_modules(SQLITE REQUIRED sqlite3>=3.9)
|
2018-07-03 19:33:09 +02:00
|
|
|
pkg_check_modules(LIBPULSE libpulse)
|
2018-07-16 07:23:37 +02:00
|
|
|
pkg_check_modules(CHROMAPRINT libchromaprint)
|
2018-02-27 18:06:05 +01:00
|
|
|
pkg_check_modules(LIBGPOD libgpod-1.0>=0.7.92)
|
|
|
|
pkg_check_modules(LIBMTP libmtp>=1.0)
|
2018-11-05 01:14:56 +01:00
|
|
|
pkg_check_modules(LIBIMOBILEDEVICE libimobiledevice-1.0)
|
|
|
|
pkg_check_modules(LIBUSBMUXD libusbmuxd)
|
|
|
|
pkg_check_modules(LIBPLIST libplist)
|
2019-02-22 20:24:38 +01:00
|
|
|
find_package(Gettext)
|
2019-04-18 15:03:01 +02:00
|
|
|
find_package(FFTW3)
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2018-05-14 17:57:37 +02:00
|
|
|
if(WIN32)
|
2018-02-27 18:06:05 +01:00
|
|
|
find_package(ZLIB REQUIRED)
|
2018-05-14 17:57:37 +02:00
|
|
|
endif(WIN32)
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2018-05-10 15:29:28 +02:00
|
|
|
# QT
|
2019-01-07 19:04:53 +01:00
|
|
|
set(QT_MIN_VERSION 5.5)
|
2019-06-08 22:03:10 +02:00
|
|
|
set(QT_COMPONENTS Core Concurrent Widgets Network Sql)
|
|
|
|
|
2018-05-10 15:29:28 +02:00
|
|
|
if(X11_FOUND)
|
2019-06-08 22:03:10 +02:00
|
|
|
list(APPEND QT_COMPONENTS X11Extras)
|
2018-05-10 15:29:28 +02:00
|
|
|
endif()
|
2018-05-15 00:25:30 +02:00
|
|
|
if(DBUS_FOUND)
|
2019-06-08 22:03:10 +02:00
|
|
|
list(APPEND QT_COMPONENTS DBus)
|
2018-05-15 00:25:30 +02:00
|
|
|
endif()
|
2018-05-10 15:29:28 +02:00
|
|
|
if(APPLE)
|
2019-06-08 22:03:10 +02:00
|
|
|
list(APPEND QT_COMPONENTS MacExtras)
|
2018-07-01 22:26:46 +02:00
|
|
|
endif()
|
2018-09-15 13:07:51 +02:00
|
|
|
if(WIN32)
|
2019-06-08 22:03:10 +02:00
|
|
|
list(APPEND QT_COMPONENTS WinExtras)
|
2018-09-15 13:07:51 +02:00
|
|
|
endif()
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2019-06-08 22:03:10 +02:00
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED ${QT_COMPONENTS})
|
2018-07-03 19:33:09 +02:00
|
|
|
|
2019-06-08 22:03:10 +02:00
|
|
|
set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Concurrent_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Sql_LIBRARIES})
|
|
|
|
|
|
|
|
if(Qt5DBus_FOUND)
|
|
|
|
list(APPEND QT_LIBRARIES ${Qt5DBus_LIBRARIES})
|
|
|
|
get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION)
|
2018-07-03 19:33:09 +02:00
|
|
|
endif()
|
2019-06-08 22:03:10 +02:00
|
|
|
if(Qt5X11Extras_FOUND)
|
|
|
|
list(APPEND QT_LIBRARIES ${Qt5X11Extras_LIBRARIES})
|
2018-07-03 19:33:09 +02:00
|
|
|
endif()
|
2019-06-08 22:03:10 +02:00
|
|
|
if(Qt5MacExtras_FOUND)
|
|
|
|
list(APPEND QT_LIBRARIES ${Qt5MacExtras_LIBRARIES})
|
2018-05-15 00:25:30 +02:00
|
|
|
endif()
|
2019-06-08 22:03:10 +02:00
|
|
|
if(Qt5WinExtras_FOUND)
|
|
|
|
list(APPEND QT_LIBRARIES ${Qt5WinExtras_LIBRARIES})
|
2018-09-15 13:07:51 +02:00
|
|
|
endif()
|
2018-05-15 00:25:30 +02:00
|
|
|
|
2019-02-22 20:24:38 +01:00
|
|
|
find_package(Qt5LinguistTools CONFIG)
|
|
|
|
if (Qt5LinguistTools_FOUND)
|
|
|
|
set(QT_LCONVERT_EXECUTABLE Qt5::lconvert)
|
|
|
|
endif()
|
|
|
|
|
2019-01-01 20:07:29 +01:00
|
|
|
if(X11_FOUND)
|
2019-01-24 18:25:54 +01:00
|
|
|
find_path(KEYSYMDEF_H NAMES "keysymdef.h" PATHS "${X11_INCLUDE_DIR}" PATH_SUFFIXES "X11")
|
|
|
|
find_path(XF86KEYSYM_H NAMES "XF86keysym.h" PATHS "${XCB_INCLUDEDIR}" PATH_SUFFIXES "X11")
|
2019-01-01 20:07:29 +01:00
|
|
|
if(KEYSYMDEF_H)
|
|
|
|
set(HAVE_KEYSYMDEF_H ON)
|
2019-01-08 23:49:35 +01:00
|
|
|
else()
|
|
|
|
message(WARNING, "Missing X11/keysymdef.h")
|
2019-01-01 20:07:29 +01:00
|
|
|
endif()
|
|
|
|
if(XF86KEYSYM_H)
|
|
|
|
set(HAVE_XF86KEYSYM_H ON)
|
2019-01-08 23:49:35 +01:00
|
|
|
else()
|
|
|
|
message(WARNING, "Missing X11/XF86keysym.h")
|
2019-01-01 20:07:29 +01:00
|
|
|
endif()
|
|
|
|
endif(X11_FOUND)
|
|
|
|
|
2018-02-27 18:06:05 +01:00
|
|
|
# TAGLIB
|
2018-05-10 15:29:28 +02:00
|
|
|
pkg_check_modules(TAGLIB taglib)
|
2018-11-05 01:14:56 +01:00
|
|
|
# Only use system taglib if it's greater than 1.11.1
|
|
|
|
# There is a bug in version 1.11.1 corrupting Ogg files, see: https://github.com/taglib/taglib/issues/864
|
|
|
|
# If you decide to use the systems taglib, make sure it has been patched with the following commit:
|
|
|
|
# https://github.com/taglib/taglib/commit/9336c82da3a04552168f208cd7a5fa4646701ea4
|
|
|
|
# The current taglib in 3rdparty also has the following features used by strawberry:
|
|
|
|
# - Audio file detection by content.
|
|
|
|
# - DSF and DSDIFF support
|
|
|
|
#
|
2018-05-10 15:29:28 +02:00
|
|
|
if (TAGLIB_VERSION VERSION_GREATER 1.11.1 OR WIN32)
|
|
|
|
option(USE_SYSTEM_TAGLIB "Use system taglib" ON)
|
|
|
|
else()
|
|
|
|
option(USE_SYSTEM_TAGLIB "Use system taglib" OFF)
|
|
|
|
endif()
|
2018-05-10 17:08:55 +02:00
|
|
|
if (TAGLIB_FOUND AND USE_SYSTEM_TAGLIB)
|
2018-11-05 01:14:56 +01:00
|
|
|
if (TAGLIB_VERSION VERSION_GREATER 1.11.1 OR WIN32)
|
|
|
|
message(STATUS "Using system taglib library")
|
|
|
|
else()
|
|
|
|
message(WARNING "Using system taglib library. Version 1.11.1 or less has a bug corrupting Ogg files, make sure your systems version has been patched!")
|
|
|
|
endif()
|
2018-09-02 01:40:14 +02:00
|
|
|
find_path(HAVE_TAGLIB_DSFFILE_H taglib/dsffile.h)
|
|
|
|
if(HAVE_TAGLIB_DSFFILE_H)
|
|
|
|
set(HAVE_TAGLIB_DSFFILE ON)
|
|
|
|
endif(HAVE_TAGLIB_DSFFILE_H)
|
2018-05-10 15:29:28 +02:00
|
|
|
else()
|
|
|
|
message(STATUS "Using builtin taglib library")
|
|
|
|
set(TAGLIB_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/3rdparty/taglib/headers/taglib/;${CMAKE_BINARY_DIR}/3rdparty/taglib/headers/")
|
|
|
|
set(TAGLIB_LIBRARY_DIRS "")
|
|
|
|
set(TAGLIB_LIBRARIES tag)
|
|
|
|
add_subdirectory(3rdparty/utf8-cpp)
|
|
|
|
add_subdirectory(3rdparty/taglib)
|
2018-09-02 01:40:14 +02:00
|
|
|
set(HAVE_TAGLIB_DSFFILE ON)
|
2018-05-10 15:29:28 +02:00
|
|
|
endif()
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2019-01-07 01:00:58 +01:00
|
|
|
# SingleApplication
|
2019-01-12 02:07:39 +01:00
|
|
|
pkg_check_modules(SINGLEAPPLICATION singleapplication)
|
2019-01-18 00:40:54 +01:00
|
|
|
if (NOT SINGLEAPPLICATION_FOUND)
|
|
|
|
pkg_check_modules(SINGLEAPPLICATION libsingleapplication)
|
|
|
|
endif()
|
2019-01-12 02:07:39 +01:00
|
|
|
pkg_check_modules(SINGLECOREAPPLICATION singlecoreapplication)
|
2019-01-18 00:40:54 +01:00
|
|
|
if (NOT SINGLECOREAPPLICATION_FOUND)
|
|
|
|
pkg_check_modules(SINGLECOREAPPLICATION libsinglecoreapplication)
|
|
|
|
endif()
|
2019-01-11 01:04:13 +01:00
|
|
|
if (SINGLEAPPLICATION_FOUND AND SINGLECOREAPPLICATION_FOUND)
|
|
|
|
option(USE_SYSTEM_SINGLEAPPLICATION "Use system SingleApplication/SingleCoreApplication libraries" ON)
|
|
|
|
else(SINGLEAPPLICATION_FOUND AND SINGLECOREAPPLICATION_FOUND)
|
|
|
|
option(USE_SYSTEM_SINGLEAPPLICATION "Use system SingleApplication/SingleCoreApplication libraries" OFF)
|
|
|
|
endif(SINGLEAPPLICATION_FOUND AND SINGLECOREAPPLICATION_FOUND)
|
2019-01-07 01:00:58 +01:00
|
|
|
if(USE_SYSTEM_SINGLEAPPLICATION)
|
2019-01-11 01:04:13 +01:00
|
|
|
if (NOT SINGLEAPPLICATION_FOUND OR NOT SINGLECOREAPPLICATION_FOUND)
|
|
|
|
message(FATAL_ERROR "Missing SingleApplication or SingleCoreApplication")
|
2019-01-07 01:00:58 +01:00
|
|
|
endif()
|
2019-01-11 01:04:13 +01:00
|
|
|
message(STATUS "Using system SingleApplication and SingleCoreApplication libraries")
|
2019-01-07 01:00:58 +01:00
|
|
|
else(USE_SYSTEM_SINGLEAPPLICATION)
|
2019-01-11 01:04:13 +01:00
|
|
|
message(STATUS "Using builtin SingleApplication and SingleCoreApplication libraries")
|
2019-01-07 01:00:58 +01:00
|
|
|
add_subdirectory(3rdparty/singleapplication)
|
|
|
|
set(SINGLEAPPLICATION_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/singleapplication)
|
|
|
|
set(SINGLEAPPLICATION_LIBRARIES singleapplication)
|
2019-01-11 01:04:13 +01:00
|
|
|
set(SINGLECOREAPPLICATION_LIBRARIES singlecoreapplication)
|
2019-01-18 01:00:07 +01:00
|
|
|
unset(SINGLEAPPLICATION_LIBRARY_DIRS)
|
|
|
|
unset(SINGLECOREAPPLICATION_LIBRARY_DIRS)
|
2019-01-07 01:00:58 +01:00
|
|
|
endif(USE_SYSTEM_SINGLEAPPLICATION)
|
2018-05-15 00:25:30 +02:00
|
|
|
|
2018-02-27 18:06:05 +01:00
|
|
|
if (APPLE)
|
|
|
|
find_library(SPARKLE Sparkle)
|
|
|
|
endif (APPLE)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
# RC compiler
|
|
|
|
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
|
|
|
|
enable_language(RC)
|
|
|
|
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I ${CMAKE_SOURCE_DIR}/dist/windows")
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
# Optional bits
|
|
|
|
if(WIN32)
|
2018-05-02 00:18:54 +02:00
|
|
|
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF)
|
2018-02-27 18:06:05 +01:00
|
|
|
endif(WIN32)
|
|
|
|
|
2018-11-17 16:28:05 +01:00
|
|
|
optional_component(ALSA ON "ALSA integration"
|
|
|
|
DEPENDS "alsa" ALSA_FOUND
|
|
|
|
)
|
|
|
|
|
|
|
|
optional_component(LIBPULSE ON "Pulse audio integration"
|
|
|
|
DEPENDS "libpulse" LIBPULSE_FOUND
|
|
|
|
)
|
|
|
|
|
2018-05-15 00:25:30 +02:00
|
|
|
optional_component(DBUS ON "D-Bus support"
|
|
|
|
DEPENDS "D-Bus" DBUS_FOUND
|
|
|
|
)
|
|
|
|
|
2018-05-01 00:41:33 +02:00
|
|
|
optional_component(GSTREAMER ON "Engine: GStreamer backend"
|
|
|
|
DEPENDS "gstreamer-1.0" GSTREAMER_FOUND
|
|
|
|
DEPENDS "gstreamer-base-1.0" GSTREAMER_BASE_FOUND
|
|
|
|
DEPENDS "gstreamer-app-1.0" GSTREAMER_APP_FOUND
|
|
|
|
DEPENDS "gstreamer-audio-1.0" GSTREAMER_AUDIO_FOUND
|
|
|
|
DEPENDS "gstreamer-tag-1.0" GSTREAMER_TAG_FOUND
|
2019-09-07 23:34:13 +02:00
|
|
|
DEPENDS "gstreamer-pbutils-1.0" GSTREAMER_PBUTILS_FOUND
|
2018-05-01 00:41:33 +02:00
|
|
|
)
|
|
|
|
|
2018-06-28 01:15:32 +02:00
|
|
|
optional_component(XINE ON "Engine: Xine backend"
|
2018-05-01 00:41:33 +02:00
|
|
|
DEPENDS "libxine" LIBXINE_FOUND
|
|
|
|
)
|
|
|
|
|
2018-06-28 01:15:32 +02:00
|
|
|
optional_component(VLC ON "Engine: VLC backend"
|
2018-05-01 00:41:33 +02:00
|
|
|
DEPENDS "libvlc" LIBVLC_FOUND
|
|
|
|
)
|
|
|
|
|
2018-10-17 23:49:02 +02:00
|
|
|
optional_component(PHONON OFF "Engine: Phonon backend (UNSTABLE)"
|
2018-05-15 00:25:30 +02:00
|
|
|
DEPENDS "phonon4qt5" PHONON_FOUND
|
2018-05-01 00:41:33 +02:00
|
|
|
)
|
|
|
|
|
2019-01-01 20:07:29 +01:00
|
|
|
optional_component(CHROMAPRINT ON "Chromaprint (Tag fetching from Musicbrainz)"
|
2018-07-16 07:23:37 +02:00
|
|
|
DEPENDS "chromaprint" CHROMAPRINT_FOUND
|
|
|
|
)
|
|
|
|
|
2019-01-01 20:07:29 +01:00
|
|
|
if (X11_FOUND OR HAVE_DBUS OR APPLE OR WIN32)
|
|
|
|
set(HAVE_GLOBALSHORTCUTS_SUPPORT ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
optional_component(GLOBALSHORTCUTS ON "Global shortcuts"
|
|
|
|
DEPENDS "D-Bus, X11, Windows or macOS" HAVE_GLOBALSHORTCUTS_SUPPORT
|
|
|
|
)
|
|
|
|
|
2018-02-27 18:06:05 +01:00
|
|
|
optional_component(AUDIOCD ON "Devices: Audio CD support"
|
|
|
|
DEPENDS "libcdio" CDIO_FOUND
|
|
|
|
)
|
|
|
|
|
2018-07-16 07:23:37 +02:00
|
|
|
optional_component(UDISKS2 ON "Devices: UDisks2 backend"
|
|
|
|
DEPENDS "D-Bus support" DBUS_FOUND
|
2018-02-27 18:06:05 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
optional_component(GIO ON "Devices: GIO device backend"
|
|
|
|
DEPENDS "libgio" GIO_FOUND
|
2018-05-14 17:57:37 +02:00
|
|
|
DEPENDS "Unix or Windows" "NOT APPLE"
|
2018-02-27 18:06:05 +01:00
|
|
|
)
|
|
|
|
|
2018-07-16 07:23:37 +02:00
|
|
|
optional_component(LIBGPOD ON "Devices: iPod classic support"
|
|
|
|
DEPENDS "libgpod" LIBGPOD_FOUND
|
2018-02-27 18:06:05 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
optional_component(LIBMTP ON "Devices: MTP support"
|
|
|
|
DEPENDS "libmtp" LIBMTP_FOUND
|
|
|
|
)
|
|
|
|
|
2019-01-24 19:43:52 +01:00
|
|
|
optional_component(IMOBILEDEVICE ON "Devices: iPhone, iPod Touch, iPad and Apple TV support"
|
2018-11-05 01:14:56 +01:00
|
|
|
DEPENDS "libimobiledevice" LIBIMOBILEDEVICE_FOUND
|
|
|
|
DEPENDS "libplist" LIBPLIST_FOUND
|
|
|
|
DEPENDS "libusbmuxd" LIBUSBMUXD_FOUND
|
2019-01-24 19:43:52 +01:00
|
|
|
DEPENDS "libgpod" LIBGPOD_FOUND
|
2018-02-27 18:06:05 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
optional_component(SPARKLE ON "Sparkle integration"
|
2019-01-01 20:07:29 +01:00
|
|
|
DEPENDS "macOS" APPLE
|
2018-02-27 18:06:05 +01:00
|
|
|
DEPENDS "Sparkle" SPARKLE
|
|
|
|
)
|
|
|
|
|
2019-03-09 18:02:17 +01:00
|
|
|
optional_component(TRANSLATIONS ON "Translations"
|
2019-02-22 20:24:38 +01:00
|
|
|
DEPENDS "gettext" GETTEXT_FOUND
|
|
|
|
DEPENDS "Qt5LinguistTools" Qt5LinguistTools_FOUND
|
|
|
|
)
|
|
|
|
|
2019-04-14 18:02:51 +02:00
|
|
|
optional_component(TIDAL ON "Tidal support")
|
2019-06-19 02:22:11 +02:00
|
|
|
optional_component(QOBUZ ON "Qobuz support")
|
2019-06-17 23:54:24 +02:00
|
|
|
optional_component(SUBSONIC ON "Subsonic support")
|
2018-11-27 19:33:30 +01:00
|
|
|
|
2019-04-18 15:03:01 +02:00
|
|
|
optional_component(MOODBAR ON "Moodbar"
|
|
|
|
DEPENDS "fftw3" FFTW3_FOUND
|
|
|
|
DEPENDS "gstreamer" HAVE_GSTREAMER
|
|
|
|
)
|
|
|
|
|
2019-08-27 22:29:48 +02:00
|
|
|
if(LINUX OR APPLE)
|
|
|
|
option(USE_BUNDLE "Bundle dependencies" OFF)
|
2019-01-03 21:19:07 +01:00
|
|
|
elseif(WIN32)
|
2019-08-27 22:29:48 +02:00
|
|
|
option(USE_BUNDLE "Bundle dependencies" ON)
|
2019-01-03 21:19:07 +01:00
|
|
|
endif()
|
2019-08-27 22:29:48 +02:00
|
|
|
|
|
|
|
if (USE_BUNDLE AND NOT USE_BUNDLE_DIR)
|
|
|
|
if(LINUX)
|
|
|
|
set(USE_BUNDLE_DIR "../plugins")
|
|
|
|
endif(LINUX)
|
|
|
|
if(APPLE)
|
2019-01-03 21:19:07 +01:00
|
|
|
set(USE_BUNDLE_DIR "../PlugIns")
|
2019-08-27 22:29:48 +02:00
|
|
|
endif(APPLE)
|
|
|
|
endif(USE_BUNDLE AND NOT USE_BUNDLE_DIR)
|
2019-01-03 21:19:07 +01:00
|
|
|
|
2019-07-31 20:05:38 +02:00
|
|
|
# Check that we have sqlite3 with FTS5
|
|
|
|
|
2019-07-31 23:06:59 +02:00
|
|
|
if(NOT CMAKE_CROSSCOMPILING)
|
2019-08-01 21:49:19 +02:00
|
|
|
set(CMAKE_REQUIRED_FLAGS "--std=c++11")
|
2019-07-31 23:06:59 +02:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Sql_LIBRARIES})
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Sql_INCLUDE_DIRS})
|
|
|
|
check_cxx_source_runs("
|
|
|
|
#include <QSqlDatabase>
|
|
|
|
#include <QSqlQuery>
|
|
|
|
int main() {
|
|
|
|
QSqlDatabase db = QSqlDatabase::addDatabase(\"QSQLITE\");
|
|
|
|
db.setDatabaseName(\":memory:\");
|
|
|
|
if (!db.open()) { return 1; }
|
|
|
|
QSqlQuery q(db);
|
|
|
|
q.prepare(\"CREATE VIRTUAL TABLE test_fts USING fts5(test, tokenize = 'unicode61 remove_diacritics 0');\");
|
|
|
|
if (!q.exec()) return 1;
|
|
|
|
}
|
|
|
|
"
|
|
|
|
SQLITE3_FTS5
|
|
|
|
)
|
|
|
|
endif()
|
2019-07-31 20:05:38 +02:00
|
|
|
|
2019-05-28 18:37:51 +02:00
|
|
|
if(HAVE_XINE)
|
|
|
|
check_cxx_source_compiles("
|
|
|
|
#define METRONOM_INTERNAL
|
|
|
|
#include <iostream>
|
|
|
|
#include <xine/metronom.h>
|
|
|
|
int main() {
|
|
|
|
metronom_t metronom;
|
|
|
|
std::cout << metronom.pts_per_smpls;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
"
|
|
|
|
XINE_ANALYZER)
|
|
|
|
endif()
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2018-05-15 00:25:30 +02:00
|
|
|
# Set up definitions and paths
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2018-05-15 00:25:30 +02:00
|
|
|
add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS)
|
|
|
|
add_definitions(${QT_DEFINITIONS})
|
|
|
|
add_definitions(-DQT_USE_QSTRINGBUILDER)
|
|
|
|
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
|
|
|
|
add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS)
|
2018-02-27 18:06:05 +01:00
|
|
|
|
2018-05-15 00:25:30 +02:00
|
|
|
include_directories(${GLIB_INCLUDE_DIRS})
|
|
|
|
include_directories(${GLIBCONFIG_INCLUDE_DIRS})
|
2018-07-01 22:26:46 +02:00
|
|
|
include_directories(${TAGLIB_INCLUDE_DIRS})
|
2018-03-18 18:39:30 +01:00
|
|
|
|
2018-02-27 18:06:05 +01:00
|
|
|
# Subdirectories
|
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(dist)
|
2019-06-28 01:33:22 +02:00
|
|
|
add_subdirectory(tests)
|
2018-02-27 18:06:05 +01:00
|
|
|
add_subdirectory(ext/libstrawberry-common)
|
|
|
|
add_subdirectory(ext/libstrawberry-tagreader)
|
|
|
|
add_subdirectory(ext/strawberry-tagreader)
|
2019-04-18 15:03:01 +02:00
|
|
|
if(HAVE_MOODBAR)
|
|
|
|
add_subdirectory(ext/gstmoodbar)
|
|
|
|
endif()
|
2018-02-27 18:06:05 +01:00
|
|
|
|
|
|
|
# Uninstall support
|
|
|
|
configure_file(
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
add_custom_target(uninstall
|
|
|
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
|
|
|
|
|
|
|
# Show a summary of what we have enabled
|
|
|
|
summary_show()
|
2019-03-09 17:43:20 +01:00
|
|
|
if(NOT HAVE_GSTREAMER AND NOT HAVE_XINE AND NOT HAVE_VLC AND NOT HAVE_PHONON)
|
|
|
|
message(FATAL_ERROR "You need to have either GStreamer, Xine, VLC or Phonon to compile!")
|
2018-10-17 23:49:02 +02:00
|
|
|
elseif(NOT HAVE_GSTREAMER)
|
|
|
|
message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.")
|
2018-05-15 00:25:30 +02:00
|
|
|
endif()
|
2019-07-31 20:05:38 +02:00
|
|
|
|
2019-08-02 21:12:18 +02:00
|
|
|
if(NOT SQLITE3_FTS5 AND NOT CMAKE_CROSSCOMPILING)
|
2019-08-03 13:57:54 +02:00
|
|
|
message(WARNING "sqlite3 must be enabled with FTS5. See: https://www.sqlite.org/fts5.html")
|
2019-07-31 20:05:38 +02:00
|
|
|
endif()
|