From 52c36b495597b8d07d39d070dd521ca4118113bd Mon Sep 17 00:00:00 2001 From: mayeut Date: Sat, 12 Sep 2015 15:48:23 +0200 Subject: [PATCH] Add 32 bit build --- .travis.yml | 10 ++++++++++ tools/ctest_scripts/travis-ci.cmake | 14 +++++++++++++- tools/travis-ci/install.sh | 7 ++----- tools/travis-ci/run.sh | 20 ++++++++++++++++---- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 93c970d9..c9b5282a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/tools/ctest_scripts/travis-ci.cmake b/tools/ctest_scripts/travis-ci.cmake index 826b0aa3..7c1c25ff 100644 --- a/tools/ctest_scripts/travis-ci.cmake +++ b/tools/ctest_scripts/travis-ci.cmake @@ -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 diff --git a/tools/travis-ci/install.sh b/tools/travis-ci/install.sh index 202be751..ceb77b8a 100755 --- a/tools/travis-ci/install.sh +++ b/tools/travis-ci/install.sh @@ -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) diff --git a/tools/travis-ci/run.sh b/tools/travis-ci/run.sh index 75c01dc9..7fdaec72 100755 --- a/tools/travis-ci/run.sh +++ b/tools/travis-ci/run.sh @@ -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}