mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-01 18:16:45 +01:00
Make optional feature required unless disabled, add QtSparkle for macOS
This commit is contained in:
parent
f8ea9631ca
commit
f66459f3cb
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
@ -711,7 +711,7 @@ jobs:
|
||||
export LDFLAGS="-L/usr/local/lib"
|
||||
git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
cmake -E make_directory build
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE="Debug"
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE="Debug" -DENABLE_ALSA=OFF
|
||||
cmake --build build --config Debug --parallel 4
|
||||
|
||||
|
||||
@ -801,11 +801,12 @@ jobs:
|
||||
-DCMAKE_PREFIX_PATH="${{env.prefix_path}}/lib/cmake"
|
||||
-DBUILD_WERROR=ON
|
||||
-DUSE_BUNDLE=ON
|
||||
-DENABLE_DBUS=OFF
|
||||
-DICU_ROOT="${{env.prefix_path}}"
|
||||
-DAPPLE_DEVELOPER_ID=$(test '${{github.repository}}' = 'strawberrymusicplayer/strawberry' && test '${{github.event.pull_request.base.repo.full_name}}' = '${{github.event.pull_request.head.repo.full_name}}' && echo "383J84DVB6" || echo "")
|
||||
-DENABLE_SPOTIFY=$(test -f "${{env.prefix_path}}/lib/gstreamer-1.0/libgstspotify.dylib" && echo "ON" || echo "OFF")
|
||||
-DARCH="${{env.arch}}"
|
||||
-DENABLE_SPOTIFY=$(test -f "${{env.prefix_path}}/lib/gstreamer-1.0/libgstspotify.dylib" && echo "ON" || echo "OFF")
|
||||
-DENABLE_SPARKLE=ON
|
||||
-DENABLE_QTSPARKLE=OFF
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config Release --parallel 4
|
||||
@ -941,11 +942,12 @@ jobs:
|
||||
-DCMAKE_PREFIX_PATH="${{env.prefix_path}}/lib/cmake"
|
||||
-DBUILD_WERROR=ON
|
||||
-DUSE_BUNDLE=ON
|
||||
-DENABLE_DBUS=OFF
|
||||
-DICU_ROOT="${{env.prefix_path}}"
|
||||
-DAPPLE_DEVELOPER_ID="383J84DVB6"
|
||||
-DENABLE_SPOTIFY=$(test -f "${{env.prefix_path}}/lib/gstreamer-1.0/libgstspotify.dylib" && echo "ON" || echo "OFF")
|
||||
-DARCH="${{env.arch}}"
|
||||
-DENABLE_SPOTIFY=$(test -f "${{env.prefix_path}}/lib/gstreamer-1.0/libgstspotify.dylib" && echo "ON" || echo "OFF")
|
||||
-DENABLE_SPARKLE=ON
|
||||
-DENABLE_QTSPARKLE=OFF
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config Release --parallel 4
|
||||
@ -1040,7 +1042,6 @@ jobs:
|
||||
-DBUILD_WERROR=ON
|
||||
-DARCH="${{matrix.arch}}"
|
||||
-DENABLE_WIN32_CONSOLE=$(test "${{matrix.buildtype}}" = "debug" && echo "ON" || echo "OFF")
|
||||
-DENABLE_DBUS=OFF
|
||||
-DENABLE_AUDIOCD=OFF
|
||||
-DENABLE_MTP=OFF
|
||||
-DENABLE_GPOD=OFF
|
||||
@ -1328,6 +1329,9 @@ jobs:
|
||||
-DENABLE_WIN32_CONSOLE=${{env.win32_console}}
|
||||
-DPKG_CONFIG_EXECUTABLE="${{env.prefix_path_forwardslash}}/bin/pkg-config.exe"
|
||||
-DICU_ROOT="${{env.prefix_path_forwardslash}}"
|
||||
-DENABLE_AUDIOCD=OFF
|
||||
-DENABLE_MTP=OFF
|
||||
-DENABLE_GPOD=OFF
|
||||
-DENABLE_SPOTIFY=ON
|
||||
|
||||
- name: Run Make
|
||||
|
111
CMakeLists.txt
111
CMakeLists.txt
@ -18,7 +18,7 @@ include(CheckCXXSourceRuns)
|
||||
include(CheckIncludeFiles)
|
||||
include(FindPkgConfig)
|
||||
include(cmake/Version.cmake)
|
||||
include(cmake/Summary.cmake)
|
||||
include(cmake/OptionalComponent.cmake)
|
||||
include(cmake/OptionalSource.cmake)
|
||||
include(cmake/ParseArguments.cmake)
|
||||
|
||||
@ -67,7 +67,6 @@ option(USE_BUNDLE "Bundle dependencies" ${USE_BUNDLE_DEFAULT})
|
||||
|
||||
if(WIN32)
|
||||
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" ${ENABLE_WIN32_CONSOLE_DEFAULT})
|
||||
option(USE_QTSPARKLE "Use Qt Sparkle updater" ON)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@ -162,17 +161,17 @@ if(NOT Boost_FOUND)
|
||||
find_package(Boost REQUIRED)
|
||||
endif()
|
||||
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
||||
if(LINUX)
|
||||
find_package(ALSA REQUIRED)
|
||||
else()
|
||||
find_package(ALSA)
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(LINUX)
|
||||
find_package(ALSA REQUIRED)
|
||||
else()
|
||||
find_package(ALSA)
|
||||
endif()
|
||||
find_package(X11 COMPONENTS X11_xcb)
|
||||
endif()
|
||||
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
|
||||
pkg_check_modules(GOBJECT REQUIRED IMPORTED_TARGET gobject-2.0)
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(NOT APPLE)
|
||||
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
|
||||
if(GIO_FOUND AND UNIX)
|
||||
pkg_check_modules(GIO_UNIX IMPORTED_TARGET gio-unix-2.0)
|
||||
@ -186,7 +185,9 @@ pkg_check_modules(GSTREAMER_APP REQUIRED IMPORTED_TARGET gstreamer-app-1.0)
|
||||
pkg_check_modules(GSTREAMER_TAG REQUIRED IMPORTED_TARGET gstreamer-tag-1.0)
|
||||
pkg_check_modules(GSTREAMER_PBUTILS REQUIRED IMPORTED_TARGET gstreamer-pbutils-1.0)
|
||||
pkg_check_modules(SQLITE REQUIRED IMPORTED_TARGET sqlite3>=3.9)
|
||||
pkg_check_modules(LIBPULSE IMPORTED_TARGET libpulse)
|
||||
if(UNIX AND NOT APPLE)
|
||||
pkg_check_modules(LIBPULSE IMPORTED_TARGET libpulse)
|
||||
endif()
|
||||
pkg_check_modules(CHROMAPRINT IMPORTED_TARGET libchromaprint>=1.4)
|
||||
pkg_check_modules(FFTW3 IMPORTED_TARGET fftw3)
|
||||
pkg_check_modules(LIBEBUR128 IMPORTED_TARGET libebur128)
|
||||
@ -273,27 +274,29 @@ endif()
|
||||
|
||||
if(WIN32)
|
||||
find_package(getopt-win REQUIRED)
|
||||
if(USE_QTSPARKLE)
|
||||
find_package(qtsparkle-qt${QT_VERSION_MAJOR} REQUIRED)
|
||||
set(HAVE_QTSPARKLE ON)
|
||||
endif()
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
find_package(qtsparkle-qt${QT_VERSION_MAJOR})
|
||||
if(TARGET "qtsparkle-qt${QT_VERSION_MAJOR}::qtsparkle")
|
||||
set(QTSPARKLE_FOUND ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
optional_component(ALSA ON "ALSA integration"
|
||||
DEPENDS "alsa" ALSA_FOUND
|
||||
)
|
||||
|
||||
optional_component(PULSE ON "PulseAudio integration"
|
||||
DEPENDS "libpulse" LIBPULSE_FOUND
|
||||
)
|
||||
|
||||
optional_component(DBUS ON "D-Bus support"
|
||||
DEPENDS "Qt D-Bus" DBUS_FOUND
|
||||
)
|
||||
|
||||
optional_component(MPRIS2 ON "MPRIS2 D-Bus Interface"
|
||||
DEPENDS "D-Bus support" HAVE_DBUS
|
||||
)
|
||||
if(UNIX AND NOT APPLE)
|
||||
optional_component(ALSA ON "ALSA integration"
|
||||
DEPENDS "alsa" ALSA_FOUND
|
||||
)
|
||||
optional_component(PULSE ON "PulseAudio integration"
|
||||
DEPENDS "libpulse" LIBPULSE_FOUND
|
||||
)
|
||||
optional_component(DBUS ON "D-Bus support"
|
||||
DEPENDS "Qt D-Bus" DBUS_FOUND
|
||||
)
|
||||
optional_component(MPRIS2 ON "MPRIS2 D-Bus Interface"
|
||||
DEPENDS "D-Bus support" HAVE_DBUS
|
||||
)
|
||||
endif()
|
||||
|
||||
optional_component(SONGFINGERPRINTING ON "Song fingerprinting and tracking"
|
||||
DEPENDS "chromaprint" CHROMAPRINT_FOUND
|
||||
@ -303,26 +306,29 @@ optional_component(MUSICBRAINZ ON "MusicBrainz integration"
|
||||
DEPENDS "chromaprint" CHROMAPRINT_FOUND
|
||||
)
|
||||
|
||||
optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
|
||||
DEPENDS "X11" X11_FOUND
|
||||
DEPENDS "QX11Application" HAVE_QX11APPLICATION
|
||||
)
|
||||
if(UNIX AND NOT APPLE)
|
||||
optional_component(X11_GLOBALSHORTCUTS ON "X11 global shortcuts"
|
||||
DEPENDS "X11" X11_FOUND
|
||||
DEPENDS "QX11Application" HAVE_QX11APPLICATION
|
||||
)
|
||||
optional_component(KGLOBALACCEL_GLOBALSHORTCUTS ON "KGlobalAccel global shortcuts"
|
||||
DEPENDS "D-Bus support" HAVE_DBUS
|
||||
)
|
||||
optional_component(UDISKS2 ON "Devices: UDisks2 backend"
|
||||
DEPENDS "D-Bus support" HAVE_DBUS
|
||||
)
|
||||
endif()
|
||||
|
||||
optional_component(KGLOBALACCEL_GLOBALSHORTCUTS ON "KGlobalAccel global shortcuts"
|
||||
DEPENDS "D-Bus support" HAVE_DBUS
|
||||
)
|
||||
|
||||
optional_component(UDISKS2 ON "Devices: UDisks2 backend"
|
||||
DEPENDS "D-Bus support" HAVE_DBUS
|
||||
)
|
||||
|
||||
optional_component(GIO ON "Devices: GIO device backend"
|
||||
DEPENDS "libgio" GIO_FOUND
|
||||
)
|
||||
|
||||
optional_component(GIO_UNIX ON "Devices: GIO device backend (Unix support)"
|
||||
DEPENDS "libgio-unix" GIO_UNIX_FOUND
|
||||
)
|
||||
if(NOT APPLE)
|
||||
optional_component(GIO ON "Devices: GIO device backend"
|
||||
DEPENDS "libgio" GIO_FOUND
|
||||
)
|
||||
if(UNIX)
|
||||
optional_component(GIO_UNIX ON "Devices: GIO device backend (Unix support)"
|
||||
DEPENDS "libgio-unix" GIO_UNIX_FOUND
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
optional_component(AUDIOCD ON "Devices: Audio CD support"
|
||||
DEPENDS "libcdio" LIBCDIO_FOUND
|
||||
@ -356,11 +362,16 @@ optional_component(EBUR128 ON "EBU R 128 loudness normalization"
|
||||
|
||||
if(APPLE)
|
||||
optional_component(SPARKLE ON "Sparkle integration"
|
||||
DEPENDS "macOS" APPLE
|
||||
DEPENDS "Sparkle" SPARKLE
|
||||
)
|
||||
endif()
|
||||
|
||||
if(APPLE OR WIN32)
|
||||
optional_component(QTSPARKLE ON "QtSparkle integration"
|
||||
DEPENDS "QtSparkle" QTSPARKLE_FOUND
|
||||
)
|
||||
endif()
|
||||
|
||||
if(HAVE_SONGFINGERPRINTING OR HAVE_MUSICBRAINZ)
|
||||
set(HAVE_CHROMAPRINT ON)
|
||||
endif()
|
||||
@ -1311,9 +1322,7 @@ optional_source(HAVE_MOODBAR
|
||||
src/settings/moodbarsettingspage.ui
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
optional_source(HAVE_GIO SOURCES src/device/giolister.cpp HEADERS src/device/giolister.h)
|
||||
endif()
|
||||
optional_source(HAVE_GIO SOURCES src/device/giolister.cpp HEADERS src/device/giolister.h)
|
||||
|
||||
if(HAVE_UDISKS2)
|
||||
optional_source(HAVE_UDISKS2 SOURCES src/device/udisks2lister.cpp HEADERS src/device/udisks2lister.h)
|
||||
@ -1562,7 +1571,7 @@ endif()
|
||||
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")
|
||||
|
||||
summary_show()
|
||||
optional_component_summary_show()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING AND NOT QT_SQLITE_TEST)
|
||||
message(WARNING "The Qt sqlite driver test failed.")
|
||||
|
@ -1,15 +1,15 @@
|
||||
set(summary_willbuild "")
|
||||
set(summary_willnotbuild "")
|
||||
|
||||
macro(summary_add name test)
|
||||
macro(optional_component_summary_add name test)
|
||||
if (${test})
|
||||
list(APPEND summary_willbuild ${name})
|
||||
else (${test})
|
||||
list(APPEND summary_willnotbuild "${name}")
|
||||
endif (${test})
|
||||
endmacro(summary_add)
|
||||
endmacro(optional_component_summary_add)
|
||||
|
||||
macro(summary_show_part variable title)
|
||||
macro(optional_component_summary_show_part variable title)
|
||||
list(LENGTH ${variable} _len)
|
||||
if (_len)
|
||||
message("")
|
||||
@ -18,19 +18,20 @@ macro(summary_show_part variable title)
|
||||
message(" ${_item}")
|
||||
endforeach (_item)
|
||||
endif (_len)
|
||||
endmacro(summary_show_part)
|
||||
endmacro(optional_component_summary_show_part)
|
||||
|
||||
macro(summary_show)
|
||||
macro(optional_component_summary_show)
|
||||
list(SORT summary_willbuild)
|
||||
list(SORT summary_willnotbuild)
|
||||
message("")
|
||||
message("Building strawberry version: ${STRAWBERRY_VERSION_DISPLAY}, Qt version ${Qt${QT_VERSION_MAJOR}Core_VERSION}")
|
||||
summary_show_part(summary_willbuild "The following components will be built:")
|
||||
summary_show_part(summary_willnotbuild "The following components WILL NOT be built:")
|
||||
optional_component_summary_show_part(summary_willbuild "The following components will be built:")
|
||||
optional_component_summary_show_part(summary_willnotbuild "The following components WILL NOT be built:")
|
||||
message("")
|
||||
endmacro(summary_show)
|
||||
endmacro(optional_component_summary_show)
|
||||
|
||||
function(optional_component name default description)
|
||||
|
||||
set(option_variable "ENABLE_${name}")
|
||||
set(have_variable "HAVE_${name}")
|
||||
set(${have_variable} OFF)
|
||||
@ -79,6 +80,9 @@ function(optional_component name default description)
|
||||
set(text "${description} (missing ${deplist_text})")
|
||||
|
||||
set(summary_willnotbuild "${summary_willnotbuild};${text}" PARENT_SCOPE)
|
||||
|
||||
message(FATAL_ERROR "${text}, to disable this optional feature, pass -D${option_variable}=OFF to CMake")
|
||||
|
||||
else()
|
||||
set(${have_variable} ON PARENT_SCOPE)
|
||||
set(summary_willbuild "${summary_willbuild};${description}" PARENT_SCOPE)
|
@ -239,20 +239,41 @@ const int kTrackPositionUpdateTimeMs = 1000;
|
||||
} // namespace
|
||||
|
||||
#ifdef HAVE_QTSPARKLE
|
||||
# ifdef _MSC_VER
|
||||
# ifdef _M_X64
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-msvc-x64";
|
||||
namespace {
|
||||
|
||||
# if defined(__APPLE__)
|
||||
# if defined(__x86_64__)
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-macos-x86_64";
|
||||
# elif defined(__aarch64__)
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-macos-arm64";
|
||||
# else
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-msvc-x86";
|
||||
# error "Unsupported macOS arch for QtSparkle"
|
||||
# endif
|
||||
# else
|
||||
# ifdef __x86_64__
|
||||
|
||||
# elif defined(__MINGW32__)
|
||||
# if defined(__x86_64__)
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-mingw-x64";
|
||||
# else
|
||||
# elif defined(__i686__)
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-mingw-x86";
|
||||
# else
|
||||
# error "Unsupported MinGW arch for QtSparkle"
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
# elif defined(_MSC_VER)
|
||||
# if defined(_WIN64)
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-msvc-x64";
|
||||
# elif defined(_WIN32)
|
||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-msvc-x86";
|
||||
# else
|
||||
# error "Unsupported MSVC arch for QtSparkle"
|
||||
# endif
|
||||
|
||||
# else
|
||||
# error "Unsupported OS for QtSparkle"
|
||||
# endif // OS
|
||||
|
||||
} // namespace
|
||||
#endif // HAVE_QTSPARKLE
|
||||
|
||||
MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OSDBase *osd, const CommandlineOptions &options, QWidget *parent)
|
||||
: QMainWindow(parent),
|
||||
|
Loading…
x
Reference in New Issue
Block a user