diff --git a/README-XMP b/README-XMP index 1ca7bd7d..64968324 100644 --- a/README-XMP +++ b/README-XMP @@ -8,7 +8,9 @@ has a new interface to access the raw XMP packet. Todo: XMP support is controlled with the ENABLE_XMP directive in config/config.mk.in. This will be a configure option -eventually. +eventually. For now, comment the line "ENABLE_XMP = 1" either +in config.mk.in before running ./configure or in config.mk to +build without XMP support. Exiv2 uses the Adobe XMP toolkit (XMP SDK) to parse and serialize XMP packets (only the XMPCore component). diff --git a/src/Makefile b/src/Makefile index bb2d3fee..6fcd802a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -91,11 +91,9 @@ CCSRC += rafimage.cpp \ tiffvisitor.cpp \ types.cpp \ value.cpp \ - version.cpp -ifdef ENABLE_XMP -CCSRC += properties.cpp \ + version.cpp \ + properties.cpp \ xmp.cpp -endif # Add library C source files to this list ifndef HAVE_TIMEGM @@ -121,9 +119,11 @@ BINSRC = addmoddel.cpp \ taglist.cpp \ write-test.cpp \ write2-test.cpp \ - tiffparse.cpp \ - xmpparse.cpp \ + tiffparse.cpp +ifdef ENABLE_XMP +BINSRC += xmpparse.cpp \ xmpparser-test.cpp +endif # Main source file of the Exiv2 application EXIV2MAIN = exiv2.cpp diff --git a/src/xmp.cpp b/src/xmp.cpp index de98143c..58ab7875 100644 --- a/src/xmp.cpp +++ b/src/xmp.cpp @@ -365,7 +365,11 @@ namespace Exiv2 { bool XmpParser::initialize() { if (!initialized_) { +#ifdef EXV_HAVE_XMP_TOOLKIT initialized_ = SXMPMeta::Initialize(); +#else + initialized_ = true; +#endif } return initialized_; } @@ -373,7 +377,9 @@ namespace Exiv2 { void XmpParser::terminate() { if (initialized_) { +#ifdef EXV_HAVE_XMP_TOOLKIT SXMPMeta::Terminate(); +#endif initialized_ = false; } } @@ -516,7 +522,7 @@ namespace Exiv2 { return 3; }} // XmpParser::decode #else - int XmpParser::decode( XmpData& /*xmpData*/, + int XmpParser::decode( XmpData& xmpData, const std::string& xmpPacket) { xmpData.clear(); @@ -603,16 +609,16 @@ namespace Exiv2 { return 3; }} // XmpParser::decode #else - void XmpParser::encode( std::string& xmpPacket, - const XmpData& xmpData) + int XmpParser::encode( std::string& xmpPacket, + const XmpData& xmpData) { xmpPacket.clear(); if (!xmpData.empty()) { #ifndef SUPPRESS_WARNINGS std::cerr << "Warning: XMP toolkit support not compiled in.\n"; #endif - return 1; } + return 1; } // XmpParser::encode #endif // !EXV_HAVE_XMP_TOOLKIT diff --git a/test/xmpparser-test.sh b/test/xmpparser-test.sh index c2abc856..485ea45d 100755 --- a/test/xmpparser-test.sh +++ b/test/xmpparser-test.sh @@ -1,6 +1,13 @@ #! /bin/sh # XMP parser test driver +# ---------------------------------------------------------------------- +# Check if xmpparser-test exists +if [ ! -x ../../src/xmpparser-test ] ; then + echo "xmpparser-test not found. Assuming XMP support is not enabled." + exit 0 +fi + # ---------------------------------------------------------------------- # Setup results="./tmp/xmpparser-test.out"