From 73f53cc6f98ce21d93e23e20b57ac2446f6caff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Thu, 17 Aug 2017 19:55:25 +0200 Subject: [PATCH 01/18] Move sample applications from src/CMakeLists.txt to samples/CMakeLists.txt --- samples/CMakeLists.txt | 31 ++++++++++++++++++++++--------- src/CMakeLists.txt | 26 -------------------------- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 932bbb0d..5204724e 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -48,7 +48,7 @@ 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}) + TARGET_LINK_LIBRARIES( ${target} PRIVATE exiv2lib) INSTALL( TARGETS ${target} RUNTIME DESTINATION bin) ENDFOREACH(entry ${SAMPLES}) @@ -61,19 +61,19 @@ 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}) +TARGET_LINK_LIBRARIES( metacopy PRIVATE exiv2lib) INSTALL( TARGETS metacopy RUNTIME DESTINATION bin) 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}) +TARGET_LINK_LIBRARIES( pathtest PRIVATE exiv2lib) INSTALL ( TARGETS pathtest RUNTIME DESTINATION bin) 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}) +TARGET_LINK_LIBRARIES( exiv2json PRIVATE exiv2lib) INSTALL( TARGETS exiv2json RUNTIME DESTINATION bin) if( EXIV2_ENABLE_LIBXMP ) @@ -84,11 +84,24 @@ if( EXIV2_ENABLE_LIBXMP ) INSTALL( TARGETS geotag RUNTIME DESTINATION bin) endif() +# cmdfiletest application +SET( REMOTETEST ../samples/remotetest.cpp) + +# ****************************************************************************** +# 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..bb28979e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,13 +199,6 @@ SET( EXIV2_HDR exiv2app.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 ) @@ -322,25 +315,6 @@ 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} ) - -# ****************************************************************************** -# exifprint application -# ADD_EXECUTABLE( exifprint ${EXIFPRINT} ) -# TARGET_LINK_LIBRARIES( exifprint exiv2lib ) - -# ****************************************************************************** -# remotetest application -ADD_EXECUTABLE( remotetest ${REMOTETEST} ) -TARGET_LINK_LIBRARIES( remotetest exiv2lib ${LIBINTL_LIBRARIES} ) - - # ****************************************************************************** # Man page INSTALL( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) - -# That's all Folks! -## From 0ebd53b1fa21860fa71416222c7bfeefaf33b224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Thu, 17 Aug 2017 20:03:31 +0200 Subject: [PATCH 02/18] Simplify CMake code, and unify to lower case commands --- samples/CMakeLists.txt | 58 +++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 5204724e..a58a5290 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -44,48 +44,38 @@ 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) - 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) -INSTALL( TARGETS metacopy RUNTIME DESTINATION bin) +add_executable( metacopy metacopy.cpp ../src/utils.cpp) +target_link_libraries( metacopy PRIVATE exiv2lib) -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) -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) -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) -INSTALL( TARGETS exiv2json RUNTIME DESTINATION bin) +add_executable( exiv2json exiv2json.cpp Jzon.cpp) +target_link_libraries( exiv2json PRIVATE exiv2lib) -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) +install( TARGETS metacopy pathtest exiv2json RUNTIME DESTINATION bin) + +if (MSVC) + target_sources(pathtest PRIVATE ../getopt_win32.c) + target_sources(metacopy PRIVATE ../getopt_win32.c) endif() -# cmdfiletest application -SET( REMOTETEST ../samples/remotetest.cpp) +if( EXIV2_ENABLE_LIBXMP ) + add_executable( geotag geotag.cpp) + target_link_libraries( geotag PRIVATE exiv2lib ${ZLIB_LIBRARIES}) + install( TARGETS geotag RUNTIME DESTINATION bin) +endif() # ****************************************************************************** # connection test application From 1c037673911025283d4bbdd457b027ac504532ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Thu, 17 Aug 2017 20:23:56 +0200 Subject: [PATCH 03/18] Move inclusion of private header from .hpp to .cpp (not needed in the .hpp) --- include/exiv2/webpimage.hpp | 1 - src/webpimage.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) 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/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 From ee61c24459e98b550d38c7e9d9ab7e4dc126029b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Thu, 17 Aug 2017 20:25:16 +0200 Subject: [PATCH 04/18] Remove inclusion of many useless include_directories --- CMakeLists.txt | 3 --- src/CMakeLists.txt | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b506fe7c..641c6fa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,9 +84,6 @@ 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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb28979e..aa890a4e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -246,6 +246,8 @@ IF ( UNIX ) 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 ${CMAKE_SOURCE_DIR}/include/exiv2) if ( MSVC ) if ( EXIV2_ENABLE_STATIC ) From 57cd78b517fcd808fcf9e6f1dd3ca752dac0a56a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Thu, 17 Aug 2017 20:25:40 +0200 Subject: [PATCH 05/18] Put all the CMake related with the exiv app together --- src/CMakeLists.txt | 62 ++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index aa890a4e..7f6aa7fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -187,31 +187,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 -) - -## -# 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 ) @@ -311,11 +286,38 @@ 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 - ) + +## +# 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 +) + +## +# 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 ) + +add_executable( exiv2 ${EXIV2_SRC} ${EXIV2_HDR} ) +target_link_libraries( exiv2 PRIVATE exiv2lib ) +install(TARGETS exiv2 RUNTIME DESTINATION bin) + +# TODO This should not be needed here! we need to fix the previous TODO +target_include_directories(exiv2 PRIVATE ${CMAKE_SOURCE_DIR}/include/) # ****************************************************************************** # Man page From d29b3b6a109bcea5753a1fb1bc627d49f024320d Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 22:18:10 +0200 Subject: [PATCH 06/18] Remove CMake policy CMP0042. CMake 3.1 already support MACOSX_RPATH --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 641c6fa6..c1f3238b 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" ) From 69fb40fdc6d5797d10a025b9f5123978dda3bfa4 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 22:40:50 +0200 Subject: [PATCH 07/18] Simplify compiler info handling in CMake --- CMakeLists.txt | 14 +++----------- config/printSummary.cmake | 3 ++- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1f3238b..680e5636 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,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 @@ -59,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 ) 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 ) From 8dada3512905990a5af7b66f2323a2af216c88f2 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 22:57:25 +0200 Subject: [PATCH 08/18] Remove unused cmake code --- CMakeLists.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 680e5636..4af140da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,17 +73,12 @@ IF( EXIV2_ENABLE_COMMERCIAL ) ENDIF() 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 ) @@ -123,5 +118,3 @@ IF( MINGW OR UNIX OR APPLE) ENDIF() INCLUDE( config/printSummary.cmake ) -# That's all Folks! -## From c50702612df7453736cea37e6189eaedfca99e5c Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 22:58:47 +0200 Subject: [PATCH 09/18] Simplify CMake code for handling SSH and CURL cases --- src/CMakeLists.txt | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f6aa7fe..6c89047b 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 From 45807ca03df84afbc3781582fd927fdfba48f1f9 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 22:59:34 +0200 Subject: [PATCH 10/18] Do not include SSH and CURL include dirs globally. Do it properly for the exiv2lib target --- config/findDependencies.cmake | 2 -- src/CMakeLists.txt | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) 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/src/CMakeLists.txt b/src/CMakeLists.txt index 6c89047b..6716ceb7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -208,6 +208,14 @@ 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 ${CMAKE_SOURCE_DIR}/include/exiv2) +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 ) TARGET_LINK_LIBRARIES( exiv2lib zlibstatic ${ZLIB_LIBRARIES} ) @@ -217,17 +225,13 @@ 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 PUBLIC ${CURL_LIBRARIES} ${SSH_LIBRARIES}) endif() if( EXIV2_ENABLE_LIBXMP ) From f5f5826c03711637eb9ca65a191f94625f88a24a Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 23:05:15 +0200 Subject: [PATCH 11/18] Use target_sources to extend the list of sources in exceptional situations --- samples/CMakeLists.txt | 4 ++++ src/CMakeLists.txt | 36 +++++++++++++++--------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index a58a5290..dc7693c6 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -61,6 +61,10 @@ add_executable ( pathtest path-test.cpp ../src/utils.cpp) set_target_properties( pathtest PROPERTIES OUTPUT_NAME path-test ) target_link_libraries( pathtest PRIVATE exiv2lib) +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) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6716ceb7..ab3f487c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -275,32 +275,26 @@ msvc_runtime_configure(${EXIV2_ENABLE_SHARED} ${EXIV2_ENABLE_DYNAMIC_RUNTIME}) # ****************************************************************************** # exiv2 application -## -# 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 +set( EXIV2_SRC exiv2.cpp + exiv2app.hpp + actions.cpp + actions.hpp + utils.cpp + utils.hpp ) -## # 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(NOT EXV_HAVE_TIMEGM ) + target_sources(exiv2lib PRIVATE localtime.c) + target_sources(exiv2 PRIVATE localtime.c) +endif() -IF( MSVC ) - SET( EXIV2_SRC ${EXIV2_SRC} getopt_win32.c ) - SET( LIBEXIV2_SRC ${LIBEXIV2_SRC} getopt_win32.c ) -ENDIF( MSVC ) +if (MSVC) + target_sources(exiv2lib PRIVATE getopt_win32.c) + target_sources(exiv2 PRIVATE getopt_win32.c) +endif() -add_executable( exiv2 ${EXIV2_SRC} ${EXIV2_HDR} ) +add_executable( exiv2 ${EXIV2_SRC} ) target_link_libraries( exiv2 PRIVATE exiv2lib ) install(TARGETS exiv2 RUNTIME DESTINATION bin) From 9808c3bf2dee72c1a6160e3241e2aad15a876cff Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 23:21:58 +0200 Subject: [PATCH 12/18] Simplify CMake code to identify FreeBSD systems --- src/CMakeLists.txt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab3f487c..d2c9b6ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -195,14 +195,9 @@ 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 !!! From 93e603e031ea56fad5f417552972cb64a5e3927d Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 23:22:23 +0200 Subject: [PATCH 13/18] Fix linking problems with pthreads --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d2c9b6ed..8e651b10 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -226,6 +226,7 @@ else() if ( UNIX AND NOT FREEBSD ) target_link_libraries( exiv2lib PRIVATE dl) endif() + target_link_libraries( exiv2lib PRIVATE Threads::Threads) target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES} ${SSH_LIBRARIES}) endif() From 27cde135d99951caa167e104913a36b5a02cbb38 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 23:23:02 +0200 Subject: [PATCH 14/18] Remove more useless include_directories --- samples/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index dc7693c6..4c724434 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 @@ -56,10 +54,12 @@ endforeach() 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 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 if(NOT EXV_HAVE_TIMEGM ) target_sources(pathtest PRIVATE ../src/localtime.c) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8e651b10..82a41893 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -201,7 +201,10 @@ 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 ${CMAKE_SOURCE_DIR}/include/exiv2) +target_include_directories(exiv2lib PUBLIC + $ + $ +) if (EXIV2_ENABLE_WEBREADY AND EXIV2_ENABLE_CURL) target_include_directories(exiv2lib SYSTEM PUBLIC ${CURL_INCLUDE_DIR} ) From 6be5278dd2d1754d72f2554e672fefab998cffe6 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 23:23:21 +0200 Subject: [PATCH 15/18] Fix inclusion of file --- include/exiv2/exiv2.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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_ From ca9ef34ea09679248e80cce67bd5eaa389533dfc Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 17 Aug 2017 23:23:37 +0200 Subject: [PATCH 16/18] Add list of things to do in the future --- WORK_IN_PROGRESS | 120 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 WORK_IN_PROGRESS diff --git a/WORK_IN_PROGRESS b/WORK_IN_PROGRESS new file mode 100644 index 00000000..60bd55e3 --- /dev/null +++ b/WORK_IN_PROGRESS @@ -0,0 +1,120 @@ +2017-08-17 + +Puzzle with autotools/--with-adobe (solved: seems to confined to my Mac Book Pro). +----------------------------------------------------------------------------------- + +The --with-adobe code is new (added on Monday/Tuesday 2017-08-15). +It's very much "Work in Progress" and will get lots more polishing. +This builds and links on Mac and Linux (Cygwin isn't ready yet). +Autotools isn't used with Visual Studio + +Default build (which compile/links xmpsdk/src) is fine (and passes test suite) +$ sudo make distclean ; make config ; ./configure ; make ; sudo make install ; make samples ; make tests + +To build with the external Adobe SDK: + +$ sudo make distclean ; make config ; ./configure --with-adobe ; make + +Linux --with-adobe is working when I remove calls to DeleteNamespace in src/xmp.cpp. +The test suite is mostly OK. Some XMP output format has changed. +There are some test crashes to be investigated. + +So, this issue only concerns linking on the Mac. + +The following command works: +$ bin/exiv2 http://clanmills.com/Stonehenge.jpg is working + +The following command crashes when it attempts to execute XMPsdk code +$ bin/exiv2 --verbose --version +........ +config_path=/Users/rmills/.exiv2 +uid=501 +euid=501 +gid=20 +dyld: lazy symbol binding failed: Symbol not found: _WXMPMeta_Initialize_1 + Referenced from: /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib + Expected in: flat namespace + +dyld: Symbol not found: _WXMPMeta_Initialize_1 + Referenced from: /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib + Expected in: flat namespace + +Abort trap: 6 +$ + +This is correct. libXMPCore.a is not in the mix. + +ls -alt src/.libs/libexiv2.26.dylib +-rwxr-xr-x+ 1 rmills staff 2238124 Aug 17 11:07 src/.libs/libexiv2.26.dylib + ------- +Edit src/Makefile#242 and change: + @$(LIBTOOL) --mode=link $(LINK.cc) -o ../bin/$@ $(LIBRARY) $(EXIV2OBJ) $(EXIV2COBJ) -rpath $(libdir) +to: + @$(LIBTOOL) --mode=link $(LINK.cc) -lXMPCore -o ../bin/$@ $(LIBRARY) $(EXIV2OBJ) $(EXIV2COBJ) -rpath $(libdir) + +$ touch src/version.cpp src/exiv2.cpp ; make +$ ls -alt src/.libs/libexiv2.26.dylib +-rwxr-xr-x+ 1 rmills staff 4312308 Aug 17 11:17 src/.libs/libexiv2.26.dylib + ------- +$ bin/exiv2 +dyld: Symbol not found: __ZNSiD0Ev + Referenced from: /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib + Expected in: flat namespace + in /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib +Abort trap: 6 +605 rmills@rmillsmbp:~/gnu/github/exiv2 $ + +$ c++filt _ZNSiD0Ev +std::basic_istream >::~basic_istream() + +It appears that libexiv2.26.dylib isn't linked to the STL libraries. +However I think problem may be with the "flat namespace" which tells the +dynamic linker to search for library names. The search order is: + +$ otool -L bin/.libs/exiv2 +bin/.libs/exiv2: + /usr/local/lib/libexiv2.26.dylib (compatibility version 26.0.0, current version 26.0.0) + /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2) + /usr/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0) + /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) + /usr/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11) + /usr/local/lib/libexpat.1.dylib (compatibility version 8.0.0, current version 8.0.0) + /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0) +So, when he's loading libexiv2.26.dylib, he needs a symbol from libc++.1.dylib + +Amazingly, I got it to work on Wednesday morning. +I must have been confused. Something was working! + +Notes (mostly to remind of painful discoveries) +----------------------------------------------- + +How does the build get generated? +$ make config +This generates ./configure by reading config/configure.ac + +When you use --with-adobe, CXXFLAGS and LDFLAGS are modified and ENABLE_XMP is set to 2016. +Makefile has code to execute the script xmpsdk/buildXMPsdk.sh which +downloads and builds the XMPsdk to create libCore.a (which we need) and libFiles.a + +config/config.mk.in is converted into config/config.mk and included in xmpsdk/src/Makefile +This is really ugly. config.mk also messes with CPPFLAGS and LDFLAGS + +To get -lXMPCore into the mix, set XMPSDK_LIBS in config/config.mk.in + XMPSDK_LIBS = -lXMPCore + +508 rmills@rmillsmbp:~/gnu/github/exiv2 $ finder Makefile | xargs grep -H config.mk | grep include +./contrib/organize/Makefile:include $(top_srcdir)/config/config.mk +./doc/Makefile:include $(top_srcdir)/config/config.mk +./samples/Makefile:include $(top_srcdir)/config/config.mk +./src/Makefile:include $(top_srcdir)/config/config.mk +./xmpsdk/src/Makefile:include $(top_srcdir)/config/config.mk +509 rmills@rmillsmbp:~/gnu/github/exiv2 $ + + +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. + + + From 35c3e3195802342f2e94ba801427c27ba0ba6e5b Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Fri, 18 Aug 2017 12:29:01 +0200 Subject: [PATCH 17/18] Fixes for MSVC case --- samples/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 4c724434..5cfe20f6 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -71,8 +71,8 @@ target_link_libraries( exiv2json PRIVATE exiv2lib) install( TARGETS metacopy pathtest exiv2json RUNTIME DESTINATION bin) if (MSVC) - target_sources(pathtest PRIVATE ../getopt_win32.c) - target_sources(metacopy PRIVATE ../getopt_win32.c) + target_sources(pathtest PRIVATE ../src/getopt_win32.c) + target_sources(metacopy PRIVATE ../src/getopt_win32.c) endif() if( EXIV2_ENABLE_LIBXMP ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 82a41893..d41c6725 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -282,6 +282,13 @@ set( EXIV2_SRC exiv2.cpp utils.hpp ) +add_executable( exiv2 ${EXIV2_SRC} ) +target_link_libraries( exiv2 PRIVATE exiv2lib ) +install(TARGETS exiv2 RUNTIME DESTINATION bin) + +# 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) @@ -293,13 +300,6 @@ if (MSVC) target_sources(exiv2 PRIVATE getopt_win32.c) endif() -add_executable( exiv2 ${EXIV2_SRC} ) -target_link_libraries( exiv2 PRIVATE exiv2lib ) -install(TARGETS exiv2 RUNTIME DESTINATION bin) - -# TODO This should not be needed here! we need to fix the previous TODO -target_include_directories(exiv2 PRIVATE ${CMAKE_SOURCE_DIR}/include/) - # ****************************************************************************** # Man page INSTALL( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) From 461a34d4e17b6140b7a6bf34974d34560dc57d9a Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Fri, 18 Aug 2017 13:27:30 +0200 Subject: [PATCH 18/18] Remove old WORK_IN_PROGRESS file --- WORK-IN-PROGRESS | 5 +- WORK_IN_PROGRESS | 120 ----------------------------------------------- 2 files changed, 4 insertions(+), 121 deletions(-) delete mode 100644 WORK_IN_PROGRESS 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/WORK_IN_PROGRESS b/WORK_IN_PROGRESS deleted file mode 100644 index 60bd55e3..00000000 --- a/WORK_IN_PROGRESS +++ /dev/null @@ -1,120 +0,0 @@ -2017-08-17 - -Puzzle with autotools/--with-adobe (solved: seems to confined to my Mac Book Pro). ------------------------------------------------------------------------------------ - -The --with-adobe code is new (added on Monday/Tuesday 2017-08-15). -It's very much "Work in Progress" and will get lots more polishing. -This builds and links on Mac and Linux (Cygwin isn't ready yet). -Autotools isn't used with Visual Studio - -Default build (which compile/links xmpsdk/src) is fine (and passes test suite) -$ sudo make distclean ; make config ; ./configure ; make ; sudo make install ; make samples ; make tests - -To build with the external Adobe SDK: - -$ sudo make distclean ; make config ; ./configure --with-adobe ; make - -Linux --with-adobe is working when I remove calls to DeleteNamespace in src/xmp.cpp. -The test suite is mostly OK. Some XMP output format has changed. -There are some test crashes to be investigated. - -So, this issue only concerns linking on the Mac. - -The following command works: -$ bin/exiv2 http://clanmills.com/Stonehenge.jpg is working - -The following command crashes when it attempts to execute XMPsdk code -$ bin/exiv2 --verbose --version -........ -config_path=/Users/rmills/.exiv2 -uid=501 -euid=501 -gid=20 -dyld: lazy symbol binding failed: Symbol not found: _WXMPMeta_Initialize_1 - Referenced from: /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib - Expected in: flat namespace - -dyld: Symbol not found: _WXMPMeta_Initialize_1 - Referenced from: /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib - Expected in: flat namespace - -Abort trap: 6 -$ - -This is correct. libXMPCore.a is not in the mix. - -ls -alt src/.libs/libexiv2.26.dylib --rwxr-xr-x+ 1 rmills staff 2238124 Aug 17 11:07 src/.libs/libexiv2.26.dylib - ------- -Edit src/Makefile#242 and change: - @$(LIBTOOL) --mode=link $(LINK.cc) -o ../bin/$@ $(LIBRARY) $(EXIV2OBJ) $(EXIV2COBJ) -rpath $(libdir) -to: - @$(LIBTOOL) --mode=link $(LINK.cc) -lXMPCore -o ../bin/$@ $(LIBRARY) $(EXIV2OBJ) $(EXIV2COBJ) -rpath $(libdir) - -$ touch src/version.cpp src/exiv2.cpp ; make -$ ls -alt src/.libs/libexiv2.26.dylib --rwxr-xr-x+ 1 rmills staff 4312308 Aug 17 11:17 src/.libs/libexiv2.26.dylib - ------- -$ bin/exiv2 -dyld: Symbol not found: __ZNSiD0Ev - Referenced from: /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib - Expected in: flat namespace - in /Users/rmills/gnu/github/exiv2/src/.libs/libexiv2.26.dylib -Abort trap: 6 -605 rmills@rmillsmbp:~/gnu/github/exiv2 $ - -$ c++filt _ZNSiD0Ev -std::basic_istream >::~basic_istream() - -It appears that libexiv2.26.dylib isn't linked to the STL libraries. -However I think problem may be with the "flat namespace" which tells the -dynamic linker to search for library names. The search order is: - -$ otool -L bin/.libs/exiv2 -bin/.libs/exiv2: - /usr/local/lib/libexiv2.26.dylib (compatibility version 26.0.0, current version 26.0.0) - /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2) - /usr/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.2.0) - /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) - /usr/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11) - /usr/local/lib/libexpat.1.dylib (compatibility version 8.0.0, current version 8.0.0) - /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 307.5.0) -So, when he's loading libexiv2.26.dylib, he needs a symbol from libc++.1.dylib - -Amazingly, I got it to work on Wednesday morning. -I must have been confused. Something was working! - -Notes (mostly to remind of painful discoveries) ------------------------------------------------ - -How does the build get generated? -$ make config -This generates ./configure by reading config/configure.ac - -When you use --with-adobe, CXXFLAGS and LDFLAGS are modified and ENABLE_XMP is set to 2016. -Makefile has code to execute the script xmpsdk/buildXMPsdk.sh which -downloads and builds the XMPsdk to create libCore.a (which we need) and libFiles.a - -config/config.mk.in is converted into config/config.mk and included in xmpsdk/src/Makefile -This is really ugly. config.mk also messes with CPPFLAGS and LDFLAGS - -To get -lXMPCore into the mix, set XMPSDK_LIBS in config/config.mk.in - XMPSDK_LIBS = -lXMPCore - -508 rmills@rmillsmbp:~/gnu/github/exiv2 $ finder Makefile | xargs grep -H config.mk | grep include -./contrib/organize/Makefile:include $(top_srcdir)/config/config.mk -./doc/Makefile:include $(top_srcdir)/config/config.mk -./samples/Makefile:include $(top_srcdir)/config/config.mk -./src/Makefile:include $(top_srcdir)/config/config.mk -./xmpsdk/src/Makefile:include $(top_srcdir)/config/config.mk -509 rmills@rmillsmbp:~/gnu/github/exiv2 $ - - -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. - - -