2022-10-13 21:41:46 +02:00
cmake_minimum_required ( VERSION 3.7 )
2018-02-27 18:06:05 +01:00
project ( strawberry )
2020-04-23 20:59:09 +02:00
2023-03-08 19:01:18 +01:00
if ( POLICY CMP0054 )
cmake_policy ( SET CMP0054 NEW )
endif ( )
if ( POLICY CMP0074 )
2022-07-28 04:01:58 +02:00
cmake_policy ( SET CMP0074 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/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 )
2020-04-23 20:59:09 +02:00
2022-09-30 01:00:15 +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 ( )
2022-09-30 01:00:15 +02:00
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 ( )
2022-09-30 01:00:15 +02:00
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
2020-12-09 18:29:30 +01:00
if ( LINUX )
include ( cmake/Rpm.cmake )
include ( cmake/Deb.cmake )
endif ( )
2020-12-28 20:54:19 +01:00
if ( APPLE )
include ( cmake/Dmg.cmake )
endif ( )
2020-12-09 18:29:30 +01:00
set ( CMAKE_MODULE_PATH ${ CMAKE_SOURCE_DIR } /cmake )
2022-06-13 21:29:09 +02:00
if ( MSVC )
set ( CMAKE_C_STANDARD 99 )
else ( )
set ( CMAKE_C_STANDARD 11 )
endif ( )
2022-06-13 21:20:41 +02:00
set ( CMAKE_C_STANDARD_REQUIRED ON )
2020-11-05 22:28:49 +01:00
set ( CMAKE_CXX_STANDARD 17 )
2020-04-23 20:59:09 +02:00
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
2021-08-24 17:52:08 +02:00
if ( MSVC )
2022-06-13 21:29:09 +02:00
list ( APPEND COMPILE_OPTIONS /MP )
2021-08-24 17:52:08 +02:00
else ( )
list ( APPEND COMPILE_OPTIONS
2022-06-13 21:29:09 +02:00
$ < $ < C O M P I L E _ L A N G U A G E : C > : - s t d = c 1 1 >
2021-08-24 17:52:08 +02:00
$ < $ < C O M P I L E _ L A N G U A G E : C X X > : - s t d = c + + 1 7 >
- 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
$ < $ < 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 >
2022-06-10 00:02:19 +02:00
$ < $ < C O M P I L E _ L A N G U A G E : C X X > : - W o l d - s t y l e - c a s t >
2021-08-24 17:52:08 +02:00
)
2022-09-30 01:00:15 +02:00
option ( BUILD_WERROR "Build with -Werror" OFF )
if ( BUILD_WERROR )
list ( APPEND COMPILE_OPTIONS -Werror )
endif ( )
2021-08-07 03:02:27 +02:00
endif ( )
2020-04-23 20:59:09 +02:00
add_compile_options ( ${ COMPILE_OPTIONS } )
2018-02-27 18:06:05 +01:00
2022-09-30 01:00:15 +02:00
if ( CMAKE_BUILD_TYPE MATCHES "Release" )
2018-05-10 15:29:28 +02:00
add_definitions ( -DNDEBUG )
add_definitions ( -DQT_NO_DEBUG_OUTPUT )
2018-10-31 19:41:52 +01:00
endif ( )
2018-05-10 15:29:28 +02:00
2022-09-30 01:00:29 +02:00
option ( USE_RPATH "Use RPATH" APPLE )
if ( USE_RPATH )
set ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
2020-08-02 04:49:26 +02:00
endif ( )
2024-08-17 14:31:51 +02:00
set ( QT_NO_SHOW_OLD_QT_WRAP_CPP_WARNING ON )
2018-02-27 18:06:05 +01:00
find_program ( CCACHE_EXECUTABLE NAMES ccache )
2021-08-07 03:02:27 +02:00
if ( CCACHE_EXECUTABLE )
2018-02-27 18:06:05 +01:00
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 } )
2021-08-07 03:02:27 +02:00
endif ( )
2018-02-27 18:06:05 +01:00
find_package ( PkgConfig REQUIRED )
2023-11-13 00:11:00 +01:00
find_package ( Threads REQUIRED )
2021-07-30 23:00:34 +02:00
find_package ( Backtrace )
2020-03-08 18:40:39 +01:00
if ( Backtrace_FOUND )
set ( HAVE_BACKTRACE ON )
endif ( )
2024-07-14 17:21:37 +02:00
find_package ( Boost CONFIG )
if ( NOT Boost_FOUND )
find_package ( Boost REQUIRED )
endif ( )
2024-05-19 01:45:19 +02:00
find_package ( ICU COMPONENTS uc i18n REQUIRED )
2023-07-11 13:42:15 +02:00
find_package ( Protobuf CONFIG )
2023-05-14 21:52:55 +02:00
if ( NOT Protobuf_FOUND )
find_package ( Protobuf REQUIRED )
endif ( )
if ( NOT TARGET protobuf::protoc )
message ( FATAL_ERROR "Missing Protobuf compiler." )
2020-08-07 19:43:03 +02:00
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 )
2021-08-07 03:02:27 +02:00
else ( )
2018-05-14 17:57:37 +02:00
find_package ( ALSA )
2018-07-16 01:20:29 +02:00
pkg_check_modules ( DBUS dbus-1 )
2021-08-07 03:02:27 +02:00
endif ( )
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 )
2022-01-09 20:35:46 +01:00
if ( UNIX )
pkg_check_modules ( GIO_UNIX gio-unix-2.0 )
endif ( )
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 )
2021-04-25 21:16:44 +02:00
pkg_check_modules ( CHROMAPRINT libchromaprint>=1.4 )
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 )
2021-03-13 15:18:38 +01:00
find_package ( GTest )
find_library ( GMOCK_LIBRARY gmock )
2018-02-27 18:06:05 +01:00
2021-05-16 21:12:41 +02:00
option ( BUILD_WITH_QT5 "Build with Qt 5" OFF )
option ( BUILD_WITH_QT6 "Build with Qt 6" OFF )
2020-10-01 19:43:39 +02:00
2023-09-16 14:06:09 +02:00
if ( BUILD_WITH_QT6 )
set ( QT_VERSION_MAJOR 6 )
elseif ( BUILD_WITH_QT5 )
set ( QT_VERSION_MAJOR 5 )
2020-10-01 19:43:39 +02:00
endif ( )
2023-09-16 14:06:09 +02:00
if ( NOT QT_VERSION_MAJOR )
message ( STATUS "QT_VERSION_MAJOR, BUILD_WITH_QT5 or BUILD_WITH_QT6 not set, detecting Qt version..." )
find_package ( QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED )
2021-05-16 21:12:41 +02:00
endif ( )
2023-09-16 14:06:09 +02:00
if ( QT_VERSION_MAJOR EQUAL 6 )
set ( QT_MIN_VERSION 6.0 )
elseif ( QT_VERSION_MAJOR EQUAL 5 )
set ( QT_MIN_VERSION 5.12 )
2021-05-16 21:12:41 +02:00
else ( )
2023-09-16 14:06:09 +02:00
message ( FATAL_ERROR "Invalid QT_VERSION_MAJOR." )
2020-12-11 21:01:51 +01:00
endif ( )
2023-09-16 14:06:09 +02:00
set ( QT_DEFAULT_MAJOR_VERSION ${ QT_VERSION_MAJOR } )
2020-10-27 20:54:25 +01:00
2023-09-16 14:06:09 +02:00
set ( QT_COMPONENTS Core Concurrent Gui Widgets Network Sql )
set ( QT_OPTIONAL_COMPONENTS LinguistTools Test )
if ( DBUS_FOUND AND NOT WIN32 )
list ( APPEND QT_COMPONENTS DBus )
endif ( )
if ( X11_FOUND AND QT_VERSION_MAJOR EQUAL 5 )
list ( APPEND QT_COMPONENTS X11Extras )
2021-08-14 16:40:37 +02:00
endif ( )
2023-09-16 14:06:09 +02:00
find_package ( Qt ${ QT_VERSION_MAJOR } ${ QT_MIN_VERSION } COMPONENTS ${ QT_COMPONENTS } REQUIRED OPTIONAL_COMPONENTS ${ QT_OPTIONAL_COMPONENTS } )
2020-10-27 20:54:25 +01:00
2021-05-16 21:12:41 +02:00
if ( Qt ${ QT_VERSION_MAJOR } DBus_FOUND )
get_target_property ( QT_DBUSXML2CPP_EXECUTABLE Qt ${ QT_VERSION_MAJOR } ::qdbusxml2cpp LOCATION )
2020-10-27 20:54:25 +01:00
endif ( )
2021-05-16 21:12:41 +02:00
if ( Qt ${ QT_VERSION_MAJOR } LinguistTools_FOUND )
2023-09-16 14:06:09 +02:00
get_target_property ( QT_LCONVERT_EXECUTABLE Qt ${ QT_VERSION_MAJOR } ::lconvert LOCATION )
endif ( )
if ( Qt ${ QT_VERSION_MAJOR } X11Extras_FOUND )
set ( HAVE_X11EXTRAS ON )
2019-02-22 20:24:38 +01:00
endif ( )
2023-09-16 14:06:09 +02:00
if ( QT_VERSION_MAJOR EQUAL 5 AND Qt5Core_VERSION VERSION_LESS 5.15.0 )
2021-07-30 21:17:50 +02:00
macro ( qt_add_resources )
qt5_add_resources ( ${ ARGN } )
endmacro ( )
macro ( qt_wrap_cpp )
qt5_wrap_cpp ( ${ ARGN } )
endmacro ( )
macro ( qt_wrap_ui )
qt5_wrap_ui ( ${ ARGN } )
endmacro ( )
macro ( qt_add_dbus_adaptor )
qt5_add_dbus_adaptor ( ${ ARGN } )
endmacro ( )
macro ( qt_add_dbus_interface )
qt5_add_dbus_interface ( ${ ARGN } )
endmacro ( )
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 ( )
2021-08-14 20:00:27 +02:00
find_path ( QPA_QPLATFORMNATIVEINTERFACE_H qpa/qplatformnativeinterface.h PATHS ${ Qt${QT_VERSION_MAJOR } Gui_PRIVATE_INCLUDE_DIRS} )
if ( QPA_QPLATFORMNATIVEINTERFACE_H )
set ( HAVE_QPA_QPLATFORMNATIVEINTERFACE_H ON )
message ( STATUS "Have qpa/qplatformnativeinterface.h header." )
else ( )
message ( STATUS "Missing qpa/qplatformnativeinterface.h header." )
2021-04-12 19:40:34 +02:00
endif ( )
2023-04-07 15:53:29 +02:00
# Check for QX11Application (Qt 6 compiled with XCB).
2023-09-16 14:06:09 +02:00
if ( QT_VERSION_MAJOR EQUAL 6 AND Qt6Gui_VERSION VERSION_GREATER_EQUAL 6.2.0 )
2023-04-07 15:53:29 +02:00
set ( CMAKE_REQUIRED_FLAGS "-std=c++17" )
2023-09-16 14:06:09 +02:00
set ( CMAKE_REQUIRED_LIBRARIES Qt ${ QT_VERSION_MAJOR } ::Core Qt ${ QT_VERSION_MAJOR } ::Gui )
2023-04-07 15:53:29 +02:00
check_cxx_source_compiles ( "
#include <QGuiApplication>
i n t main ( ) {
( v o i d ) q A p p - > n a t i v e I n t e r f a c e < Q N a t i v e I n t e r f a c e : : Q X 1 1 A p p l i c a t i o n > ( ) ;
r e t u r n 0 ;
}
"
H A V E _ Q X 1 1 A P P L I C A T I O N
)
unset ( CMAKE_REQUIRED_FLAGS )
unset ( CMAKE_REQUIRED_LIBRARIES )
endif ( )
2021-04-12 19:40:34 +02:00
endif ( X11_FOUND )
2020-11-29 07:41:30 +01:00
2024-01-24 21:30:10 +01:00
option ( USE_TAGLIB "Build with TagLib" ON )
2021-07-02 01:16:14 +02:00
option ( USE_TAGPARSER "Build with TagParser" OFF )
2018-02-27 18:06:05 +01:00
# TAGLIB
2021-07-02 01:16:14 +02:00
if ( USE_TAGLIB )
2024-01-24 21:30:10 +01:00
find_package ( TagLib 2.0 )
if ( TARGET TagLib::TagLib )
set ( TAGLIB_FOUND ON )
set ( TAGLIB_LIBRARIES TagLib::TagLib )
set ( HAVE_TAGLIB_DSFFILE ON )
set ( HAVE_TAGLIB_DSDIFFFILE ON )
else ( )
pkg_check_modules ( TAGLIB REQUIRED taglib>=1.11.1 )
2021-07-02 01:16:14 +02:00
endif ( )
2024-07-01 02:06:39 +02:00
set ( HAVE_TAGLIB ON )
else ( )
set ( HAVE_TAGLIB OFF )
2021-07-02 01:16:14 +02:00
endif ( )
# TAGPARSER
if ( USE_TAGPARSER )
pkg_check_modules ( TAGPARSER REQUIRED tagparser )
2024-07-01 02:06:39 +02:00
set ( HAVE_TAGPARSER ON )
else ( )
set ( HAVE_TAGPARSER OFF )
2021-07-02 01:16:14 +02:00
endif ( )
2023-06-27 03:58:03 +02:00
pkg_check_modules ( LIBEBUR128 IMPORTED_TARGET libebur128 )
2024-07-01 02:06:39 +02:00
if ( NOT HAVE_TAGLIB AND NOT HAVE_TAGPARSER )
2021-07-02 01:16:14 +02:00
message ( FATAL_ERROR "You need either TagLib or TagParser!" )
endif ( )
2018-02-27 18:06:05 +01:00
2019-01-07 01:00:58 +01:00
# SingleApplication
2023-09-27 20:19:43 +02:00
if ( QT_VERSION_MAJOR EQUAL 5 )
2023-10-22 13:53:07 +02:00
set ( KDSINGLEAPPLICATION_NAME "KDSingleApplication" )
2023-09-27 20:19:43 +02:00
else ( )
set ( KDSINGLEAPPLICATION_NAME "KDSingleApplication-qt${QT_VERSION_MAJOR}" )
endif ( )
2023-12-26 20:47:11 +01:00
find_package ( ${ KDSINGLEAPPLICATION_NAME } 1.1.0 )
2023-09-27 20:19:43 +02:00
if ( TARGET KDAB::kdsingleapplication )
2023-10-21 05:43:48 +02:00
if ( QT_VERSION_MAJOR EQUAL 5 )
set ( KDSINGLEAPPLICATION_VERSION "${KDSingleApplication_VERSION}" )
elseif ( QT_VERSION_MAJOR EQUAL 6 )
set ( KDSINGLEAPPLICATION_VERSION "${KDSingleApplication-qt6_VERSION}" )
endif ( )
message ( STATUS "Using system KDSingleApplication (Version ${KDSINGLEAPPLICATION_VERSION})" )
2023-09-27 20:19:43 +02:00
set ( SINGLEAPPLICATION_LIBRARIES KDAB::kdsingleapplication )
else ( )
message ( STATUS "Using 3rdparty KDSingleApplication" )
2023-10-21 05:43:48 +02:00
set ( HAVE_KDSINGLEAPPLICATION_OPTIONS ON )
2023-09-27 20:19:43 +02:00
add_subdirectory ( 3rdparty/kdsingleapplication )
2023-10-21 05:43:48 +02:00
set ( SINGLEAPPLICATION_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/kdsingleapplication/KDSingleApplication/src )
2023-09-27 20:19:43 +02:00
set ( SINGLEAPPLICATION_LIBRARIES kdsingleapplication )
add_definitions ( -DKDSINGLEAPPLICATION_STATIC_BUILD )
endif ( )
2018-05-15 00:25:30 +02:00
2020-08-01 03:37:16 +02:00
if ( APPLE )
2021-01-06 14:46:21 +01:00
add_subdirectory ( 3rdparty/SPMediaKeyTap )
set ( SPMEDIAKEYTAP_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/SPMediaKeyTap )
set ( SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap )
2021-08-19 19:17:06 +02:00
add_subdirectory ( ext/macdeploycheck )
2021-08-07 03:02:27 +02:00
endif ( )
2020-08-01 03:37:16 +02:00
2022-01-28 20:24:13 +01:00
if ( WIN32 )
2023-09-16 14:06:09 +02:00
pkg_check_modules ( QTSPARKLE qtsparkle-qt ${ QT_VERSION_MAJOR } )
2020-08-01 03:37:16 +02:00
if ( QTSPARKLE_FOUND )
set ( HAVE_QTSPARKLE ON )
endif ( )
endif ( )
2018-02-27 18:06:05 +01:00
2023-04-30 02:06:27 +02:00
if ( WIN32 )
2022-02-06 16:55:11 +01:00
add_subdirectory ( 3rdparty/getopt )
set ( GETOPT_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/getopt )
set ( GETOPT_LIBRARIES getopt )
2023-04-30 02:06:27 +02:00
add_definitions ( -DSTATIC_GETOPT -D_UNICODE )
2022-02-06 16:55:11 +01:00
endif ( )
2021-08-24 17:52:08 +02:00
if ( WIN32 AND NOT MSVC )
2018-02-27 18:06:05 +01:00
# 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" )
2021-08-07 03:02:27 +02:00
endif ( )
2018-02-27 18:06:05 +01:00
if ( WIN32 )
2018-05-02 00:18:54 +02:00
option ( ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF )
2021-08-07 03:02:27 +02:00
endif ( )
2018-02-27 18:06:05 +01:00
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
)
2021-05-29 21:52:52 +02:00
optional_component ( LIBPULSE ON "PulseAudio integration"
2018-11-17 16:28:05 +01:00
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
2023-09-16 14:06:09 +02:00
D E P E N D S " Q t D - B u s " Q t $ { Q T _ V E R S I O N _ M A J O R } D B u s _ F O U N D
2018-05-15 00:25:30 +02:00
)
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
)
2021-04-25 21:16:44 +02:00
optional_component ( SONGFINGERPRINTING ON "Song fingerprinting and tracking"
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
2023-03-19 05:01:17 +01:00
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
2021-04-25 21:16:44 +02:00
)
2021-05-10 21:17:50 +02:00
optional_component ( MUSICBRAINZ ON "MusicBrainz integration"
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
2023-03-19 05:01:17 +01:00
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
2018-07-16 07:23:37 +02:00
)
2023-09-16 14:06:09 +02:00
if ( X11_FOUND OR ( HAVE_DBUS AND Qt ${ QT_VERSION_MAJOR } DBus_FOUND ) OR APPLE OR WIN32 )
2019-01-01 20:07:29 +01:00
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
)
2023-04-07 15:53:29 +02:00
if ( HAVE_QX11APPLICATION OR HAVE_X11EXTRAS OR HAVE_QPA_QPLATFORMNATIVEINTERFACE_H )
set ( X11_GLOBALSHORTCUTS_REQUIREMENT_FOUND ON )
2021-08-14 16:40:37 +02:00
endif ( )
2023-04-07 15:53:29 +02:00
optional_component ( X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
D E P E N D S " X 1 1 " X 1 1 _ F O U N D
D E P E N D S " Q X 1 1 A p p l i c a t i o n , X 1 1 E x t r a s o r q p a / q p l a t f o r m n a t i v e i n t e r f a c e . h h e a d e r " X 1 1 _ G L O B A L S H O R T C U T S _ R E Q U I R E M E N T _ F O U N D
)
2020-11-29 07:41:30 +01:00
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
2023-03-19 05:01:17 +01:00
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
2018-02-27 18:06:05 +01:00
)
2018-07-16 07:23:37 +02:00
optional_component ( UDISKS2 ON "Devices: UDisks2 backend"
2023-09-16 14:06:09 +02:00
D E P E N D S " D - B u s " D B U S _ F O U N D
D E P E N D S " Q t D - B u s " Q t $ { Q T _ V E R S I O N _ M A J O R } 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
)
2022-01-09 20:35:46 +01:00
optional_component ( GIO_UNIX ON "Devices: GIO device backend (Unix support)"
D E P E N D S " l i b g i o - u n i x " G I O _ U N I X _ F O U N D
2023-08-13 12:26:13 +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 "
2022-01-09 20:35:46 +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
)
2023-09-16 14:06:09 +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 L i n g u i s t T o o l s " Q t $ { Q T _ V E R S I O N _ M A J O R } L i n g u i s t T o o l s _ F O U N D
)
2019-02-22 20:24:38 +01:00
2020-08-13 19:53:36 +02:00
option ( INSTALL_TRANSLATIONS "Install translations" OFF )
2022-06-04 16:15:33 +02:00
optional_component ( SUBSONIC ON "Streaming: Subsonic" )
optional_component ( TIDAL ON "Streaming: Tidal" )
2022-06-04 15:51:35 +02:00
optional_component ( SPOTIFY ON "Streaming: Spotify" DEPENDS "gstreamer" GSTREAMER_FOUND )
2022-06-04 16:15:33 +02:00
optional_component ( QOBUZ ON "Streaming: Qobuz" )
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
)
2023-06-27 03:58:40 +02:00
optional_component ( EBUR128 ON "EBU R 128 loudness normalization"
D E P E N D S " l i b e b u r 1 2 8 " L I B E B U R 1 2 8 _ 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
)
2021-07-20 20:33:01 +02:00
if ( APPLE OR WIN32 )
2023-10-14 03:30:09 +02:00
set ( USE_BUNDLE_DEFAULT ON )
2021-07-20 20:33:01 +02:00
else ( )
2023-10-14 03:30:09 +02:00
set ( USE_BUNDLE_DEFAULT OFF )
2021-08-07 03:02:27 +02:00
endif ( )
2023-10-14 22:09:14 +02:00
option ( USE_BUNDLE "Bundle dependencies" ${ USE_BUNDLE_DEFAULT } )
2019-01-03 21:19:07 +01:00
2019-07-31 23:06:59 +02:00
if ( NOT CMAKE_CROSSCOMPILING )
2021-05-13 00:18:06 +02:00
# Check that we have Qt with sqlite driver
2020-12-17 19:47:46 +01:00
set ( CMAKE_REQUIRED_FLAGS "-std=c++17" )
2023-09-16 14:06:09 +02:00
set ( CMAKE_REQUIRED_LIBRARIES Qt ${ QT_VERSION_MAJOR } ::Core Qt ${ QT_VERSION_MAJOR } ::Sql )
2019-07-31 23:06:59 +02:00
check_cxx_source_runs ( "
2024-06-27 18:15:53 +02:00
#include <QCoreApplication>
2019-07-31 23:06:59 +02:00
#include <QSqlDatabase>
#include <QSqlQuery>
2024-06-27 18:15:53 +02:00
i n t main ( int argc, char *argv[] ) {
Q C o r e A p p l i c a t i o n app ( argc, argv ) ;
2019-07-31 23:06:59 +02:00
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 ) ;
2021-05-13 00:18:06 +02:00
q . prepare ( \"CREATE TABLE test ( test TEXT ) ;\ " ) ;
2019-07-31 23:06:59 +02:00
if ( !q.exec( ) ) r e t u r n 1 ;
}
"
2021-05-13 00:18:06 +02:00
Q T _ S Q L I T E _ T E S T
2019-07-31 23:06:59 +02:00
)
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
2022-05-17 23:40:28 +02:00
add_definitions (
- D B O O S T _ B I N D _ N O _ P L A C E H O L D E R S
- D Q T _ S T R I C T _ I T E R A T O R S
2022-09-12 23:20:07 +02:00
- D Q T _ N O _ C A S T _ F R O M _ B Y T E A R R A Y
2022-05-17 23:40:28 +02:00
- D Q T _ U S E _ Q S T R I N G B U I L D E R
- D Q T _ N O _ U R L _ C A S T _ F R O M _ S T R I N G
- D Q T _ N O _ C A S T _ T O _ A S C I I
2022-09-12 23:20:07 +02:00
- D Q T _ N O _ N A R R O W I N G _ C O N V E R S I O N S _ I N _ C O N N E C T
- D Q T _ N O _ F O R E A C H
2024-04-11 02:56:01 +02:00
- D Q T _ A S C I I _ C A S T _ W A R N I N G S
- D Q T _ N O _ C A S T _ F R O M _ A S C I I
2024-08-12 01:09:01 +02:00
- D Q T _ N O _ S I G N A L S _ S L O T S _ K E Y W O R D S
2022-05-17 23:40:28 +02:00
)
2018-03-18 18:39:30 +01:00
2021-05-12 20:08:06 +02:00
if ( WIN32 )
2021-05-11 20:32:28 +02:00
add_definitions ( -DUNICODE )
2021-08-24 17:52:08 +02:00
if ( MSVC )
add_definitions ( -DPROTOBUF_USE_DLLS )
endif ( )
2021-05-11 20:32:28 +02:00
endif ( )
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
2023-09-16 14:06:09 +02:00
if ( GTest_FOUND AND GMOCK_LIBRARY AND Qt ${ QT_VERSION_MAJOR } Test_FOUND )
2020-06-26 23:30:30 +02:00
add_subdirectory ( tests )
2021-03-13 15:18:38 +01:00
endif ( )
2020-06-26 23:30:30 +02:00
2022-05-06 18:26:46 +02:00
if ( LINUX AND LSB_RELEASE_EXEC AND DPKG_BUILDPACKAGE )
add_subdirectory ( debian )
endif ( )
2018-02-27 18:06:05 +01:00
# Uninstall support
2021-07-21 17:45:22 +02:00
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY )
2018-02-27 18:06:05 +01:00
2021-07-21 17:45:22 +02:00
add_custom_target ( uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
2018-02-27 18:06:05 +01:00
# 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 )
2022-04-25 19:24:58 +02:00
message ( FATAL_ERROR "You need to have either GStreamer or libvlc 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
2022-01-02 14:48:45 +01:00
if ( QT_VERSION_MAJOR EQUAL 5 )
message ( WARNING "It is detected that Strawberry is being built with Qt 5. There are no bugfix releases for the latest minor LTS version of Qt 5 available to open-source users, only commercial users. Therefore Strawberry should be built with Qt 6 when possible. Building with Qt 6 will also take advantage of improvements and new features not available in Qt 5. To build with Qt 6 specify -DBUILD_WITH_QT6=ON to automatically detect Qt 6, or for example -DCMAKE_PREFIX_PATH=/usr/local/lib64/cmake to manually specify the Qt 6 directory." )
endif ( )
2021-05-13 00:18:06 +02:00
if ( NOT CMAKE_CROSSCOMPILING )
2021-06-27 22:54:08 +02:00
if ( NOT QT_SQLITE_TEST )
2021-05-13 00:18:06 +02:00
message ( WARNING "The Qt sqlite driver test failed." )
endif ( )
2019-07-31 20:05:38 +02:00
endif ( )
2020-07-07 23:44:04 +02:00
2024-07-01 02:06:39 +02:00
if ( HAVE_TAGLIB AND TAGLIB_FOUND AND NOT TAGLIB_VERSION VERSION_GREATER_EQUAL 1.12 )
2021-02-26 22:36:26 +01:00
message ( WARNING "There is a critical bug in TagLib (1.11.1) that can result in corrupt Ogg files, see: https://github.com/taglib/taglib/issues/864, please consider updating TagLib to the newest version." )
2020-07-07 23:44:04 +02:00
endif ( )