Add 32 bit build
authormayeut <mayeut@users.noreply.github.com>
Sat, 12 Sep 2015 13:48:23 +0000 (15:48 +0200)
committermayeut <mayeut@users.noreply.github.com>
Sat, 12 Sep 2015 13:48:23 +0000 (15:48 +0200)
.travis.yml
tools/ctest_scripts/travis-ci.cmake
tools/travis-ci/install.sh
tools/travis-ci/run.sh

index 93c970d9bd82200cc43229f9c367523e432ee84b..c9b5282a503720520aa463602deb7a8bb923d0ef 100644 (file)
@@ -5,11 +5,21 @@ os:
 compiler:
   - gcc
   - clang
+env:
+  - OPJ_CI_ARCH=x86_64
+  - OPJ_CI_ARCH=i386
   
 matrix:
   exclude:
     - os: osx
       compiler: gcc
+    - compiler: clang
+      env: OPJ_CI_ARCH=x86
+  
+addons:
+  apt:
+    packages:
+      - gcc-multilib
 
 install:
   - ./tools/travis-ci/install.sh
index 826b0aa32f9d715b48df546e90e4406c641f3b5e..7c1c25ff1eec9d7d6471249b5e37043acaf0816b 100644 (file)
@@ -28,6 +28,18 @@ else()
        set( CTEST_BUILD_NAME "$ENV{OPJ_BUILDNAME}")
 endif()
 
+if (NOT "$ENV{OPJ_CI_ARCH}" STREQUAL "")
+       if (APPLE)
+         set(CCFLAGS_ARCH "-arch $ENV{OPJ_CI_ARCH}")
+       else()
+               if ("$ENV{OPJ_CI_ARCH}" MATCHES "^i[3-6]86$")
+                       set(CCFLAGS_ARCH "-m32 -march=$ENV{OPJ_CI_ARCH}")
+               elseif ("$ENV{OPJ_CI_ARCH}" STREQUAL "x86_64")
+                       set(CCFLAGS_ARCH "-m64")
+               endif()
+       endif()
+endif()
+
 # To execute part of the encoding test suite, kakadu binaries are needed to decode encoded image and compare 
 # it to the baseline. Kakadu binaries are freely available for non-commercial purposes 
 # at http://www.kakadusoftware.com.
@@ -49,7 +61,7 @@ set( CACHE_CONTENTS "
 CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}
 
 # Warning level
-CMAKE_C_FLAGS:STRING= -Wall -Wextra -Wconversion -Wno-unused-parameter -Wdeclaration-after-statement
+CMAKE_C_FLAGS:STRING= ${CCFLAGS_ARCH} -Wall -Wextra -Wconversion -Wno-unused-parameter -Wdeclaration-after-statement
 
 # Use to activate the test suite
 BUILD_TESTING:BOOL=TRUE
index 202be75168a3d3bb409d19408acf172f5e7f4263..ceb77b8ace105e000a3124bd8212cd17c70c00a2 100755 (executable)
@@ -17,14 +17,11 @@ function exit_handler ()
        exit "${exit_code}"
 }
 trap exit_handler EXIT
-trap exit ERR 
-
-# travis-ci doesn't dump cmake version in system info, let's print it 
-cmake --version
+trap exit ERR
 
 # We don't need anything for coverity scan builds
 
-if [ "${COVERITY_SCAN_BRANCH:-}" != 1 ]; then
+if [ "${COVERITY_SCAN_BRANCH:-}" != "1" ] && [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ]; then
 
        OPJ_SOURCE_DIR=$(cd $(dirname $0)/../.. && pwd)
 
index 75c01dc9c2ada23694680e1bba48e9a83761f129..7fdaec726999e6bc953d8e3bb824d23f54b136f7 100755 (executable)
@@ -55,10 +55,19 @@ elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then
        elif [ "${CC}" == "clang" ]; then
                OPJ_CC_VERSION=clang$(${CC} --version | grep version | sed 's/.*version \([^0-9.]*[0-9.]*\).*/\1/')
        else
-               echo "Compiler not supported: ${CC}"
+               echo "Compiler not supported: ${CC}"; exit 1
        fi
 else
-       echo "OS not supported: ${TRAVIS_OS_NAME}"
+       echo "OS not supported: ${TRAVIS_OS_NAME}"; exit 1
+fi
+
+if [ "${OPJ_CI_ARCH:-}" == "" ]; then
+       echo "Guessing build architecture"
+       MACHINE_ARCH=$(uname -m)
+       if [ "${MACHINE_ARCH}" == "x86_64" ]; then
+               export OPJ_CI_ARCH=x86_64
+       fi
+       echo "${OPJ_CI_ARCH}"
 fi
 
 if [ "${TRAVIS_BRANCH:-}" == "" ]; then
@@ -66,13 +75,13 @@ if [ "${TRAVIS_BRANCH:-}" == "" ]; then
        TRAVIS_BRANCH=$(git -C ${OPJ_SOURCE_DIR} branch | grep '*' | tr -d '*[[:blank:]]') #default to master
 fi
 
-OPJ_BUILDNAME=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-x86_64-${TRAVIS_BRANCH}
+OPJ_BUILDNAME=${OPJ_OS_NAME}-${OPJ_CC_VERSION}-${OPJ_CI_ARCH}-${TRAVIS_BRANCH}
 if [ "${TRAVIS_PULL_REQUEST:-}" != "false" ] && [ "${TRAVIS_PULL_REQUEST:-}" != "" ]; then
        OPJ_BUILDNAME=${OPJ_BUILDNAME}-pr${TRAVIS_PULL_REQUEST}
 fi
 OPJ_BUILDNAME=${OPJ_BUILDNAME}-${OPJ_BUILD_CONFIGURATION}-3rdP
 
-if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ] && [ -d kdu ]; then
+if [ "${OPJ_NONCOMMERCIAL:-}" == "1" ] && [ "${OPJ_CI_SKIP_TESTS:-}" != "1" ] && [ -d kdu ]; then
        echo "
 Testing will use Kakadu trial binaries. Here's the copyright notice from kakadu:
 Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
@@ -84,6 +93,9 @@ fi
 
 set -x
 # This will print configuration
+# travis-ci doesn't dump cmake version in system info, let's print it 
+cmake --version
+
 export OPJ_SITE=${OPJ_SITE}
 export OPJ_BUILDNAME=${OPJ_BUILDNAME}
 export OPJ_SOURCE_DIR=${OPJ_SOURCE_DIR}