From 7607d9e8262d757e01c1c81fe5049b6294c9ba26 Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Fri, 9 May 2014 19:25:29 +0400 Subject: [PATCH 1/2] Add support of Travis CI. --- .travis.yml | 12 +++++++ autotest/travis/build-and-test.sh | 45 ++++++++++++++++++++++++ autotest/travis/install-build-depends.sh | 15 ++++++++ 3 files changed, 72 insertions(+) create mode 100644 .travis.yml create mode 100755 autotest/travis/build-and-test.sh create mode 100755 autotest/travis/install-build-depends.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b44bebc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: cpp +compiler: + - gcc + - clang +env: + - CONFIG=minimal + - CONFIG=full ; SSL=openssl + - CONFIG=full ; SSL=gnutls +install: + - autotest/travis/install-build-depends.sh +script: + - autotest/travis/build-and-test.sh diff --git a/autotest/travis/build-and-test.sh b/autotest/travis/build-and-test.sh new file mode 100755 index 0000000..4d9ac1f --- /dev/null +++ b/autotest/travis/build-and-test.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +set -x + +export CFLAGS="$(dpkg-buildflags --get CFLAGS) $(dpkg-buildflags --get CPPFLAGS)" +export LDFLAGS="$(dpkg-buildflags --get LDFLAGS) -Wl,--as-needed" + +mkdir -p builddir +cd builddir + +CMAKEOPTS=".. + -DCMAKE_INSTALL_PREFIX=/usr" + +if [ "${CONFIG}" = "full" ]; then + CMAKEOPTS="${CMAKEOPTS} + -DRELEASE=OFF + -DLOWLEVEL_DEBUG=ON + -DSSL_SUPPORT=ON + -DADC_STRESS=ON" +else + CMAKEOPTS="${CMAKEOPTS} + -DRELEASE=ON + -DLOWLEVEL_DEBUG=OFF + -DSSL_SUPPORT=OFF + -DADC_STRESS=OFF" +fi + +if [ "${SSL}" = "openssl" ]; then + CMAKEOPTS="${CMAKEOPTS} + -DUSE_OPENSSL=ON" +elif [ "${SSL}" = "gnutls" ]; then + CMAKEOPTS="${CMAKEOPTS} + -DUSE_OPENSSL=OFF" +fi + + +cmake ${CMAKEOPTS} \ + -DCMAKE_C_FLAGS="${CFLAGS}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" +make VERBOSE=1 + + +sudo make install +du -shc /etc/uhub/ /usr/bin/uhub* /usr/lib/uhub/ + diff --git a/autotest/travis/install-build-depends.sh b/autotest/travis/install-build-depends.sh new file mode 100755 index 0000000..bc1a04b --- /dev/null +++ b/autotest/travis/install-build-depends.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +sudo apt-get update -qq + +sudo apt-get install -qq cmake + +if [ "${CONFIG}" = "full" ]; then + sudo apt-get install -qq libsqlite3-dev +fi + +if [ "${SSL}" = "openssl" ]; then + sudo apt-get install -qq libssl-dev +elif [ "${SSL}" = "gnutls" ]; then + sudo apt-get install -qq libgnutls-dev +fi From e98b0ce3bbc19c70876c595281a4a7253ad47c8b Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Fri, 9 May 2014 19:52:30 +0400 Subject: [PATCH 2/2] Fix build with clang. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1fb764..5060fec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ set (adcclient_SOURCES add_library(adc STATIC ${adc_SOURCES}) add_library(network STATIC ${network_SOURCES}) add_library(utils STATIC ${utils_SOURCES}) -if(CMAKE_COMPILER_IS_GNUCC) +if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") set_target_properties(utils PROPERTIES COMPILE_FLAGS -fPIC) set_target_properties(network PROPERTIES COMPILE_FLAGS -fPIC) endif()