Add support for a global, installable config header

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1019671 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Lukáš Lalinský 2009-09-04 09:29:59 +00:00
parent cf83551c93
commit 06f405f719
18 changed files with 45 additions and 24 deletions

View File

@ -53,6 +53,15 @@ endif(NOT WIN32)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
configure_file(config-taglib.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
if(WITH_ASF)
set(TAGLIB_WITH_ASF TRUE)
endif(WITH_ASF)
if(WITH_MP4)
set(TAGLIB_WITH_MP4 TRUE)
endif(WITH_MP4)
configure_file(taglib/taglib_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)
ADD_SUBDIRECTORY( taglib )
ADD_SUBDIRECTORY(tests)

View File

@ -86,11 +86,11 @@ TagLib_File *taglib_file_new_type(const char *filename, TagLib_File_Type type)
return reinterpret_cast<TagLib_File *>(new Ogg::Speex::File(filename));
case TagLib_File_TrueAudio:
return reinterpret_cast<TagLib_File *>(new TrueAudio::File(filename));
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
case TagLib_File_MP4:
return reinterpret_cast<TagLib_File *>(new MP4::File(filename));
#endif
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
case TagLib_File_ASF:
return reinterpret_cast<TagLib_File *>(new ASF::File(filename));
#endif

View File

@ -56,6 +56,7 @@ KDE_CONF_FILES
dnl without this order in this file, automake will be confused!
dnl
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(taglib/taglib_config.h)
dnl checks for programs.
dnl first check for c/c++ compilers
@ -129,15 +130,15 @@ AC_DEFUN([AC_NO_CPPUNIT],
AC_ARG_ENABLE([mp4],
[AS_HELP_STRING([--enable-mp4], [add MP4 support])],
[
AC_DEFINE([WITH_MP4], [1],
[With MP4 support])
AC_DEFINE([WITH_MP4], [1], [With MP4 support]),
AC_DEFINE([TAGLIB_WITH_MP4], [1], [With MP4 support])
])
AC_ARG_ENABLE([asf],
[AS_HELP_STRING([--enable-asf], [add ASF support])],
[
AC_DEFINE([WITH_ASF], [1],
[With ASF support])
AC_DEFINE([WITH_ASF], [1], [With ASF support]),
AC_DEFINE([TAGLIB_WITH_ASF], [1], [With ASF support])
])
AC_LANG_SAVE

View File

@ -24,7 +24,7 @@ INCLUDES = \
lib_LTLIBRARIES = libtag.la
libtag_la_SOURCES = tag.cpp tagunion.cpp fileref.cpp audioproperties.cpp
taglib_include_HEADERS = tag.h fileref.h audioproperties.h taglib_export.h
taglib_include_HEADERS = tag.h fileref.h audioproperties.h taglib_export.h taglib_config.h
taglib_includedir = $(includedir)/taglib
# Here are a set of rules to help you update your library version information:

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
#include <taglib.h>
#include "asfattribute.h"

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
#include <tdebug.h>
#include <tbytevectorlist.h>

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
#include <tdebug.h>
#include <tstring.h>

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
#include "asftag.h"

View File

@ -129,14 +129,14 @@ StringList FileRef::defaultFileExtensions()
l.append("wv");
l.append("spx");
l.append("tta");
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
l.append("m4a");
l.append("m4b");
l.append("m4p");
l.append("3g2");
l.append("mp4");
#endif
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
l.append("wma");
l.append("asf");
#endif
@ -221,11 +221,11 @@ File *FileRef::create(FileName fileName, bool readAudioProperties,
return new Ogg::Speex::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "TTA")
return new TrueAudio::File(fileName, readAudioProperties, audioPropertiesStyle);
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
if(ext == "M4A" || ext == "M4B" || ext == "M4P" || ext == "MP4" || ext == "3G2")
return new MP4::File(fileName, readAudioProperties, audioPropertiesStyle);
#endif
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
if(ext == "WMA" || ext == "ASF")
return new ASF::File(fileName, readAudioProperties, audioPropertiesStyle);
#endif

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
#include <tdebug.h>
#include <tstring.h>

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
#include <tdebug.h>
#include <tstring.h>

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
#include <taglib.h>
#include <tdebug.h>

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
#include <tdebug.h>
#include <tstring.h>

View File

@ -27,7 +27,7 @@
#include <config.h>
#endif
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
#include <tdebug.h>
#include <tstring.h>

View File

@ -0,0 +1,4 @@
/* taglib_config.h. Generated by cmake from taglib_config.h.cmake */
#cmakedefine TAGLIB_WITH_ASF 1
#cmakedefine TAGLIB_WITH_MP4 1

View File

@ -0,0 +1,5 @@
/* With ASF support */
#undef TAGLIB_WITH_ASF
/* With MP4 support */
#undef TAGLIB_WITH_MP4

View File

@ -36,4 +36,6 @@
#define TAGLIB_EXPORT
#endif
#include "taglib_config.h"
#endif

View File

@ -14,7 +14,7 @@ using namespace TagLib;
class TestFileRef : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(TestFileRef);
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
CPPUNIT_TEST(testASF);
#endif
CPPUNIT_TEST(testMusepack);
@ -22,7 +22,7 @@ class TestFileRef : public CppUnit::TestFixture
CPPUNIT_TEST(testSpeex);
CPPUNIT_TEST(testFLAC);
CPPUNIT_TEST(testMP3);
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
CPPUNIT_TEST(testMP4_1);
CPPUNIT_TEST(testMP4_2);
CPPUNIT_TEST(testMP4_3);
@ -82,7 +82,7 @@ public:
fileRefSave("click", ".mpc");
}
#ifdef WITH_ASF
#ifdef TAGLIB_WITH_ASF
void testASF()
{
fileRefSave("silence-1", ".wma");
@ -114,7 +114,7 @@ public:
fileRefSave("empty", ".tta");
}
#ifdef WITH_MP4
#ifdef TAGLIB_WITH_MP4
void testMP4_1()
{
fileRefSave("has-tags", ".m4a");