Don't try to compile audio CD support if libcdio isn't installed.

This commit is contained in:
David Sansome 2011-08-10 16:23:32 +01:00
parent 369650dbef
commit 082716e9c9
5 changed files with 55 additions and 13 deletions

View File

@ -185,6 +185,7 @@ 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)
@ -207,6 +208,10 @@ if(ENABLE_GIO AND GIO_FOUND AND NOT APPLE)
set(HAVE_GIO ON)
endif(ENABLE_GIO AND GIO_FOUND AND NOT APPLE)
if(ENABLE_AUDIOCD AND CDIO_FOUND)
set(HAVE_AUDIOCD ON)
endif(ENABLE_AUDIOCD AND CDIO_FOUND)
if(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_FOUND AND PLIST_FOUND AND HAVE_LIBGPOD AND USBMUXD_FOUND)
set(HAVE_IMOBILEDEVICE ON)
endif(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_FOUND AND PLIST_FOUND AND HAVE_LIBGPOD AND USBMUXD_FOUND)
@ -396,6 +401,7 @@ add_custom_target(uninstall
# 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)

View File

@ -101,8 +101,6 @@ set(SOURCES
covers/coversearchstatisticsdialog.cpp
covers/kittenloader.cpp
devices/cddalister.cpp
devices/cddadevice.cpp
devices/connecteddevice.cpp
devices/devicedatabasebackend.cpp
devices/devicelister.cpp
@ -327,8 +325,6 @@ set(HEADERS
covers/coversearchstatisticsdialog.h
covers/kittenloader.h
devices/cddalister.h
devices/cddadevice.h
devices/connecteddevice.h
devices/devicedatabasebackend.h
devices/devicelister.h
@ -776,6 +772,15 @@ if(HAVE_GIO)
list(APPEND HEADERS devices/giolister.h)
endif(HAVE_GIO)
# CDIO backend and device
if(HAVE_AUDIOCD)
list(APPEND SOURCES devices/cddadevice.cpp)
list(APPEND SOURCES devices/cddalister.cpp)
list(APPEND HEADERS devices/cddadevice.h)
list(APPEND HEADERS devices/cddalister.h)
endif(HAVE_AUDIOCD)
# libimobiledevice backend and device
if(HAVE_IMOBILEDEVICE)
include_directories(${IMOBILEDEVICE_INCLUDE_DIRS})
@ -870,6 +875,10 @@ list(APPEND OTHER_SOURCES
devices/afcfile.h
devices/afctransfer.cpp
devices/afctransfer.h
devices/cddadevice.cpp
devices/cddadevice.h
devices/cddalister.cpp
devices/cddalister.h
devices/devicekitlister.h
devices/devicekitlister.cpp
devices/gpoddevice.cpp
@ -967,13 +976,11 @@ target_link_libraries(clementine_lib
${GSTREAMER_BASE_LIBRARIES}
${GSTREAMER_LIBRARIES}
${GSTREAMER_APP_LIBRARIES}
${GSTREAMER_CDDA_LIBRARIES}
${GSTREAMER_TAG_LIBRARIES}
${QTSINGLEAPPLICATION_LIBRARIES}
${QTSINGLECOREAPPLICATION_LIBRARIES}
${QTIOCOMPRESSOR_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${CDIO_LIBRARIES}
dl
z
)
@ -994,6 +1001,11 @@ if(HAVE_GIO)
target_link_libraries(clementine_lib ${GIO_LIBRARIES})
endif(HAVE_GIO)
if(HAVE_AUDIOCD)
target_link_libraries(clementine_lib ${CDIO_LIBRARIES})
target_link_libraries(clementine_lib ${GSTREAMER_CDDA_LIBRARIES})
endif(HAVE_AUDIOCD)
if(HAVE_LIBARCHIVE)
target_link_libraries(clementine_lib ${ARCHIVE_LIBRARIES})
endif(HAVE_LIBARCHIVE)

View File

@ -21,6 +21,7 @@
#define CMAKE_EXECUTABLE_SUFFIX "${CMAKE_EXECUTABLE_SUFFIX}"
#cmakedefine ENABLE_VISUALISATIONS
#cmakedefine HAVE_AUDIOCD
#cmakedefine HAVE_BREAKPAD
#cmakedefine HAVE_DBUS
#cmakedefine HAVE_DEVICEKIT

View File

@ -15,6 +15,7 @@
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "songloader.h"
#include "core/logging.h"
#include "core/song.h"
@ -35,7 +36,10 @@
#include <boost/bind.hpp>
#include <gst/cdda/gstcddabasesrc.h>
#ifdef HAVE_AUDIOCD
# include <gst/cdda/gstcddabasesrc.h>
#endif
QSet<QString> SongLoader::sRawUriSchemes;
const int SongLoader::kDefaultTimeout = 5000;
@ -102,6 +106,7 @@ SongLoader::Result SongLoader::LoadLocalPartial(const QString& filename) {
}
SongLoader::Result SongLoader::LoadAudioCD() {
#ifdef HAVE_AUDIOCD
// Create gstreamer cdda element
GstElement* cdda = gst_element_make_from_uri (GST_URI_SRC, "cdda://", NULL);
if (cdda == NULL) {
@ -176,7 +181,10 @@ SongLoader::Result SongLoader::LoadAudioCD() {
gst_object_unref(GST_OBJECT(msg));
gst_object_unref(GST_OBJECT(tags));
return Success;
return Success;
#else // HAVE_AUDIOCD
return Error;
#endif
}
void SongLoader::AudioCDTagsLoaded(const QString& artist, const QString& album,

View File

@ -27,8 +27,10 @@
#include "core/utilities.h"
#include "ui/iconloader.h"
#include "cddalister.h"
#include "cddadevice.h"
#ifdef HAVE_AUDIOCD
# include "cddalister.h"
# include "cddadevice.h"
#endif
#ifdef Q_OS_DARWIN
# include "macdevicelister.h"
@ -186,7 +188,9 @@ DeviceManager::DeviceManager(BackgroundThread<Database>* database,
connected_devices_model_ = new DeviceStateFilterModel(this);
connected_devices_model_->setSourceModel(this);
#ifdef HAVE_AUDIOCD
AddLister(new CddaLister);
#endif
#ifdef HAVE_DEVICEKIT
AddLister(new DeviceKitLister);
#endif
@ -205,9 +209,12 @@ DeviceManager::DeviceManager(BackgroundThread<Database>* database,
AddDeviceClass<AfcDevice>();
#endif
AddDeviceClass<CddaDevice>();
AddDeviceClass<FilesystemDevice>();
#ifdef HAVE_AUDIOCD
AddDeviceClass<CddaDevice>();
#endif
#ifdef HAVE_LIBGPOD
AddDeviceClass<GPodDevice>();
#endif
@ -310,8 +317,16 @@ QVariant DeviceManager::data(const QModelIndex& index, int role) const {
if (!info.device_) {
if (info.database_id_ == -1 &&
!info.BestBackend()->lister_->DeviceNeedsMount(info.BestBackend()->unique_id_)) {
// Don't ask user if it is a CD device
if (info.device_ && !dynamic_cast<CddaDevice*>(info.device_.get())) {
bool prompt_connect = info.device_;
#ifdef HAVE_AUDIOCD
// Don't ask user if it is a CD device
prompt_connect = prompt_connect &&
!dynamic_cast<CddaDevice*>(info.device_.get());
#endif
if (prompt_connect) {
boost::scoped_ptr<QMessageBox> dialog(new QMessageBox(
QMessageBox::Information, tr("Connect device"),
tr("This is the first time you have connected this device. Clementine will now scan the device to find music files - this may take some time."),