2018-02-27 18:06:05 +01:00
project ( strawberry )
2020-04-23 20:59:09 +02:00
cmake_minimum_required ( VERSION 3.0 )
cmake_policy ( SET CMP0054 NEW )
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/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 )
2020-09-01 20:40:14 +02:00
if ( APPLE )
include ( cmake/Dmg.cmake )
endif ( )
2018-02-27 18:06:05 +01:00
2020-04-23 20:59:09 +02:00
set ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /cmake )
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 )
2020-04-23 20:59:09 +02:00
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
list ( APPEND COMPILE_OPTIONS
2020-04-24 00:01:59 +02:00
$ < $ < C O M P I L E _ L A N G U A G E : C > : - - s t d = c 9 9 >
$ < $ < C O M P I L E _ L A N G U A G E : C X X > : - - s t d = c + + 1 1 >
2020-04-23 20:59:09 +02:00
- U _ _ S T R I C T _ A N S I _ _
- W a l l
- W e x t r a
- W p e d a n t i c
- W u n u s e d
- W s h a d o w
- W u n d e f
- W u n i n i t i a l i z e d
- W r e d u n d a n t - d e c l s
- W c a s t - a l i g n
- W i n i t - s e l f
- W m i s s i n g - i n c l u d e - d i r s
- W m i s s i n g - d e c l a r a t i o n s
- W s t r i c t - o v e r f l o w = 2
- W u n u s e d - p a r a m e t e r
- W f o r m a t = 2
- W d i s a b l e d - o p t i m i z a t i o n
2020-04-24 00:01:59 +02:00
$ < $ < C O M P I L E _ L A N G U A G E : C X X > : - W o v e r l o a d e d - v i r t u a l >
$ < $ < C O M P I L E _ L A N G U A G E : C X X > : - W n o - o l d - s t y l e - c a s t >
$ < $ < C O M P I L E _ L A N G U A G E : C X X > : - f p e r m i s s i v e >
2020-04-23 20:59:09 +02:00
)
2020-04-23 21:50:25 +02:00
option ( BUILD_WERROR "Build with -Werror" OFF )
2020-04-23 20:59:09 +02:00
if ( BUILD_WERROR )
list ( APPEND COMPILE_OPTIONS -Werror )
endif ( BUILD_WERROR )
add_compile_options ( ${ COMPILE_OPTIONS } )
2018-02-27 18:06:05 +01:00
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
2020-08-02 04:49:26 +02:00
if ( APPLE )
set ( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE )
set ( CMAKE_INSTALL_RPATH "@loader_path/../Frameworks" )
endif ( )
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 ( )
find_package ( PkgConfig REQUIRED )
2019-11-15 00:22:41 +01:00
find_package ( Boost REQUIRED )
2018-05-10 15:29:28 +02:00
find_package ( Threads )
2020-02-23 20:42:30 +01:00
find_package ( Backtrace QUIET )
2020-03-08 18:40:39 +01:00
if ( Backtrace_FOUND )
set ( HAVE_BACKTRACE ON )
endif ( )
2020-09-10 17:14:14 +02:00
find_package ( Iconv QUIET )
2020-07-08 17:29:58 +02:00
find_package ( GnuTLS REQUIRED )
2018-05-10 15:29:28 +02:00
find_package ( Protobuf REQUIRED )
2020-08-07 19:43:03 +02:00
if ( NOT Protobuf_PROTOC_EXECUTABLE )
message ( FATAL_ERROR "Missing protobuf compiler." )
endif ( )
2018-05-10 15:29:28 +02:00
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 ( )
2019-11-15 00:22:41 +01:00
pkg_check_modules ( GLIB REQUIRED glib-2.0 )
pkg_check_modules ( GOBJECT REQUIRED gobject-2.0 )
2020-06-17 22:56:20 +02:00
pkg_check_modules ( GIO REQUIRED gio-2.0 )
2019-11-15 00:22:41 +01:00
pkg_check_modules ( LIBCDIO libcdio )
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 ( LIBVLC libvlc )
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 )
2020-09-01 20:27:05 +02:00
pkg_check_modules ( GDK_PIXBUF gdk-pixbuf-2.0 )
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
2020-10-01 19:43:39 +02:00
option ( BUILD_WITH_QT5 "Use Qt 5" OFF )
option ( BUILD_WITH_QT6 "Use Qt 6" OFF )
if ( WITH_QT6 )
set ( BUILD_WITH_QT6 ON )
endif ( )
if ( NOT BUILD_WITH_QT5 AND NOT BUILD_WITH_QT6 )
set ( BUILD_WITH_QT5 ON )
endif ( )
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-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
2020-10-01 19:43:39 +02:00
if ( BUILD_WITH_QT6 )
2020-07-18 04:47:54 +02:00
list ( APPEND QT_COMPONENTS Core5Compat )
find_package ( Qt6 REQUIRED COMPONENTS ${ QT_COMPONENTS } )
set ( QtCore_LIBRARIES Qt6::Core )
set ( QtConcurrent_LIBRARIES Qt6::Concurrent )
set ( QtWidgets_LIBRARIES Qt6::Widgets )
set ( QtNetwork_LIBRARIES Qt6::Network )
set ( QtSql_LIBRARIES Qt6::Sql )
set ( QT_LIBRARIES Qt6::Core Qt6::Concurrent Qt6::Widgets Qt6::Network Qt6::Sql Qt6::Core5Compat )
if ( Qt6DBus_FOUND )
set ( QtDBus_LIBRARIES Qt6::DBus )
list ( APPEND QT_LIBRARIES Qt6::DBus )
get_target_property ( QT_DBUSXML2CPP_EXECUTABLE Qt6::qdbusxml2cpp LOCATION )
endif ( )
if ( Qt6X11Extras_FOUND )
set ( QtX11Extras_LIBRARIES Qt6::X11Extras )
list ( APPEND QT_LIBRARIES Qt6::X11Extras )
endif ( )
if ( Qt6WinExtras_FOUND )
set ( QtWinExtras_LIBRARIES Qt6::WinExtras )
list ( APPEND QT_LIBRARIES Qt6::WinExtras )
endif ( )
find_package ( Qt6 QUIET COMPONENTS LinguistTools CONFIG )
if ( Qt6LinguistTools_FOUND )
set ( QT_LCONVERT_EXECUTABLE Qt6::lconvert )
endif ( )
2020-10-01 19:43:39 +02:00
elseif ( BUILD_WITH_QT5 )
2020-07-18 04:47:54 +02:00
set ( QT_MIN_VERSION 5.8 )
find_package ( Qt5 ${ QT_MIN_VERSION } REQUIRED COMPONENTS ${ QT_COMPONENTS } )
set ( QtCore_LIBRARIES ${ Qt5Core_LIBRARIES } )
set ( QtConcurrent_LIBRARIES ${ Qt5Concurrent_LIBRARIES } )
set ( QtWidgets_LIBRARIES ${ Qt5Widgets_LIBRARIES } )
set ( QtNetwork_LIBRARIES ${ Qt5Network_LIBRARIES } )
set ( QtSql_LIBRARIES ${ Qt5Sql_LIBRARIES } )
set ( QT_LIBRARIES ${ QtCore_LIBRARIES } ${ QtConcurrent_LIBRARIES } ${ QtWidgets_LIBRARIES } ${ QtNetwork_LIBRARIES } ${ QtSql_LIBRARIES } )
set ( QT_INCLUDE_DIRS ${ Qt5Core_INCLUDE_DIRS } ${ Qt5Concurrent_INCLUDE_DIRS } ${ Qt5Widgets_INCLUDE_DIRS } ${ Qt5Network_INCLUDE_DIRS } ${ Qt5Sql_INCLUDE_DIRS } )
if ( Qt5DBus_FOUND )
set ( QtDBus_LIBRARIES ${ Qt5DBus_LIBRARIES } )
list ( APPEND QT_LIBRARIES ${ Qt5DBus_LIBRARIES } )
list ( APPEND QT_INCLUDE_DIRS ${ Qt5DBus_INCLUDE_DIRS } )
get_target_property ( QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION )
endif ( )
if ( Qt5X11Extras_FOUND )
set ( QtX11Extras_LIBRARIES ${ Qt5X11Extras_LIBRARIES } )
list ( APPEND QT_LIBRARIES ${ Qt5X11Extras_LIBRARIES } )
list ( APPEND QT_INCLUDE_DIRS ${ Qt5X11Extras_INCLUDE_DIRS } )
endif ( )
if ( Qt5WinExtras_FOUND )
set ( QtWinExtras_LIBRARIES ${ Qt5WinExtras_LIBRARIES } )
list ( APPEND QT_LIBRARIES ${ Qt5WinExtras_LIBRARIES } )
list ( APPEND QT_INCLUDE_DIRS ${ Qt5WinExtras_INCLUDE_DIRS } )
endif ( )
find_package ( Qt5 ${ QT_MIN_VERSION } QUIET COMPONENTS LinguistTools CONFIG )
if ( Qt5LinguistTools_FOUND )
set ( QT_LCONVERT_EXECUTABLE Qt5::lconvert )
endif ( )
2020-10-01 19:43:39 +02:00
else ( )
message ( FATAL_ERROR "Set BUILD_WITH_QT5 or BUILD_WITH_QT6" )
2019-02-22 20:24:38 +01:00
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
2020-07-07 23:44:04 +02:00
option ( USE_SYSTEM_TAGLIB "Use system taglib" OFF )
if ( USE_SYSTEM_TAGLIB )
pkg_check_modules ( TAGLIB REQUIRED taglib>=1.11.1 )
message ( WARNING "Using system taglib library." )
find_path ( HAVE_TAGLIB_DSFFILE_H taglib/dsffile.h )
find_path ( HAVE_TAGLIB_DSDIFFFILE_H taglib/dsdifffile.h )
if ( HAVE_TAGLIB_DSFFILE_H )
set ( HAVE_TAGLIB_DSFFILE ON )
endif ( HAVE_TAGLIB_DSFFILE_H )
if ( HAVE_TAGLIB_DSDIFFFILE_H )
set ( HAVE_TAGLIB_DSDIFFFILE ON )
endif ( HAVE_TAGLIB_DSDIFFFILE_H )
else ( USE_SYSTEM_TAGLIB )
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 )
set ( HAVE_TAGLIB_DSFFILE ON )
set ( HAVE_TAGLIB_DSDIFFFILE ON )
add_definitions ( -DTAGLIB_STATIC )
endif ( USE_SYSTEM_TAGLIB )
2018-02-27 18:06:05 +01:00
2019-01-07 01:00:58 +01:00
# SingleApplication
2020-06-26 23:30:30 +02:00
add_subdirectory ( 3rdparty/singleapplication )
set ( SINGLEAPPLICATION_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/singleapplication )
set ( SINGLEAPPLICATION_LIBRARIES singleapplication )
set ( SINGLECOREAPPLICATION_LIBRARIES singlecoreapplication )
2018-05-15 00:25:30 +02:00
2020-08-01 03:37:16 +02:00
if ( APPLE )
2020-08-02 04:49:26 +02:00
find_library ( SPARKLE Sparkle )
2020-08-01 03:37:16 +02:00
endif ( APPLE )
2020-08-02 04:49:26 +02:00
if ( NOT SPARKLE AND ( APPLE OR WIN32 ) )
2020-10-01 19:43:39 +02:00
if ( BUILD_WITH_QT6 )
2020-08-01 03:37:16 +02:00
pkg_check_modules ( QTSPARKLE qtsparkle-qt6 )
else ( )
pkg_check_modules ( QTSPARKLE qtsparkle-qt5 )
endif ( )
if ( QTSPARKLE_FOUND )
set ( HAVE_QTSPARKLE ON )
endif ( )
endif ( )
2018-02-27 18:06:05 +01:00
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"
D E P E N D S " a l s a " A L S A _ F O U N D
)
optional_component ( LIBPULSE ON "Pulse audio integration"
D E P E N D S " l i b p u l s e " L I B P U L S E _ F O U N D
)
2018-05-15 00:25:30 +02:00
optional_component ( DBUS ON "D-Bus support"
D E P E N D S " D - B u s " D B U S _ F O U N D
)
2018-05-01 00:41:33 +02:00
optional_component ( GSTREAMER ON "Engine: GStreamer backend"
D E P E N D S " g s t r e a m e r - 1 . 0 " G S T R E A M E R _ F O U N D
D E P E N D S " g s t r e a m e r - b a s e - 1 . 0 " G S T R E A M E R _ B A S E _ F O U N D
D E P E N D S " g s t r e a m e r - a p p - 1 . 0 " G S T R E A M E R _ A P P _ F O U N D
D E P E N D S " g s t r e a m e r - a u d i o - 1 . 0 " G S T R E A M E R _ A U D I O _ F O U N D
D E P E N D S " g s t r e a m e r - t a g - 1 . 0 " G S T R E A M E R _ T A G _ F O U N D
2019-09-07 23:34:13 +02:00
D E P E N D S " g s t r e a m e r - p b u t i l s - 1 . 0 " G S T R E A M E R _ P B U T I L S _ F O U N D
2018-05-01 00:41:33 +02:00
)
2018-06-28 01:15:32 +02:00
optional_component ( VLC ON "Engine: VLC backend"
2018-05-01 00:41:33 +02:00
D E P E N D S " l i b v l c " L I B V L C _ F O U N D
)
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
D E P E N D S " c h r o m a p r i n t " C H R O M A P R I N T _ F O U N D
)
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"
D E P E N D S " D - B u s , X 1 1 , W i n d o w s o r m a c O S " H A V E _ G L O B A L S H O R T C U T S _ S U P P O R T
)
2018-02-27 18:06:05 +01:00
optional_component ( AUDIOCD ON "Devices: Audio CD support"
2019-11-15 00:22:41 +01:00
D E P E N D S " l i b c d i o " L I B C D I O _ F O U N D
2018-02-27 18:06:05 +01:00
)
2018-07-16 07:23:37 +02:00
optional_component ( UDISKS2 ON "Devices: UDisks2 backend"
D E P E N D S " D - B u s s u p p o r t " D B U S _ F O U N D
2018-02-27 18:06:05 +01:00
)
optional_component ( GIO ON "Devices: GIO device backend"
D E P E N D S " l i b g i o " G I O _ F O U N D
2018-05-14 17:57:37 +02:00
D E P E N D S " U n i x o r W i n d o w s " " N O T 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"
D E P E N D S " l i b g p o d " L I B G P O D _ F O U N D
2020-09-01 20:27:05 +02:00
D E P E N D S " g d k - p i x b u f " G D K _ P I X B U F _ F O U N D
2018-02-27 18:06:05 +01:00
)
optional_component ( LIBMTP ON "Devices: MTP support"
D E P E N D S " l i b m t p " L I B M T P _ F O U N D
)
optional_component ( SPARKLE ON "Sparkle integration"
2019-01-01 20:07:29 +01:00
D E P E N D S " m a c O S " APPLE
2018-02-27 18:06:05 +01:00
D E P E N D S " S p a r k l e " S P A R K L E
)
2020-10-01 19:43:39 +02:00
if ( BUILD_WITH_QT6 )
2020-07-30 20:49:24 +02:00
optional_component ( TRANSLATIONS ON "Translations"
D E P E N D S " g e t t e x t " G E T T E X T _ F O U N D
D E P E N D S " Q t 6 L i n g u i s t T o o l s " Q t 6 L i n g u i s t T o o l s _ F O U N D
)
else ( )
optional_component ( TRANSLATIONS ON "Translations"
D E P E N D S " g e t t e x t " G E T T E X T _ F O U N D
D E P E N D S " Q t 5 L i n g u i s t T o o l s " Q t 5 L i n g u i s t T o o l s _ F O U N D
)
endif ( )
2019-02-22 20:24:38 +01:00
2020-08-13 19:53:36 +02:00
option ( INSTALL_TRANSLATIONS "Install translations" OFF )
2019-06-17 23:54:24 +02:00
optional_component ( SUBSONIC ON "Subsonic support" )
2020-04-13 19:04:06 +02:00
optional_component ( TIDAL ON "Tidal support" )
2020-09-17 17:50:17 +02:00
optional_component ( QOBUZ ON "Qobuz support" )
2018-11-27 19:33:30 +01:00
2019-04-18 15:03:01 +02:00
optional_component ( MOODBAR ON "Moodbar"
D E P E N D S " f f t w 3 " F F T W 3 _ F O U N D
D E P E N D S " g s t r e a m e r " H A V E _ G S T R E A M E R
)
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" )
2020-07-18 04:47:54 +02:00
set ( CMAKE_REQUIRED_LIBRARIES ${ QtCore_LIBRARIES } ${ QtSql_LIBRARIES } )
set ( CMAKE_REQUIRED_INCLUDES ${ QtCore_INCLUDE_DIRS } ${ QtSql_INCLUDE_DIRS } )
2019-07-31 23:06:59 +02:00
check_cxx_source_runs ( "
#include <QSqlDatabase>
#include <QSqlQuery>
i n t main ( ) {
Q S q l D a t a b a s e d b = Q S q l D a t a b a s e : : addDatabase ( \"QSQLITE\");
d b . setDatabaseName ( \":memory:\");
if ( !db.open( ) ) { r e t u r n 1 ; }
Q S q l Q u e r y q ( db ) ;
q . prepare ( \"CREATE VIRTUAL TABLE test_fts USING fts5(test, tokenize = 'unicode61 remove_diacritics 0' ) ; \ " ) ;
if ( !q.exec( ) ) r e t u r n 1 ;
}
"
S Q L I T E 3 _ F T S 5
)
endif ( )
2019-07-31 20:05:38 +02:00
2020-04-23 20:59:09 +02:00
# Set up definitions
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 } )
2020-04-23 20:59:09 +02:00
add_definitions ( -DQT_STRICT_ITERATORS )
2018-05-15 00:25:30 +02:00
add_definitions ( -DQT_USE_QSTRINGBUILDER )
add_definitions ( -DQT_NO_URL_CAST_FROM_STRING )
2020-04-23 20:59:09 +02:00
add_definitions ( -DQT_NO_CAST_TO_ASCII )
2018-03-18 18:39:30 +01:00
2018-02-27 18:06:05 +01:00
# Subdirectories
add_subdirectory ( src )
add_subdirectory ( dist )
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
2020-06-26 23:30:30 +02:00
option ( BUILD_TESTS "Build the test suite" OFF )
option ( BUILD_TAGLIB_TESTS "Build the test suite" OFF )
if ( BUILD_TESTS )
add_subdirectory ( tests )
endif ( BUILD_TESTS )
2020-07-07 23:44:04 +02:00
if ( NOT USE_SYSTEM_TAGLIB AND BUILD_TAGLIB_TESTS )
2020-06-26 23:30:30 +02:00
add_subdirectory ( tests/taglib )
2020-07-07 23:44:04 +02:00
endif ( NOT USE_SYSTEM_TAGLIB AND BUILD_TAGLIB_TESTS )
2020-06-26 23:30:30 +02:00
2018-02-27 18:06:05 +01:00
# Uninstall support
configure_file (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
add_custom_target ( uninstall
" $ { C M A K E _ C O M M A N D } " - P " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e " )
# Show a summary of what we have enabled
summary_show ( )
2020-07-16 00:59:46 +02:00
if ( NOT HAVE_GSTREAMER AND NOT HAVE_VLC )
message ( FATAL_ERROR "You need to have either GStreamer or VLC 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 ( )
2020-07-07 23:44:04 +02:00
if ( USE_SYSTEM_TAGLIB AND NOT TAGLIB_VERSION VERSION_GREATER 1.11.2 )
message ( WARNING "Using system taglib library. There is a critical bug in the current latest version of TagLib (1.11.1) that can corrupt Ogg files, make sure your systems version has been patched, see: https://github.com/taglib/taglib/issues/864, TagLib upstream is currently not maintained. Do not set USE_SYSTEM_TAGLIB unless you are prepared keep the TagLib in your system up to date with critical fixes." )
endif ( )