Remove EXIV2_ENABLE_LIBXMP variable, always build static XMP library, remove cmake OBJECT library
This commit is contained in:
parent
df3c77516c
commit
2784b1f7f7
@ -27,7 +27,6 @@ set( GENERIC_LIB_SOVERSION "26" )
|
|||||||
# options and their default values
|
# options and their default values
|
||||||
option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON )
|
option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON )
|
||||||
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
|
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
|
||||||
option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON )
|
|
||||||
option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )
|
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_NLS "Build native language support (requires gettext)" ON )
|
||||||
option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
|
option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
|
||||||
|
|||||||
@ -19,7 +19,6 @@ cmake -G "$MAKEFILES_TYPE" . \
|
|||||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
-DEXIV2_ENABLE_XMP=ON \
|
-DEXIV2_ENABLE_XMP=ON \
|
||||||
-DEXIV2_ENABLE_LIBXMP=ON \
|
|
||||||
-DEXIV2_ENABLE_PNG=ON \
|
-DEXIV2_ENABLE_PNG=ON \
|
||||||
-DEXIV2_ENABLE_NLS=ON \
|
-DEXIV2_ENABLE_NLS=ON \
|
||||||
-DEXIV2_ENABLE_PRINTUCS2=ON \
|
-DEXIV2_ENABLE_PRINTUCS2=ON \
|
||||||
|
|||||||
@ -62,7 +62,6 @@ cmake -G "$MAKEFILES_TYPE" . \
|
|||||||
-DCMAKE_MODULE_PATH="${INSTALL_PREFIX}/share/cmake/modules" \
|
-DCMAKE_MODULE_PATH="${INSTALL_PREFIX}/share/cmake/modules" \
|
||||||
-DBUILD_SHARED_LIBS=ON \
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
-DEXIV2_ENABLE_XMP=ON \
|
-DEXIV2_ENABLE_XMP=ON \
|
||||||
-DEXIV2_ENABLE_LIBXMP=ON \
|
|
||||||
-DEXIV2_ENABLE_PNG=ON \
|
-DEXIV2_ENABLE_PNG=ON \
|
||||||
-DEXIV2_ENABLE_NLS=ON \
|
-DEXIV2_ENABLE_NLS=ON \
|
||||||
-DEXIV2_ENABLE_PRINTUCS2=ON \
|
-DEXIV2_ENABLE_PRINTUCS2=ON \
|
||||||
|
|||||||
@ -22,7 +22,6 @@ message( STATUS "${PACKAGE_STRING} configure results <${PACKAGE_URL}>"
|
|||||||
OptionOutput( "Building shared library: " BUILD_SHARED_LIBS )
|
OptionOutput( "Building shared library: " BUILD_SHARED_LIBS )
|
||||||
OptionOutput( "Building PNG support: " EXIV2_ENABLE_PNG AND ZLIB_FOUND )
|
OptionOutput( "Building PNG support: " EXIV2_ENABLE_PNG AND ZLIB_FOUND )
|
||||||
OptionOutput( "XMP metadata support: " EXIV2_ENABLE_XMP )
|
OptionOutput( "XMP metadata support: " EXIV2_ENABLE_XMP )
|
||||||
OptionOutput( "Building static libxmp: " EXIV2_ENABLE_LIBXMP )
|
|
||||||
OptionOutput( "Native language support: " EXIV2_ENABLE_NLS )
|
OptionOutput( "Native language support: " EXIV2_ENABLE_NLS )
|
||||||
OptionOutput( "Conversion of Windows XP tags: " EXIV2_ENABLE_PRINTUCS2 )
|
OptionOutput( "Conversion of Windows XP tags: " EXIV2_ENABLE_PRINTUCS2 )
|
||||||
OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA )
|
OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA )
|
||||||
|
|||||||
@ -231,7 +231,6 @@ How to use this
|
|||||||
# options and their default values
|
# options and their default values
|
||||||
option( BUILD_SHARED_LIBS "Build exiv2 as a shared library (dll)" ON )
|
option( BUILD_SHARED_LIBS "Build exiv2 as a shared library (dll)" ON )
|
||||||
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
|
option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON )
|
||||||
option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON )
|
|
||||||
option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )
|
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_NLS "Build native language support (requires gettext)" ON )
|
||||||
option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
|
option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON )
|
||||||
|
|||||||
@ -165,12 +165,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|||||||
# ******************************************************************************
|
# ******************************************************************************
|
||||||
# exiv2lib library
|
# exiv2lib library
|
||||||
|
|
||||||
if( EXIV2_ENABLE_XMP AND NOT EXIV2_ENABLE_LIBXMP )
|
add_library( exiv2lib ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR})
|
||||||
add_library( exiv2lib ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR} $<TARGET_OBJECTS:xmp_object>)
|
|
||||||
target_link_libraries(exiv2lib PUBLIC ${EXPAT_LIBRARIES})
|
|
||||||
else()
|
|
||||||
add_library( exiv2lib ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} ${LIBEXIV2_PRIVATE_HDR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties( exiv2lib PROPERTIES
|
set_target_properties( exiv2lib PROPERTIES
|
||||||
VERSION ${GENERIC_LIB_VERSION}
|
VERSION ${GENERIC_LIB_VERSION}
|
||||||
@ -192,10 +187,8 @@ if ( UNIX AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" )
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( EXIV2_ENABLE_XMP )
|
if ( EXIV2_ENABLE_XMP )
|
||||||
target_include_directories(exiv2lib PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include)
|
#target_include_directories(exiv2lib PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include)
|
||||||
if( EXIV2_ENABLE_LIBXMP )
|
target_link_libraries(exiv2lib PUBLIC xmp)
|
||||||
target_link_libraries( exiv2lib PUBLIC xmp )
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TODO : We should not include include/exiv2 but only include !!!
|
# TODO : We should not include include/exiv2 but only include !!!
|
||||||
|
|||||||
@ -28,29 +28,28 @@ set(XMPSRC src/ExpatAdapter.cpp
|
|||||||
include/XMP_Version.h
|
include/XMP_Version.h
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(_currentfile ${XMPSRC})
|
add_library(xmp STATIC ${XMPSRC})
|
||||||
if(UNIX AND NOT CYGWIN)
|
|
||||||
set_source_files_properties(${_currentfile} PROPERTIES COMPILE_FLAGS "-fPIC")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# We generate a CMake OBJECT LIBRARY (a bunch of object files)
|
target_link_libraries(xmp
|
||||||
add_library( xmp_object OBJECT ${XMPSRC} )
|
PRIVATE
|
||||||
|
${EXPAT_LIBRARY}
|
||||||
|
)
|
||||||
|
|
||||||
target_include_directories(xmp_object
|
target_include_directories(xmp
|
||||||
|
PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/xmpsdk/include>
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${EXPAT_INCLUDE_DIR}
|
${EXPAT_INCLUDE_DIR}
|
||||||
${CMAKE_SOURCE_DIR}/xmpsdk/include
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO : We should only add this definition for Windows
|
||||||
|
target_compile_definitions(xmp PRIVATE XML_STATIC)
|
||||||
|
|
||||||
check_include_file( "stdint.h" EXV_HAVE_STDINT_H )
|
check_include_file( "stdint.h" EXV_HAVE_STDINT_H )
|
||||||
if (EXV_HAVE_STDINT_H)
|
if (EXV_HAVE_STDINT_H)
|
||||||
target_compile_definitions(xmp_object PUBLIC EXV_HAVE_STDINT_H)
|
target_compile_definitions(xmp PRIVATE EXV_HAVE_STDINT_H)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# TODO : We should only add this definition if EXPAT is static
|
|
||||||
target_compile_definitions(xmp_object PRIVATE XML_STATIC)
|
|
||||||
|
|
||||||
# http://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang
|
# http://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang
|
||||||
if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
# 1123 - hide xmpsdk symbols
|
# 1123 - hide xmpsdk symbols
|
||||||
@ -58,17 +57,8 @@ if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|||||||
COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
|
COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( EXIV2_ENABLE_LIBXMP )
|
if (BUILD_SHARED_LIBS)
|
||||||
add_library(xmp STATIC $<TARGET_OBJECTS:xmp_object>)
|
set_property(TARGET xmp PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
target_link_libraries(xmp PUBLIC ${EXPAT_LIBRARY})
|
|
||||||
|
|
||||||
# This is also needed for the xmp static library
|
|
||||||
target_include_directories(xmp PUBLIC ${EXPAT_INCLUDE_DIR})
|
|
||||||
target_compile_definitions(xmp PUBLIC XML_STATIC)
|
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS)
|
|
||||||
set_property(TARGET xmp_object PROPERTY POSITION_INDEPENDENT_CODE ON)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel)
|
# 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user