1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-22 07:54:18 +01:00

Show which packages are required to satisfy failed dependencies when running CMake.

This commit is contained in:
David Sansome 2012-08-28 19:19:29 +01:00
parent 369ff5c5e0
commit b63d1cf9f1
2 changed files with 136 additions and 102 deletions

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0011 OLD)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
include(FindPkgConfig) include(FindPkgConfig)
@ -15,20 +16,6 @@ if (UNIX AND NOT APPLE)
endif (UNIX AND NOT APPLE) endif (UNIX AND NOT APPLE)
find_package(Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml) find_package(Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml)
if (LINUX)
option(ENABLE_DBUS "Enable D-Bus, MPRIS and native notifications. Required for DeviceKit and Wii remote support" ON)
if(ENABLE_DBUS)
find_package(Qt4 REQUIRED QtDbus)
set(HAVE_DBUS ON)
option(ENABLE_DEVICEKIT "DeviceKit backend" ON)
if(ENABLE_DEVICEKIT)
set(HAVE_DEVICEKIT ON)
endif(ENABLE_DEVICEKIT)
option(ENABLE_WIIMOTEDEV "Enable Wii remote support in Clementine" ON)
endif(ENABLE_DBUS)
endif (LINUX)
if(NOT APPLE) if(NOT APPLE)
find_package(Qt4 COMPONENTS QtWebKit) find_package(Qt4 COMPONENTS QtWebKit)
@ -92,12 +79,7 @@ endif()
if (APPLE) if (APPLE)
find_library(GROWL Growl) find_library(GROWL Growl)
option(ENABLE_SPARKLE "Sparkle updating" ON)
find_library(SPARKLE Sparkle) find_library(SPARKLE Sparkle)
if (ENABLE_SPARKLE AND SPARKLE)
set(HAVE_SPARKLE ON)
endif (ENABLE_SPARKLE AND SPARKLE)
find_library(SPOTIFY libspotify) find_library(SPOTIFY libspotify)
if (SPOTIFY) if (SPOTIFY)
@ -151,7 +133,6 @@ if (NOT QT_QTWEBKIT_INCLUDE_DIR)
set (QT_USE_QTWEBKIT 0) set (QT_USE_QTWEBKIT 0)
endif (NOT QT_QTWEBKIT_INCLUDE_DIR) endif (NOT QT_QTWEBKIT_INCLUDE_DIR)
include(${QT_USE_FILE})
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
include_directories(${TAGLIB_INCLUDE_DIRS}) include_directories(${TAGLIB_INCLUDE_DIRS})
include_directories(${QJSON_INCLUDE_DIRS}) include_directories(${QJSON_INCLUDE_DIRS})
@ -161,10 +142,6 @@ include_directories(${GLIBCONFIG_INCLUDE_DIRS})
include_directories(${LIBXML_INCLUDE_DIRS}) include_directories(${LIBXML_INCLUDE_DIRS})
include_directories("3rdparty/universalchardet") include_directories("3rdparty/universalchardet")
# Remove GLU and GL from the link line - they're not really required
# and don't exist on my mingw toolchain
list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL")
if (WIN32) if (WIN32)
# RC compiler # RC compiler
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER}) string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
@ -189,21 +166,6 @@ if(NOT GETTEXT_MSGFMT_EXECUTABLE)
endif(NOT GETTEXT_MSGFMT_EXECUTABLE) endif(NOT GETTEXT_MSGFMT_EXECUTABLE)
# Optional bits # Optional bits
option(ENABLE_LIBGPOD "iPod classic support" ON)
option(ENABLE_IMOBILEDEVICE "iPod Touch, iPhone, iPad support" ON)
option(ENABLE_LIBMTP "MTP support" ON)
option(ENABLE_GIO "GIO backend" ON)
option(ENABLE_AUDIOCD "Audio CD support" ON)
option(ENABLE_VISUALISATIONS "Use libprojectm visualisations" ON)
option(BUNDLE_PROJECTM_PRESETS "Install Clementine's own copies of libprojectm presets - disable this if you want to use a system package instead" ON)
option(ENABLE_SOUNDMENU "Add Clementine to the Gnome sound menu" ON)
option(ENABLE_LIBLASTFM "Use liblastfm for fetching song info, scrobbling and radio streams" ON)
option(ENABLE_BREAKPAD "Enable crash reporting" OFF)
option(ENABLE_SPOTIFY_BLOB "Build the spotify non-GPL binary" ON)
option(ENABLE_SPOTIFY "Enable spotify support" ON)
option(ENABLE_MOODBAR "Enable moodbar" ON)
option(ENABLE_GOOGLE_DRIVE "Enable Google Drive support" ON)
if(WIN32) if(WIN32)
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF) option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF)
if(SAC_SHIM_LIBRARIES) if(SAC_SHIM_LIBRARIES)
@ -211,68 +173,97 @@ if(WIN32)
endif(SAC_SHIM_LIBRARIES) endif(SAC_SHIM_LIBRARIES)
endif(WIN32) endif(WIN32)
if(ENABLE_LIBGPOD AND LIBGPOD_FOUND) optional_component(BREAKPAD OFF "Crash reporting")
set(HAVE_LIBGPOD ON)
endif(ENABLE_LIBGPOD AND LIBGPOD_FOUND)
if(ENABLE_GIO AND GIO_FOUND AND NOT APPLE) optional_component(GOOGLE_DRIVE ON "Google Drive support"
set(HAVE_GIO ON) DEPENDS "Google sparsehash" SPARSEHASH_INCLUDE_DIRS
endif(ENABLE_GIO AND GIO_FOUND AND NOT APPLE) DEPENDS "Taglib 1.8 beta" "TAGLIB_VERSION VERSION_GREATER 1.7.999"
)
if(ENABLE_AUDIOCD AND CDIO_FOUND) optional_component(AUDIOCD ON "Devices: Audio CD support"
set(HAVE_AUDIOCD ON) DEPENDS "libcdio" CDIO_FOUND
endif(ENABLE_AUDIOCD AND CDIO_FOUND) )
if(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_FOUND AND PLIST_FOUND AND HAVE_LIBGPOD AND USBMUXD_FOUND) optional_component(LIBGPOD ON "Devices: iPod classic support"
set(HAVE_IMOBILEDEVICE ON) DEPENDS "libgpod" LIBGPOD_FOUND
endif(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_FOUND AND PLIST_FOUND AND HAVE_LIBGPOD AND USBMUXD_FOUND) )
if(ENABLE_LIBMTP AND LIBMTP_FOUND) optional_component(GIO ON "Devices: GIO device backend"
set(HAVE_LIBMTP ON) DEPENDS "libgio" GIO_FOUND
endif(ENABLE_LIBMTP AND LIBMTP_FOUND) DEPENDS "Linux or Windows" "NOT APPLE"
)
if(ENABLE_SOUNDMENU AND INDICATEQT_FOUND) optional_component(IMOBILEDEVICE ON "Devices: iPod Touch, iPhone, iPad support"
set(HAVE_LIBINDICATE ON) DEPENDS "libimobiledevice" IMOBILEDEVICE_FOUND
endif(ENABLE_SOUNDMENU AND INDICATEQT_FOUND) DEPENDS "libplist" PLIST_FOUND
DEPENDS "libusbmuxd" USBMUXD_FOUND
DEPENDS "iPod classic support" HAVE_LIBGPOD
)
if(ENABLE_LIBLASTFM AND LASTFM_LIBRARIES AND LASTFM_INCLUDE_DIRS) optional_component(LIBMTP ON "Devices: MTP support"
set(HAVE_LIBLASTFM ON) DEPENDS "libmtp" LIBMTP_FOUND
endif(ENABLE_LIBLASTFM AND LASTFM_LIBRARIES AND LASTFM_INCLUDE_DIRS) )
if(ENABLE_WIIMOTEDEV AND HAVE_DBUS) optional_component(SOUNDMENU ON "Gnome sound menu integration"
set(HAVE_WIIMOTEDEV ON) DEPENDS "indicate-qt" INDICATEQT_FOUND
endif(ENABLE_WIIMOTEDEV AND HAVE_DBUS) )
if(ENABLE_BREAKPAD) optional_component(LIBLASTFM ON "Last.fm support"
set(HAVE_BREAKPAD ON) DEPENDS "liblastfm" LASTFM_LIBRARIES LASTFM_INCLUDE_DIRS
endif(ENABLE_BREAKPAD) )
if(ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE) optional_component(DBUS ON "D-Bus support"
set(HAVE_SPOTIFY ON) DEPENDS "Linux" LINUX
endif(ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE) )
if(ENABLE_SPOTIFY_BLOB AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND SPOTIFY_FOUND) optional_component(WIIMOTEDEV ON "Wiimote support"
set(HAVE_SPOTIFY_BLOB ON) DEPENDS "D-Bus support" HAVE_DBUS
endif(ENABLE_SPOTIFY_BLOB AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND SPOTIFY_FOUND) )
if((NOT HAVE_SPOTIFY_BLOB) AND (NOT QCA_FOUND)) optional_component(DEVICEKIT ON "Devices: DeviceKit backend"
# If we're not bundling the spotify blob then we must ensure QCA is available DEPENDS "D-Bus support" HAVE_DBUS
# so we can verify the blob we download at runtime. )
unset(HAVE_SPOTIFY)
endif((NOT HAVE_SPOTIFY_BLOB) AND (NOT QCA_FOUND))
if(QCA_FOUND AND HAVE_SPOTIFY) optional_component(SPOTIFY_BLOB ON "Spotify support: non-GPL binary helper"
DEPENDS "protobuf" PROTOBUF_FOUND PROTOBUF_PROTOC_EXECUTABLE
DEPENDS "libspotify" SPOTIFY_FOUND
)
# If we're building the spotify blob then we don't need qca2 for the core code
if(HAVE_SPOTIFY_BLOB)
set(QCA_FOUND ON)
elseif(QCA_FOUND)
set(HAVE_QCA ON) set(HAVE_QCA ON)
endif(QCA_FOUND AND HAVE_SPOTIFY)
if(ENABLE_MOODBAR AND FFTW3_FOUND)
set(HAVE_MOODBAR ON)
endif() endif()
if(ENABLE_GOOGLE_DRIVE AND SPARSEHASH_INCLUDE_DIRS AND TAGLIB_VERSION VERSION_GREATER 1.7.999) optional_component(SPOTIFY ON "Spotify support: core code"
set(HAVE_GOOGLE_DRIVE ON) DEPENDS "protobuf" PROTOBUF_FOUND PROTOBUF_PROTOC_EXECUTABLE
endif() DEPENDS "qca2" QCA_FOUND
)
optional_component(MOODBAR ON "Moodbar support"
DEPENDS "fftw3" FFTW3_FOUND
)
optional_component(SPARKLE ON "Sparkle integration"
DEPENDS "Mac OS X" APPLE
DEPENDS "Sparkle" SPARKLE
)
optional_component(VISUALISATIONS ON "Visualisations")
# Find DBus if it's enabled
if (HAVE_DBUS)
find_package(Qt4 REQUIRED QtDbus)
endif ()
# We can include the Qt definitions now
include(${QT_USE_FILE})
# Remove GLU and GL from the link line - they're not really required
# and don't exist on my mingw toolchain
list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL")
if(ENABLE_VISUALISATIONS) if(ENABLE_VISUALISATIONS)
# When/if upstream accepts our patches then these options can be used to link # When/if upstream accepts our patches then these options can be used to link
@ -437,21 +428,4 @@ add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# Show a summary of what we have enabled # Show a summary of what we have enabled
summary_add("Crash reporting" HAVE_BREAKPAD)
summary_add("D-Bus support" HAVE_DBUS)
summary_add("Devices: Audio CD support" HAVE_AUDIOCD)
summary_add("Devices: DeviceKit backend" HAVE_DEVICEKIT)
summary_add("Devices: iPod classic support" HAVE_LIBGPOD)
summary_add("Devices: iPod Touch, iPhone, iPad support" HAVE_IMOBILEDEVICE)
summary_add("Devices: MTP support" HAVE_LIBMTP)
summary_add("Devices: GIO backend" HAVE_GIO)
summary_add("Gnome sound menu integration" HAVE_LIBINDICATE)
summary_add("Google Drive support" HAVE_GOOGLE_DRIVE)
summary_add("Last.fm support" HAVE_LIBLASTFM)
summary_add("Moodbar support" HAVE_MOODBAR)
summary_add("Spotify support: core code" HAVE_SPOTIFY)
summary_add("Spotify support: non-GPL binary helper" HAVE_SPOTIFY_BLOB)
summary_add("Visualisations" ENABLE_VISUALISATIONS)
summary_add("Wiimote support" HAVE_WIIMOTEDEV)
summary_add("(Mac OS X) Sparkle integration" HAVE_SPARKLE)
summary_show() summary_show()

View File

@ -1,3 +1,5 @@
cmake_policy(SET CMP0012 NEW)
set(summary_willbuild "") set(summary_willbuild "")
set(summary_willnotbuild "") set(summary_willnotbuild "")
@ -21,7 +23,65 @@ macro(summary_show_part variable title)
endmacro(summary_show_part) endmacro(summary_show_part)
macro(summary_show) macro(summary_show)
list(SORT summary_willbuild)
list(SORT summary_willnotbuild)
summary_show_part(summary_willbuild "The following components will be built:") summary_show_part(summary_willbuild "The following components will be built:")
summary_show_part(summary_willnotbuild "The following components WILL NOT be built:") summary_show_part(summary_willnotbuild "The following components WILL NOT be built:")
message("") message("")
endmacro(summary_show) endmacro(summary_show)
function(optional_component name default description)
set(option_variable "ENABLE_${name}")
set(have_variable "HAVE_${name}")
set(${have_variable} OFF)
# Create the option
option(${option_variable} "${description}" ${default})
# Was the option set?
if(NOT ${option_variable})
set(summary_willnotbuild "${summary_willnotbuild};${description} (disabled in CMake config)" PARENT_SCOPE)
return()
endif()
# Check each of the dependencies
set(next_arg_is_dep_name FALSE)
set(testing_deps TRUE)
set(current_dep_name)
set(missing_deps)
foreach(arg ${ARGN})
if(${next_arg_is_dep_name})
set(current_dep_name "${arg}")
set(next_arg_is_dep_name FALSE)
elseif(arg STREQUAL "DEPENDS")
set(next_arg_is_dep_name TRUE)
set(testing_deps TRUE)
elseif(${testing_deps})
string(REPLACE " " ";" arglist "${arg}")
if(${arglist})
# We have to do this instead of if(NOT ${arg}) so that tests may contain
# "NOT" themselves.
else()
list(APPEND missing_deps "${current_dep_name}")
set(testing_deps FALSE)
endif()
endif()
endforeach()
if(missing_deps)
foreach(dep ${missing_deps})
if(deplist_text)
set(deplist_text "${deplist_text}, ${dep}")
else()
set(deplist_text "${dep}")
endif()
endforeach()
set(text "${description} (missing ${deplist_text})")
set(summary_willnotbuild "${summary_willnotbuild};${text}" PARENT_SCOPE)
else()
set(${have_variable} ON PARENT_SCOPE)
set(summary_willbuild "${summary_willbuild};${description}" PARENT_SCOPE)
endif()
endfunction()