diff --git a/CMakeLists.txt b/CMakeLists.txt index b506fe7c..4af140da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,11 +9,7 @@ CMAKE_MINIMUM_REQUIRED( VERSION 3.1.0 ) PROJECT( exiv2 ) -if( POLICY CMP0042 ) - cmake_policy(SET CMP0042 NEW) # enable MACOSX_RPATH support -else() - SET(CMAKE_MACOSX_RPATH 1) -endif() +set(CMAKE_MACOSX_RPATH 1) SET( PACKAGE_COPYRIGHT "Andreas Huggel" ) SET( PACKAGE_BUGREPORT "http://github.com/exiv2/exiv2" ) @@ -51,8 +47,8 @@ ENDIF() include(config/findDependencies.cmake) -IF( MINGW OR UNIX ) - IF ( CMAKE_CXX_COMPILER STREQUAL "g++" OR CMAKE_C_COMPILER STREQUAL "gcc" ) +if( MINGW OR UNIX ) + if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) ADD_DEFINITIONS(-Wall -Wcast-align -Wpointer-arith @@ -63,15 +59,7 @@ IF( MINGW OR UNIX ) ) ENDIF() - execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE COMPILER_VERSION) - string(REGEX MATCHALL "[A-Z|a-z\+]+" GCC_COMPILER_COMPONENTS ${COMPILER_VERSION}) - list(GET GCC_COMPILER_COMPONENTS 0 COMPILER) - - execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION}) - list(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) - - IF ( CYGWIN OR ( ${GCC_MAJOR} GREATER 5 )) + IF ( CYGWIN OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)) ADD_DEFINITIONS( -std=gnu++98 ) # to support snprintf ELSE() ADD_DEFINITIONS( -std=c++98 ) @@ -84,21 +72,13 @@ IF( EXIV2_ENABLE_COMMERCIAL ) SET (EXIV2_ENABLE_NLS OFF) ENDIF() -# binary as first, since it workarounds old VS solution compatibility problems -INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/ ${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/include/exiv2/) - if( MSVC ) - # cmake_policy(SET CMP0008) ADD_DEFINITIONS(-DPSAPI_VERSION=1) # to be compatible with <= WinVista (#905) set(CMAKE_DEBUG_POSTFIX "d") endif( MSVC ) IF( EXIV2_ENABLE_XMP ) SET( HAVE_XMP_TOOLKIT ON ) - SET( XMPLIB "do" ) - IF (NOT MINGW) - set(THREADS_PREFER_PTHREAD_FLAG ON) - ENDIF() ENDIF( EXIV2_ENABLE_XMP ) include( config/generateConfigFile.cmake ) @@ -138,5 +118,3 @@ IF( MINGW OR UNIX OR APPLE) ENDIF() INCLUDE( config/printSummary.cmake ) -# That's all Folks! -## diff --git a/WORK-IN-PROGRESS b/WORK-IN-PROGRESS index 00db467a..c9b1da02 100644 --- a/WORK-IN-PROGRESS +++ b/WORK-IN-PROGRESS @@ -237,7 +237,6 @@ For sure, Adobe's code is being built with MacOSX10.8.sdk and -std=c++11 -o CMakeFiles/XMPCoreStatic.dir/Users/rmills/gnu/github/exiv2/xmpsdk/Adobe/XMP-Toolkit-SDK-CC201607/XMPCore/source/XMPMeta-GetSet.cpp.o -c /Users/rmills/gnu/github/exiv2/xmpsdk/Adobe/XMP-Toolkit-SDK-CC201607/XMPCore/source/XMPMeta-GetSet.cpp - Compiler options used to build DumpFile sample Application ----------------------------------------------------------- @@ -352,3 +351,7 @@ Linker Options used to link DumpFile /Users/rmills/gnu/github/exiv2/xmpsdk/Adobe/XMP-Toolkit-SDK-CC201607/samples/build/cmake/DumpFile/build_x64/XMP_Samples_64.build/Release/DumpFile.build/Objects-normal/x86_64/DumpFile_dependency_info.dat -o /Users/rmills/gnu/github/exiv2/xmpsdk/Adobe/XMP-Toolkit-SDK-CC201607/samples/target/macintosh/intel_64/Release/DumpFile +Features to Add to the CMake code +----------------------------------------------------------------------------------- + * Auto usage of ccache on Linux and Mac. + * Remove the trick to compile the documentation using the configure script. Native documentation generation on CMake. diff --git a/config/findDependencies.cmake b/config/findDependencies.cmake index 809c8043..6b909361 100644 --- a/config/findDependencies.cmake +++ b/config/findDependencies.cmake @@ -13,12 +13,10 @@ if( EXIV2_ENABLE_WEBREADY ) set( ENABLE_WEBREADY 1 ) if( EXIV2_ENABLE_CURL ) find_package( CURL REQUIRED) - include_directories( ${CURL_INCLUDE_DIR} ) endif() if( EXIV2_ENABLE_SSH ) find_package( SSH REQUIRED) - include_directories( ${SSH_INCLUDE_DIR} ) endif( EXIV2_ENABLE_SSH ) endif( EXIV2_ENABLE_WEBREADY ) diff --git a/config/printSummary.cmake b/config/printSummary.cmake index 6b3d7160..e5b1cc1e 100644 --- a/config/printSummary.cmake +++ b/config/printSummary.cmake @@ -14,7 +14,8 @@ macro( OptionOutput _outputstring ) message( STATUS "${_outputstring}${_var}" ) endmacro( OptionOutput _outputstring ) -message(STATUS Compiler: ${COMPILER} " Major:" ${GCC_MAJOR}) +message( STATUS "Compiler info: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) ; version: ${CMAKE_CXX_COMPILER_VERSION}") + message( STATUS "------------------------------------------------------------------" ) message( STATUS "${PACKAGE_STRING} configure results <${PACKAGE_URL}>" ) OptionOutput( "Building PNG support: " EXIV2_ENABLE_PNG AND ZLIB_FOUND ) diff --git a/include/exiv2/exiv2.hpp b/include/exiv2/exiv2.hpp index 9930b8b3..d4cc566e 100644 --- a/include/exiv2/exiv2.hpp +++ b/include/exiv2/exiv2.hpp @@ -70,7 +70,7 @@ #include "exiv2/types.hpp" #include "exiv2/value.hpp" #include "exiv2/version.hpp" -#include "exiv2/xmp.hpp" +#include "exiv2/xmp_exiv2.hpp" #include "exiv2/xmpsidecar.hpp" #endif // #ifndef EXIV2_HPP_ diff --git a/include/exiv2/webpimage.hpp b/include/exiv2/webpimage.hpp index e0b2df3e..f5c50cfd 100644 --- a/include/exiv2/webpimage.hpp +++ b/include/exiv2/webpimage.hpp @@ -33,7 +33,6 @@ // included header files #include "exif.hpp" #include "image.hpp" -#include "tags_int.hpp" // ***************************************************************************** // namespace extensions diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 932bbb0d..5cfe20f6 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -8,8 +8,6 @@ if ( NOT MSVC ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) endif() -include_directories("${CMAKE_SOURCE_DIR}/include" "${CMAKE_SOURCE_DIR}/src") - SET( SAMPLES addmoddel.cpp convert-test.cpp easyaccess-test.cpp @@ -44,51 +42,60 @@ SET( SAMPLES addmoddel.cpp include(../CMake_msvc.txt) msvc_runtime_configure(${EXIV2_ENABLE_SHARED} ${EXIV2_ENABLE_DYNAMIC_RUNTIME}) -FOREACH(entry ${SAMPLES}) - STRING( REPLACE ".cpp" "" target ${entry}) - ADD_EXECUTABLE( ${target} ${target}.cpp ) - ADD_TEST( ${target}_test ${target} ) - TARGET_LINK_LIBRARIES( ${target} PRIVATE exiv2lib ${CMAKE_THREAD_LIBS_INIT}) - INSTALL( TARGETS ${target} RUNTIME DESTINATION bin) -ENDFOREACH(entry ${SAMPLES}) +foreach(entry ${SAMPLES}) + string( REPLACE ".cpp" "" target ${entry}) + add_executable( ${target} ${target}.cpp ) + add_test( ${target}_test ${target} ) + target_link_libraries( ${target} PRIVATE exiv2lib) + install( TARGETS ${target} RUNTIME DESTINATION bin) +endforeach() ################################### -# metacopy/path-test sample applications require utils.cpp support -IF( MSVC ) - SET( PATHTEST_SRC ${PATHTEST_SRC} ../src/getopt_win32.c ) - SET( MC_SRC ${MC_SRC} ../src/getopt_win32.c ) -ENDIF( MSVC ) -SET( MC_SRC ${MC_SRC} metacopy.cpp ../src/utils.cpp ) -ADD_EXECUTABLE( metacopy ${MC_SRC} ) -TARGET_LINK_LIBRARIES( metacopy PRIVATE exiv2lib ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) -INSTALL( TARGETS metacopy RUNTIME DESTINATION bin) +add_executable( metacopy metacopy.cpp ../src/utils.cpp) +target_link_libraries( metacopy PRIVATE exiv2lib) +target_include_directories(metacopy PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find utils.hpp -SET ( PATHTEST_SRC ${PATHTEST_SRC} path-test.cpp ../src/utils.cpp ) -ADD_EXECUTABLE ( pathtest ${PATHTEST_SRC} ) -SET_TARGET_PROPERTIES( pathtest PROPERTIES OUTPUT_NAME path-test ) -TARGET_LINK_LIBRARIES( pathtest PRIVATE exiv2lib ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) -INSTALL ( TARGETS pathtest RUNTIME DESTINATION bin) +add_executable ( pathtest path-test.cpp ../src/utils.cpp) +set_target_properties( pathtest PROPERTIES OUTPUT_NAME path-test ) +target_link_libraries( pathtest PRIVATE exiv2lib) +target_include_directories(pathtest PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find utils.hpp -SET( EXIV2JSON_SRC exiv2json.cpp Jzon.cpp ) -ADD_EXECUTABLE( exiv2json ${EXIV2JSON_SRC} ) -SET_TARGET_PROPERTIES( exiv2json PROPERTIES OUTPUT_NAME exiv2json ) -TARGET_LINK_LIBRARIES( exiv2json PRIVATE exiv2lib ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) -INSTALL( TARGETS exiv2json RUNTIME DESTINATION bin) +if(NOT EXV_HAVE_TIMEGM ) + target_sources(pathtest PRIVATE ../src/localtime.c) +endif() + +add_executable( exiv2json exiv2json.cpp Jzon.cpp) +target_link_libraries( exiv2json PRIVATE exiv2lib) + +install( TARGETS metacopy pathtest exiv2json RUNTIME DESTINATION bin) + +if (MSVC) + target_sources(pathtest PRIVATE ../src/getopt_win32.c) + target_sources(metacopy PRIVATE ../src/getopt_win32.c) +endif() if( EXIV2_ENABLE_LIBXMP ) - SET( GEOTAG_SRC geotag.cpp ) - ADD_EXECUTABLE( geotag ${GEOTAG_SRC} ) - SET_TARGET_PROPERTIES( geotag PROPERTIES OUTPUT_NAME geotag ) - TARGET_LINK_LIBRARIES( geotag PRIVATE exiv2lib ${ZLIB_LIBRARIES}) - INSTALL( TARGETS geotag RUNTIME DESTINATION bin) + add_executable( geotag geotag.cpp) + target_link_libraries( geotag PRIVATE exiv2lib ${ZLIB_LIBRARIES}) + install( TARGETS geotag RUNTIME DESTINATION bin) endif() +# ****************************************************************************** +# connection test application +add_executable(conntest conntest.cpp) +target_link_libraries(conntest PRIVATE exiv2lib) + +# ****************************************************************************** +# exifprint application +# ADD_EXECUTABLE( exifprint exifprint.cpp ) +# TARGET_LINK_LIBRARIES( exifprint exiv2lib ) + +# ****************************************************************************** +# remotetest application +add_executable(remotetest remotetest.cpp) +target_link_libraries(remotetest exiv2lib) + # ****************************************************************************** # Man page INSTALL( FILES exiv2samples.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) - -# That's all Folks! -## - - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8848a266..d41c6725 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -145,33 +145,17 @@ SET( LIBEXIV2_SRC asfvideo.cpp utilsvideo.cpp ) -IF( EXIV2_ENABLE_WEBREADY ) - ## - # add curl support - IF( EXIV2_ENABLE_CURL ) - IF( CURL_FOUND ) - SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} - easyaccess.cpp - ) - set( LIBEXIV2_HDR ${LIBEXIV2_HDR} - ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/easyaccess.hpp - ) - ENDIF() - ENDIF() +if( EXIV2_ENABLE_WEBREADY ) + if( EXIV2_ENABLE_CURL) + set( LIBEXIV2_SRC ${LIBEXIV2_SRC} easyaccess.cpp) + set( LIBEXIV2_HDR ${LIBEXIV2_HDR} ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/easyaccess.hpp) + endif() - ## - # add ssh support - IF( EXIV2_ENABLE_SSH ) - IF( SSH_FOUND ) - SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} - ssh.cpp - ) - set( LIBEXIV2_HDR ${LIBEXIV2_HDR} - ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/ssh.hpp - ) - ENDIF() - ENDIF() -ENDIF( EXIV2_ENABLE_WEBREADY ) + if( EXIV2_ENABLE_SSH ) + set( LIBEXIV2_SRC ${LIBEXIV2_SRC} ssh.cpp) + set( LIBEXIV2_HDR ${LIBEXIV2_HDR} ${CMAKE_CURRENT_LIST_DIR}/../include/exiv2/ssh.hpp) + endif() +endif( EXIV2_ENABLE_WEBREADY ) ## # add png*.cpp files if PNG support requested @@ -187,38 +171,6 @@ ENDIF( EXIV2_ENABLE_PNG ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -## -# Create source file lists for applications -# exiv2 application -SET( EXIV2_SRC exiv2.cpp - actions.cpp - utils.cpp -) -SET( EXIV2_HDR exiv2app.hpp - actions.hpp - utils.hpp -) - -# connection test application -SET( CONNTEST ../samples/conntest.cpp) -# exifprint application -SET( EXIFPRINT ../samples/exifprint.cpp) -# cmdfiletest application -SET( REMOTETEST ../samples/remotetest.cpp) - -## -# modify source lists to suit environment -IF(NOT EXV_HAVE_TIMEGM ) - SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} localtime.c ) - SET( EXIV2_SRC ${EXIV2_SRC} localtime.c ) - SET( PATHTEST_SRC ${PATHTEST_SRC} localtime.c ) -ENDIF() - -IF( MSVC ) - SET( EXIV2_SRC ${EXIV2_SRC} getopt_win32.c ) - SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} getopt_win32.c ) -ENDIF( MSVC ) - ## # msvn tuning IF( MSVC ) @@ -243,16 +195,24 @@ SET_TARGET_PROPERTIES( exiv2lib PROPERTIES OUTPUT_NAME exiv2 ) -IF ( UNIX ) - IF ( NOT CYGWIN AND NOT MINGW ) - SET (LINUX 1) - ENDIF() - IF ( CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" ) - SET (FREEBSD 1) - ENDIF() -ENDIF() +if ( UNIX AND CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" ) + set (FREEBSD 1) +endif() target_include_directories(exiv2lib PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include) +# TODO : We should not include include/exiv2 but only include !!! +target_include_directories(exiv2lib PUBLIC + $ + $ +) + +if (EXIV2_ENABLE_WEBREADY AND EXIV2_ENABLE_CURL) + target_include_directories(exiv2lib SYSTEM PUBLIC ${CURL_INCLUDE_DIR} ) +endif() + +if (EXIV2_ENABLE_WEBREADY AND EXIV2_ENABLE_SSH) + target_include_directories(exiv2lib SYSTEM PUBLIC ${SSH_INCLUDE_DIR} ) +endif() if ( MSVC ) if ( EXIV2_ENABLE_STATIC ) @@ -263,17 +223,14 @@ if ( MSVC ) source_group("Header Files" FILES ${LIBEXIV2_HDR} ) source_group("Header Files" FILES ${LIBCURL_HDR} ) source_group("Header Files" FILES ${SSH_HDR} ) - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${SSH_LIBRARIES}) + target_link_libraries( exiv2lib PRIVATE ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${SSH_LIBRARIES}) else() + # TODO: Check if this is really needed. if ( UNIX AND NOT FREEBSD ) - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE dl ${CURL_LIBRARIES} ) - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE dl ${SSH_LIBRARIES} ) - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE dl ${CMAKE_THREAD_LIBS_INIT} ) - else() - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${CURL_LIBRARIES} ) - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${SSH_LIBRARIES} ) - TARGET_LINK_LIBRARIES( exiv2lib PRIVATE ${CMAKE_THREAD_LIBS_INIT} ) + target_link_libraries( exiv2lib PRIVATE dl) endif() + target_link_libraries( exiv2lib PRIVATE Threads::Threads) + target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES} ${SSH_LIBRARIES}) endif() if( EXIV2_ENABLE_LIBXMP ) @@ -316,31 +273,33 @@ msvc_runtime_configure(${EXIV2_ENABLE_SHARED} ${EXIV2_ENABLE_DYNAMIC_RUNTIME}) # ****************************************************************************** # exiv2 application -ADD_EXECUTABLE( exiv2 ${EXIV2_SRC} ${EXIV2_HDR} ) -TARGET_LINK_LIBRARIES( exiv2 exiv2lib ${LIBINTL_LIBRARIES} ) -install(TARGETS exiv2 - RUNTIME DESTINATION bin - ) -# ****************************************************************************** -# connection test application -ADD_EXECUTABLE( conntest ${CONNTEST} ) -TARGET_LINK_LIBRARIES( conntest PRIVATE exiv2lib ${CURL_LIBRARIES} ${SSH_LIBRARIES} ${LIBINTL_LIBRARIES} ) +set( EXIV2_SRC exiv2.cpp + exiv2app.hpp + actions.cpp + actions.hpp + utils.cpp + utils.hpp +) -# ****************************************************************************** -# exifprint application -# ADD_EXECUTABLE( exifprint ${EXIFPRINT} ) -# TARGET_LINK_LIBRARIES( exifprint exiv2lib ) +add_executable( exiv2 ${EXIV2_SRC} ) +target_link_libraries( exiv2 PRIVATE exiv2lib ) +install(TARGETS exiv2 RUNTIME DESTINATION bin) -# ****************************************************************************** -# remotetest application -ADD_EXECUTABLE( remotetest ${REMOTETEST} ) -TARGET_LINK_LIBRARIES( remotetest exiv2lib ${LIBINTL_LIBRARIES} ) +# TODO This should not be needed here! we need to fix the previous TODO +target_include_directories(exiv2 PRIVATE ${CMAKE_SOURCE_DIR}/include/) +# modify source lists to suit environment +if(NOT EXV_HAVE_TIMEGM ) + target_sources(exiv2lib PRIVATE localtime.c) + target_sources(exiv2 PRIVATE localtime.c) +endif() + +if (MSVC) + target_sources(exiv2lib PRIVATE getopt_win32.c) + target_sources(exiv2 PRIVATE getopt_win32.c) +endif() # ****************************************************************************** # Man page INSTALL( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) - -# That's all Folks! -## diff --git a/src/webpimage.cpp b/src/webpimage.cpp index e4057d6c..3882eb9e 100644 --- a/src/webpimage.cpp +++ b/src/webpimage.cpp @@ -44,6 +44,8 @@ #include "tiffimage.hpp" #include "tiffimage_int.hpp" #include "convert.hpp" +#include "tags_int.hpp" + #include #include #include