From 960335faea88a3e94fa05ebfcd2409c7e9df9d12 Mon Sep 17 00:00:00 2001 From: Luis Diaz Mas Date: Sat, 2 Sep 2017 10:16:38 +0200 Subject: [PATCH] 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})