From e05010daf559f0eebaa3dab8f709558efa8d352d Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Thu, 24 Aug 2017 18:52:47 +0200 Subject: [PATCH 01/16] Add conan support. Bring Expat, Zlib and libcurl using conan --- conanfile.py | 11 +++++++++++ config/findDependencies.cmake | 6 ++++++ 2 files changed, 17 insertions(+) create mode 100644 conanfile.py diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000..24428125 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,11 @@ +from conans import ConanFile +from conans.tools import os_info + +class Exiv2Conan(ConanFile): + settings = 'os', 'compiler', 'build_type', 'arch' + generators = 'cmake' + + def requirements(self): + self.requires('Expat/2.2.1@pix4d/stable') # From pix4d + self.requires('zlib/1.2.11@conan/stable') # From conan-center + self.requires('libcurl/7.47.1@lasote/stable') # From conan-transit (It also brings OpenSSL) diff --git a/config/findDependencies.cmake b/config/findDependencies.cmake index cb522449..7ece1132 100644 --- a/config/findDependencies.cmake +++ b/config/findDependencies.cmake @@ -1,6 +1,12 @@ # set include path for FindXXX.cmake files set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/") +# Check if the conan file exist to find the dependencies +if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + conan_set_find_paths() +endif() + find_package(Threads REQUIRED) if( EXIV2_ENABLE_PNG ) From c2350a3cb96531397744cc3068e13a63319b9ff6 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sat, 26 Aug 2017 10:34:00 +0200 Subject: [PATCH 02/16] Make CMake code work with conan --- src/CMakeLists.txt | 57 +++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 87a4d6f1..7635a2d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -160,6 +160,10 @@ if( EXIV2_ENABLE_PNG ) set( LIBEXIV2_HDR ${LIBEXIV2_HDR} ../include/exiv2/pngimage.hpp ) endif() +source_group("Header Files" FILES ${LIBEXIV2_HDR} ) +source_group("Header Files" FILES ${LIBCURL_HDR} ) +source_group("Header Files" FILES ${SSH_HDR} ) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) # ****************************************************************************** @@ -191,6 +195,9 @@ endif() if ( EXIV2_ENABLE_XMP ) target_include_directories(exiv2lib PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include) + if( EXIV2_ENABLE_LIBXMP ) + target_link_libraries( exiv2lib PUBLIC xmp ) + endif() endif() # TODO : We should not include include/exiv2 but only include !!! @@ -199,37 +206,44 @@ 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) + target_include_directories(exiv2lib SYSTEM + PUBLIC + ${CURL_INCLUDE_DIR} + ${SSH_INCLUDE_DIR} + ) -if (EXIV2_ENABLE_WEBREADY AND EXIV2_ENABLE_SSH) - target_include_directories(exiv2lib SYSTEM PUBLIC ${SSH_INCLUDE_DIR} ) + # TODO : There should not be needed to make this difference. Improve LIBCURL conan recipe + if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) + else() + target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES}) + endif() + + target_link_libraries( exiv2lib PUBLIC ${SSH_LIBRARIES}) + target_compile_definitions (exiv2lib + PUBLIC + ${CONAN_COMPILE_DEFINITIONS_LIBCURL} + ) endif() if ( MSVC ) - target_compile_definitions(exiv2lib PRIVATE PSAPI_VERSION=1) # to be compatible with <= WinVista (#905) + target_compile_definitions(exiv2lib + PRIVATE + PSAPI_VERSION=1 # to be compatible with <= WinVista (#905) + ) - if ( EXIV2_ENABLE_STATIC ) - target_link_libraries( exiv2lib zlibstatic ${ZLIB_LIBRARIES} ) - else() - target_link_libraries( exiv2lib PRIVATE ${ZLIB_LIBRARIES} ) - endif() - 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}) else() # TODO: Check if this is really needed. 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() -if( EXIV2_ENABLE_XMP AND EXIV2_ENABLE_LIBXMP ) - target_link_libraries( exiv2lib PUBLIC xmp ) + if (CYGWIN OR MINGW) + target_link_libraries( exiv2lib PRIVATE psapi ws2_32 ) + endif() + + target_link_libraries( exiv2lib PRIVATE Threads::Threads) endif() if( EXIV2_ENABLE_PNG ) @@ -245,9 +259,6 @@ if( ICONV_FOUND ) target_link_libraries( exiv2lib PRIVATE ${ICONV_LIBRARIES} ) endif() -if (CYGWIN OR MINGW) - target_link_libraries( exiv2lib PRIVATE psapi ws2_32 ) -endif() install(TARGETS exiv2lib RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} From 8f0a2721fcc213fb893531f273b194c5e3d5c584 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sat, 26 Aug 2017 18:57:03 +0200 Subject: [PATCH 03/16] Using Conan in appveyor --- appveyor.yml | 23 +++++++++++++++++++---- conanfile.py | 11 +++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4fc068e7..73039e3e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,25 @@ -image: -- Visual Studio 2017 +image: Visual Studio 2017 + +shallow_clone: true + +environment: + VS150COMNTOOLS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\" + +before_build: +- cmd: mkdir envs && cd envs +- cmd: python -m virtualenv conan +- cmd: conan/Scripts/activate +- cmd: python -m pip install conan==0.26.0 +- cmd: cd .. +- cmd: conan remote add conan-pix4d https://api.bintray.com/conan/pix4d/conan +- cmd: mkdir c:\Users\appveyor\.conan\profiles +- cmd: printf "os=Windows\narch=x86\ncompiler=Visual Studio\ncompiler.version=15\ncompiler.runtime=MD\nbuild_type=Release\n" > c:\Users\appveyor\.conan\profiles\release +- cmd: cat c:\Users\appveyor\.conan\profiles\release build_script: - md build - cd build - - cmake -DEXIV2_ENABLE_XMP=OFF -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=OFF -DCMAKE_INSTALL_PREFIX=install .. + - conan install .. --build missing --profile release + - cmake -G "Visual Studio 15 2017 Win64" -T "host=x64" -DEXIV2_ENABLE_XMP=ON -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=ON -DCMAKE_INSTALL_PREFIX=install .. - cmake --build . --config Release - - cmake --build . --config Debug - cmake --build . --target install diff --git a/conanfile.py b/conanfile.py index 24428125..a2f6d443 100644 --- a/conanfile.py +++ b/conanfile.py @@ -5,7 +5,14 @@ class Exiv2Conan(ConanFile): settings = 'os', 'compiler', 'build_type', 'arch' generators = 'cmake' + def configure(self): + # Note : The linking in exiv2lib fails if we try to use the static version of libcurl. + # The libcurl CMake code is not mature enough and therefore the conan recipe for + # Windows also has some problems (since it uses CMake for configuring the project). + if os_info.is_windows: + self.options['libcurl'].shared = True + def requirements(self): self.requires('Expat/2.2.1@pix4d/stable') # From pix4d - self.requires('zlib/1.2.11@conan/stable') # From conan-center - self.requires('libcurl/7.47.1@lasote/stable') # From conan-transit (It also brings OpenSSL) + self.requires('zlib/1.2.8@lasote/stable') # From conan-center + self.requires('libcurl/7.50.3@lasote/stable') # From conan-transit (It also brings OpenSSL) From 557d056addc46c9ab19413c15481d8d39c900416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 27 Aug 2017 16:23:23 +0200 Subject: [PATCH 04/16] Fix linking issues with EXPAT and the xmp static library (on windows) --- xmpsdk/CMakeLists.txt | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt index 68a8eab3..e6e8dd3c 100644 --- a/xmpsdk/CMakeLists.txt +++ b/xmpsdk/CMakeLists.txt @@ -41,25 +41,33 @@ endforeach() # We generate a CMake OBJECT LIBRARY (a bunch of object files) add_library( xmp_object OBJECT ${XMPSRC} ) -target_include_directories(xmp_object PRIVATE ${EXPAT_INCLUDE_DIR}) -target_include_directories(xmp_object PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include) +target_include_directories(xmp_object + PRIVATE + ${EXPAT_INCLUDE_DIR} + ${CMAKE_SOURCE_DIR}/xmpsdk/include +) check_include_file( "stdint.h" EXV_HAVE_STDINT_H ) if (EXV_HAVE_STDINT_H) target_compile_definitions(xmp_object PUBLIC EXV_HAVE_STDINT_H) 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 +if ( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") + # 1123 - hide xmpsdk symbols + target_compile_definitions(xmp_object PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden ) +endif() + if( EXIV2_ENABLE_LIBXMP ) add_library(xmp STATIC $) - target_link_libraries(xmp PUBLIC ${EXPAT_LIBRARIES}) - target_include_directories(xmp PUBLIC ${EXPAT_INCLUDE_DIR}) - target_include_directories(xmp PUBLIC ${CMAKE_SOURCE_DIR}/xmpsdk/include) + target_link_libraries(xmp PUBLIC ${EXPAT_LIBRARY}) - # http://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang - if ( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") - # 1123 - hide xmpsdk symbols - target_compile_definitions(xmp PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden ) - endif() + # This is also needed for the xmp static library + target_include_directories(xmp PUBLIC ${EXPAT_INCLUDE_DIR}) + target_compile_definitions(xmp PUBLIC XML_STATIC) # 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel) install(TARGETS xmp From 95625bfce5751bf5220a7b93a5b746f2fb7cfce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 27 Aug 2017 17:39:41 +0200 Subject: [PATCH 05/16] Add WIN32_LEAN_AND_MEAN definition to solve some linking issues on windows --- config/compilerFlags.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/compilerFlags.cmake b/config/compilerFlags.cmake index dee3cfa0..c02a4139 100644 --- a/config/compilerFlags.cmake +++ b/config/compilerFlags.cmake @@ -58,4 +58,9 @@ if(MSVC) set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:MSVCRT") endif() + # Resolving Redefinition Errors Betwen ws2def.h and winsock.h: + # - http://www.zachburlingame.com/2011/05/resolving-redefinition-errors-betwen-ws2def-h-and-winsock-h/ + # - https://stackoverflow.com/questions/11040133/what-does-defining-win32-lean-and-mean-exclude-exactly + add_definitions(-DWIN32_LEAN_AND_MEAN) + endif() From dc79df8ee647179ac4e9caef3bcd4c2d4a969d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 27 Aug 2017 17:40:19 +0200 Subject: [PATCH 06/16] Only use CURL and SSH when their support is enabled --- src/CMakeLists.txt | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7635a2d4..a48dad9a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -207,24 +207,26 @@ target_include_directories(exiv2lib PUBLIC ) if (EXIV2_ENABLE_WEBREADY) - target_include_directories(exiv2lib SYSTEM - PUBLIC - ${CURL_INCLUDE_DIR} - ${SSH_INCLUDE_DIR} - ) - # TODO : There should not be needed to make this difference. Improve LIBCURL conan recipe - if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) - else() - target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES}) + if( EXIV2_ENABLE_SSH ) + target_include_directories(exiv2lib SYSTEM PUBLIC ${SSH_INCLUDE_DIR} ) + target_link_libraries( exiv2lib PUBLIC ${SSH_LIBRARIES}) + endif() + + if( EXIV2_ENABLE_CURL ) + target_include_directories(exiv2lib SYSTEM PUBLIC ${CURL_INCLUDE_DIR} ) + # TODO : There should not be needed to make this difference. Improve LIBCURL conan recipe + if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARY}) + #target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) + target_compile_definitions(exiv2lib PUBLIC ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) + else() + target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES}) + endif() + + target_compile_definitions (exiv2lib PUBLIC ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) endif() - target_link_libraries( exiv2lib PUBLIC ${SSH_LIBRARIES}) - target_compile_definitions (exiv2lib - PUBLIC - ${CONAN_COMPILE_DEFINITIONS_LIBCURL} - ) endif() if ( MSVC ) From 280f857e070740c352aed0d0dedc155bf7ea92db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 29 Aug 2017 22:08:23 +0200 Subject: [PATCH 07/16] Add *.pyc to the .gitignore file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b63261af..c0482fed 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.lo *.o *.swp +*.pyc .DS_Store config.log config.status From 9586164a8fdb302ca4fd66378d65082be64baa55 Mon Sep 17 00:00:00 2001 From: clanmills Date: Tue, 29 Aug 2017 21:09:24 +0100 Subject: [PATCH 08/16] Fix: https://github.com/Exiv2/exiv2/issues/45 Thank You to Steve for reporting, providing the patch and giving feedback that modifying ~/.exiv2 worked. --- src/canonmn.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/canonmn.cpp b/src/canonmn.cpp index cbfaad44..68684c1d 100644 --- a/src/canonmn.cpp +++ b/src/canonmn.cpp @@ -857,6 +857,7 @@ namespace Exiv2 { { 144, "Canon EF 35-135mm f/4-5.6 USM" }, { 145, "Canon EF 100-300mm f/4.5-5.6 USM" }, { 146, "Canon EF 70-210mm f/3.5-4.5 USM" }, + { 147, "Canon EF 35-135mm f/4-5.6 USM" }, { 148, "Canon EF 28-80mm f/3.5-5.6 USM" }, { 149, "Canon EF 100mm f/2 USM" }, From 2221a5c63082d4eca52f099d125a21d3c40bb16b Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sat, 26 Aug 2017 10:34:00 +0200 Subject: [PATCH 09/16] Make CMake code work with conan --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a48dad9a..89436937 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,7 +224,6 @@ if (EXIV2_ENABLE_WEBREADY) target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES}) endif() - target_compile_definitions (exiv2lib PUBLIC ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) endif() endif() From d2066047433e3d498ba3b395b7ad65f9a97b4181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Fri, 1 Sep 2017 17:41:12 +0200 Subject: [PATCH 10/16] Fix some compilation issues with the xmp --- xmpsdk/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt index e6e8dd3c..87144623 100644 --- a/xmpsdk/CMakeLists.txt +++ b/xmpsdk/CMakeLists.txt @@ -58,7 +58,8 @@ target_compile_definitions(xmp_object PRIVATE XML_STATIC) # http://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang if ( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") # 1123 - hide xmpsdk symbols - target_compile_definitions(xmp_object PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden ) + set_property(SOURCE ${XMPSRC} PROPERTY + COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden") endif() if( EXIV2_ENABLE_LIBXMP ) @@ -69,6 +70,10 @@ if( EXIV2_ENABLE_LIBXMP ) 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 COMPILE_FLAGS "-fPIC") + endif() + # 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel) install(TARGETS xmp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} From 7c044c8e87487ebefa04f873d61b56ad5cc4a62a Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sat, 2 Sep 2017 10:16:25 +0200 Subject: [PATCH 11/16] Use only one configuration per platform/compiler in travis --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 746856be..e91d3ddd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,10 +11,10 @@ os: - osx env: - - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release" # Default - - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF" # Default (Debug mode + static libs) + #- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release" # Default + #- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF" # Default (Debug mode + static libs) - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON" # All enabled - - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_XMP=OFF -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_LENSDATA=OFF" # All disabled + #- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_XMP=OFF -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_LENSDATA=OFF" # All disabled #- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_SSH=OFF" # WebReady without SSH nor CURL install: ./.travis/install.sh From 960335faea88a3e94fa05ebfcd2409c7e9df9d12 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sat, 2 Sep 2017 10:16:38 +0200 Subject: [PATCH 12/16] Use conan in travis --- .travis.yml | 5 +++++ .travis/install.sh | 16 ++++++++++++++++ .travis/run.sh | 2 ++ config/findDependencies.cmake | 1 + src/CMakeLists.txt | 7 +++---- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e91d3ddd..7fbf81c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,11 @@ os: - linux - osx +matrix: + exclude: + - os: osx + compiler: gcc + env: #- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release" # Default #- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF" # Default (Debug mode + static libs) diff --git a/.travis/install.sh b/.travis/install.sh index 52057cfc..7c249293 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -4,9 +4,25 @@ set -x if [[ "$(uname -s)" == 'Linux' ]]; then sudo apt-get install cmake zlib1g-dev libssh-dev libcurl4-openssl-dev gettext libexpat1-dev + sudo apt-get install python-pip + sudo pip install virtualenv else brew update brew install expat gettext libssh + brew install pyenv-virtualenv # By default it already has cmake 3.6.2 fi +virtualenv conan +source conan/bin/activate +pip install conan +conan --version +conan remote add conan-pix4d https://api.bintray.com/conan/pix4d/conan +mkdir -p ~/.conan/profiles + +if [[ "$(uname -s)" == 'Linux' ]]; then + printf "os=Linux\narch=x86_64\ncompiler=gcc\ncompiler.version=4.8\nbuild_type=Release\n" > ~/.conan/profiles/release +else + printf "os=Macos\narch=x86_64\ncompiler=apple-clang\ncompiler.version=7.3\nbuild_type=Release\n" > ~/.conan/profiles/release +fi + diff --git a/.travis/run.sh b/.travis/run.sh index 5b047c54..060b1106 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -3,7 +3,9 @@ set -e set -x +source conan/bin/activate mkdir build && cd build +conan install .. --build missing --profile release cmake ${CMAKE_OPTIONS} .. cmake -DCMAKE_INSTALL_PREFIX=install .. make -j diff --git a/config/findDependencies.cmake b/config/findDependencies.cmake index 7ece1132..16967763 100644 --- a/config/findDependencies.cmake +++ b/config/findDependencies.cmake @@ -3,6 +3,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/config/") # Check if the conan file exist to find the dependencies if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + set(USING_CONAN ON) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_set_find_paths() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89436937..ee18571c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -215,10 +215,9 @@ if (EXIV2_ENABLE_WEBREADY) if( EXIV2_ENABLE_CURL ) target_include_directories(exiv2lib SYSTEM PUBLIC ${CURL_INCLUDE_DIR} ) - # TODO : There should not be needed to make this difference. Improve LIBCURL conan recipe - if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARY}) - #target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) + + if (USING_CONAN) + target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) target_compile_definitions(exiv2lib PUBLIC ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) else() target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES}) From 1af1ce0229edef284d7f86e90b98843c28a9492a Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sun, 3 Sep 2017 17:51:33 +0200 Subject: [PATCH 13/16] Fix CMake + Conan integration on Windows --- src/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee18571c..6f4674fc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -217,7 +217,12 @@ if (EXIV2_ENABLE_WEBREADY) target_include_directories(exiv2lib SYSTEM PUBLIC ${CURL_INCLUDE_DIR} ) if (USING_CONAN) - target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) + # TODO : Improve libcurl recipe so we do not need to have all these conditionals here + if ( MSVC ) + target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBRARY}) + else() + target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) + endif() target_compile_definitions(exiv2lib PUBLIC ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) else() target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARIES}) From c8d4074ec3ab6701e59b9111937efc13350c37d5 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sun, 3 Sep 2017 17:58:12 +0200 Subject: [PATCH 14/16] Instructions about how to use conan --- README-CMAKE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README-CMAKE b/README-CMAKE index 46fbb1f6..7cae5a6f 100644 --- a/README-CMAKE +++ b/README-CMAKE @@ -179,5 +179,26 @@ We have two contributed CMake Build Environments: It is possible to use CMake/MinGW if you put in some effort. This is documented in TODO-CMAKE. +5 Using conan from bringing project dependencies +========================================= + +Conan is a portable package manager for c++ (https://www.conan.io/). We added the option to use it +in Exiv2 so you can get all the Exiv2 dependencies (Expat, Zlib, Libcurl, Libssh) in a very easy +way. Basically, all you need to do is to have conan installed on your system and run the command +`conan install` before calling CMake: + + $ mkdir build && cd build + $ conan install .. + $ cmake .. or cmake-gui .. + +Conan will search for the dependencies in different repositories. At the moment of writing this +text, the conan-expat is not available in the official conan repositories, so you have to add the +following remote to your conan configuration: + + $ conan remote add conan-pix4d https://api.bintray.com/conan/pix4d/conan + +To learn more about Conan, please visit their documentation page: http://docs.conan.io/en/latest/ + + # That's all Folks ## From 68d2c49fc56bf109e7523e2a591892220fbd0d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 3 Sep 2017 18:40:58 +0200 Subject: [PATCH 15/16] Fix typo --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6f4674fc..6c6f32b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -219,7 +219,7 @@ if (EXIV2_ENABLE_WEBREADY) if (USING_CONAN) # TODO : Improve libcurl recipe so we do not need to have all these conditionals here if ( MSVC ) - target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBRARY}) + target_link_libraries( exiv2lib PUBLIC ${CURL_LIBRARY}) else() target_link_libraries( exiv2lib PUBLIC ${CONAN_LIBS_LIBCURL}) endif() From c1c6c428343c445095eaeff8353e29385de031b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 3 Sep 2017 18:41:21 +0200 Subject: [PATCH 16/16] Do not use certain compiler flags on windows --- xmpsdk/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt index 87144623..35359e3b 100644 --- a/xmpsdk/CMakeLists.txt +++ b/xmpsdk/CMakeLists.txt @@ -56,7 +56,7 @@ endif() target_compile_definitions(xmp_object PRIVATE XML_STATIC) # http://stackoverflow.com/questions/10046114/in-cmake-how-can-i-test-if-the-compiler-is-clang -if ( NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") +if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # 1123 - hide xmpsdk symbols set_property(SOURCE ${XMPSRC} PROPERTY COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden") @@ -71,7 +71,7 @@ if( EXIV2_ENABLE_LIBXMP ) target_compile_definitions(xmp PUBLIC XML_STATIC) if (BUILD_SHARED_LIBS) - set_property(TARGET xmp_object PROPERTY COMPILE_FLAGS "-fPIC") + set_property(TARGET xmp_object PROPERTY POSITION_INDEPENDENT_CODE ON) endif() # 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel)