diff --git a/CMakeLists.txt b/CMakeLists.txt index dfe0099e..5aa76c9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ set( GENERIC_LIB_SOVERSION "26" ) # options and their default values option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON ) option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) +option( EXIV2_ENABLE_EXTERNAL_XMP "Use external version of XMP" OFF ) option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON ) option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON ) @@ -81,7 +82,7 @@ endif() include(config/findDependencies.cmake) include(config/compilerFlags.cmake) -include( config/generateConfigFile.cmake ) +include(config/generateConfigFile.cmake ) include_directories(${CMAKE_BINARY_DIR}) # Make the exv_conf.h file visible for the full project include( config/CMakeChecks.txt ) @@ -93,6 +94,7 @@ endif() if( EXIV2_ENABLE_XMP ) add_subdirectory( xmpsdk ) endif() + add_subdirectory( src ) if( EXIV2_BUILD_UNIT_TESTS ) diff --git a/conanfile.py b/conanfile.py index b7ce787c..3794a6b9 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,8 +4,12 @@ from conans.tools import os_info class Exiv2Conan(ConanFile): settings = 'os', 'compiler', 'build_type', 'arch' generators = 'cmake' - options = {'unitTests': [True, False]} - default_options = 'unitTests=True' + options = {'unitTests': [True, False], + 'xmp': [True, False], + } + default_options = ('unitTests=True', + 'xmp=False', + ) def configure(self): if not os_info.is_macos: @@ -20,6 +24,9 @@ class Exiv2Conan(ConanFile): if self.options.unitTests: self.requires('gtest/1.8.0@bincrafters/stable') + if self.options.xmp: + self.requires('XmpSdk/2016.7@piponazo/testing') + def imports(self): self.copy('*.dll', dst='conanDlls', src='bin') self.copy('*.dylib', dst='bin', src='lib') diff --git a/config/findDependencies.cmake b/config/findDependencies.cmake index a426f3fe..371d4337 100644 --- a/config/findDependencies.cmake +++ b/config/findDependencies.cmake @@ -30,6 +30,10 @@ if (EXIV2_ENABLE_XMP) find_package(EXPAT REQUIRED) endif () +if (EXIV2_ENABLE_EXTERNAL_XMP) + find_package(XmpSdk REQUIRED) +endif() + if( EXIV2_ENABLE_NLS ) find_package(Intl) if(Intl_FOUND) diff --git a/config/generateConfigFile.cmake b/config/generateConfigFile.cmake index fefb2cad..8fa3b33f 100644 --- a/config/generateConfigFile.cmake +++ b/config/generateConfigFile.cmake @@ -13,7 +13,7 @@ set(EXV_HAVE_PRINTUCS2 ${EXIV2_ENABLE_PRINTUCS2}) set(EXV_PACKAGE ${PACKAGE}) set(EXV_PACKAGE_VERSION ${PACKAGE_VERSION}) set(EXV_PACKAGE_STRING ${PACKAGE_STRING}) -set(EXV_HAVE_XMP_TOOLKIT ${EXIV2_ENABLE_XMP}) +set(EXV_HAVE_XMP_TOOLKIT ${EXIV2_ENABLE_XMP} OR ${EXIV2_ENABLE_EXTERNAL_XMP}) set(EXV_HAVE_ICONV ${ICONV_FOUND}) set(EXV_HAVE_LIBZ ${ZLIB_FOUND}) set(EXV_UNICODE_PATH ${EXIV2_ENABLE_WIN_UNICODE}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89a7b634..9be6582b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -204,9 +204,13 @@ if ( UNIX AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" ) set (FREEBSD 1) endif() -if ( EXIV2_ENABLE_XMP ) +if (EXIV2_ENABLE_XMP) #target_include_directories(exiv2lib PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include) target_link_libraries(exiv2lib PUBLIC xmp) +elseif(EXIV2_ENABLE_EXTERNAL_XMP) + target_link_libraries(exiv2lib PUBLIC ${XMPSDK_LIBRARY}) + target_include_directories(exiv2lib PUBLIC ${XMPSDK_INCLUDE_DIR}) + target_compile_definitions(exiv2lib PUBLIC EXV_ADOBE_XMPSDK=2016) endif() # TODO : We should not include include/exiv2 but only include !!!