2015-09-12 05:26:19 +02:00
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
# Travis-ci ctest script for OpenJPEG project
|
|
|
|
# This will compile/run tests/upload to cdash OpenJPEG
|
|
|
|
# Results will be available at: http://my.cdash.org/index.php?project=OPENJPEG
|
|
|
|
# -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
2015-09-12 05:44:52 +02:00
|
|
|
set( ENV{LANG} en_US.UTF-8)
|
2015-10-10 17:25:50 +02:00
|
|
|
if($ENV{OPJ_BINARY_DIR})
|
|
|
|
set( CTEST_DASHBOARD_ROOT "$ENV{OPJ_BINARY_DIR}" )
|
2015-10-10 17:27:49 +02:00
|
|
|
else()
|
2015-10-10 17:25:50 +02:00
|
|
|
set( CTEST_DASHBOARD_ROOT "$ENV{PWD}/build" )
|
|
|
|
endif()
|
2015-10-10 18:15:28 +02:00
|
|
|
|
|
|
|
if("$ENV{TRAVIS_OS_NAME}" STREQUAL "windows")
|
|
|
|
set( CTEST_CMAKE_GENERATOR "NMake Makefiles")
|
2015-10-10 18:19:09 +02:00
|
|
|
set( CTEST_BUILD_COMMAND "nmake" )
|
2015-10-10 18:58:26 +02:00
|
|
|
set( JPYLYZER_EXT "exe" )
|
2015-10-10 18:15:28 +02:00
|
|
|
else()
|
|
|
|
set( CTEST_CMAKE_GENERATOR "Unix Makefiles") # Always makefile in travis-ci environment
|
2017-05-23 15:12:19 +02:00
|
|
|
set( CCFLAGS_WARNING "-Wall -Wextra -Wconversion -Wno-unused-parameter -Wdeclaration-after-statement -Werror=declaration-after-statement")
|
2015-10-10 18:58:26 +02:00
|
|
|
set( JPYLYZER_EXT "py" )
|
2015-10-10 18:15:28 +02:00
|
|
|
endif()
|
2015-09-12 05:44:52 +02:00
|
|
|
|
|
|
|
if ("$ENV{OPJ_BUILD_CONFIGURATION}" STREQUAL "")
|
|
|
|
set( CTEST_BUILD_CONFIGURATION "Release")
|
|
|
|
else()
|
|
|
|
set( CTEST_BUILD_CONFIGURATION "$ENV{OPJ_BUILD_CONFIGURATION}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if ("$ENV{OPJ_SITE}" STREQUAL "")
|
|
|
|
set( CTEST_SITE "Unknown")
|
|
|
|
else()
|
|
|
|
set( CTEST_SITE "$ENV{OPJ_SITE}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if ("$ENV{OPJ_BUILDNAME}" STREQUAL "")
|
|
|
|
set( CTEST_BUILD_NAME "Unknown-${CTEST_BUILD_CONFIGURATION}")
|
|
|
|
else()
|
|
|
|
set( CTEST_BUILD_NAME "$ENV{OPJ_BUILDNAME}")
|
|
|
|
endif()
|
2015-09-12 05:26:19 +02:00
|
|
|
|
2015-09-12 15:48:23 +02:00
|
|
|
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()
|
|
|
|
|
2017-06-21 12:28:51 +02:00
|
|
|
if (NOT "$ENV{OPJ_CI_INSTRUCTION_SETS}" STREQUAL "")
|
|
|
|
set(CCFLAGS_ARCH "${CCFLAGS_ARCH} $ENV{OPJ_CI_INSTRUCTION_SETS}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2015-09-12 16:36:19 +02:00
|
|
|
if ("$ENV{OPJ_CI_ASAN}" STREQUAL "1")
|
|
|
|
set(OPJ_HAS_MEMCHECK TRUE)
|
|
|
|
set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer")
|
2015-09-12 20:21:52 +02:00
|
|
|
set(CCFLAGS_ARCH "${CCFLAGS_ARCH} -O1 -g -fsanitize=address -fno-omit-frame-pointer")
|
2015-09-12 17:56:29 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if("$ENV{CC}" MATCHES ".*mingw.*")
|
|
|
|
# We are trying to use mingw
|
2015-09-12 18:21:25 +02:00
|
|
|
if ("$ENV{OPJ_CI_ARCH}" MATCHES "^i[3-6]86$")
|
|
|
|
set(CTEST_CONFIGURE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CTEST_SCRIPT_DIRECTORY}/toolchain-mingw32.cmake")
|
|
|
|
else()
|
|
|
|
set(CTEST_CONFIGURE_OPTIONS "-DCMAKE_TOOLCHAIN_FILE=${CTEST_SCRIPT_DIRECTORY}/toolchain-mingw64.cmake")
|
|
|
|
endif()
|
2015-09-12 16:36:19 +02:00
|
|
|
endif()
|
|
|
|
|
2015-09-12 15:52:13 +02:00
|
|
|
if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")
|
2016-05-02 16:03:16 +02:00
|
|
|
# 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
|
2015-09-12 15:52:13 +02:00
|
|
|
# at http://www.kakadusoftware.com.
|
|
|
|
# Here's the copyright notice from kakadu:
|
|
|
|
# Copyright is owned by NewSouth Innovations Pty Limited, commercial arm of the UNSW Australia in Sydney.
|
|
|
|
# You are free to trial these executables and even to re-distribute them,
|
|
|
|
# so long as such use or re-distribution is accompanied with this copyright notice and is not for commercial gain.
|
|
|
|
# Note: Binaries can only be used for non-commercial purposes.
|
|
|
|
if ("$ENV{OPJ_NONCOMMERCIAL}" STREQUAL "1" )
|
|
|
|
set(KDUPATH $ENV{PWD}/kdu)
|
2015-10-10 19:15:52 +02:00
|
|
|
if("$ENV{TRAVIS_OS_NAME}" STREQUAL "windows")
|
|
|
|
set(ENV{PATH} "$ENV{PATH};${KDUPATH}")
|
|
|
|
else()
|
|
|
|
set(ENV{LD_LIBRARY_PATH} ${KDUPATH})
|
|
|
|
set(ENV{PATH} $ENV{PATH}:${KDUPATH})
|
|
|
|
endif()
|
2015-09-12 15:52:13 +02:00
|
|
|
endif()
|
|
|
|
set(BUILD_TESTING "TRUE")
|
|
|
|
else()
|
|
|
|
set(BUILD_TESTING "FALSE")
|
|
|
|
endif(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")
|
2015-09-12 05:26:19 +02:00
|
|
|
|
2017-05-09 15:28:09 +02:00
|
|
|
|
|
|
|
if("$ENV{OPJ_CI_CHECK_STYLE}" STREQUAL "1")
|
|
|
|
set(BUILD_ASTYLE "TRUE")
|
|
|
|
else()
|
|
|
|
set(BUILD_ASTYLE "FALSE")
|
|
|
|
endif("$ENV{OPJ_CI_CHECK_STYLE}" STREQUAL "1")
|
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
# Options
|
2015-09-12 05:26:19 +02:00
|
|
|
set( CACHE_CONTENTS "
|
|
|
|
|
|
|
|
# Build kind
|
|
|
|
CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}
|
|
|
|
|
|
|
|
# Warning level
|
2015-10-10 18:24:57 +02:00
|
|
|
CMAKE_C_FLAGS:STRING= ${CCFLAGS_ARCH} ${CCFLAGS_WARNING}
|
2015-09-12 05:26:19 +02:00
|
|
|
|
2017-05-09 15:28:09 +02:00
|
|
|
# For astyle
|
|
|
|
CMAKE_CXX_FLAGS:STRING= ${CCFLAGS_ARCH}
|
|
|
|
|
2015-09-12 05:26:19 +02:00
|
|
|
# Use to activate the test suite
|
2015-09-12 15:52:13 +02:00
|
|
|
BUILD_TESTING:BOOL=${BUILD_TESTING}
|
2015-09-12 05:26:19 +02:00
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
# Build Thirdparty, useful but not required for test suite
|
2015-09-12 05:26:19 +02:00
|
|
|
BUILD_THIRDPARTY:BOOL=TRUE
|
|
|
|
|
|
|
|
# JPEG2000 test files are available with git clone https://github.com/uclouvain/openjpeg-data.git
|
|
|
|
OPJ_DATA_ROOT:PATH=$ENV{PWD}/data
|
|
|
|
|
2016-05-02 16:03:16 +02:00
|
|
|
# jpylyzer is available with on GitHub: https://github.com/openpreserve/jpylyzer
|
2015-10-10 18:58:26 +02:00
|
|
|
JPYLYZER_EXECUTABLE=$ENV{PWD}/jpylyzer/jpylyzer.${JPYLYZER_EXT}
|
2015-09-12 05:26:19 +02:00
|
|
|
|
2017-05-09 15:28:09 +02:00
|
|
|
# Enable astyle
|
|
|
|
WITH_ASTYLE:BOOL=${BUILD_ASTYLE}
|
2015-09-12 05:26:19 +02:00
|
|
|
" )
|
|
|
|
|
|
|
|
#---------------------
|
2016-05-02 16:03:16 +02:00
|
|
|
#1. openjpeg specific:
|
2015-09-12 05:26:19 +02:00
|
|
|
set( CTEST_PROJECT_NAME "OPENJPEG" )
|
|
|
|
if(NOT EXISTS $ENV{OPJ_SOURCE_DIR})
|
|
|
|
message(FATAL_ERROR "OPJ_SOURCE_DIR not defined or does not exist:$ENV{OPJ_SOURCE_DIR}")
|
|
|
|
endif()
|
|
|
|
set( CTEST_SOURCE_DIRECTORY "$ENV{OPJ_SOURCE_DIR}")
|
|
|
|
set( CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}")
|
|
|
|
|
|
|
|
#---------------------
|
|
|
|
# Files to submit to the dashboard
|
|
|
|
set (CTEST_NOTES_FILES
|
|
|
|
${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}
|
|
|
|
${CTEST_BINARY_DIRECTORY}/CMakeCache.txt )
|
|
|
|
|
|
|
|
ctest_empty_binary_directory( "${CTEST_BINARY_DIRECTORY}" )
|
|
|
|
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${CACHE_CONTENTS}")
|
|
|
|
|
|
|
|
# Perform a Experimental build
|
|
|
|
ctest_start(Experimental)
|
|
|
|
#ctest_update(SOURCE "${CTEST_SOURCE_DIRECTORY}")
|
2015-09-12 17:56:29 +02:00
|
|
|
ctest_configure(BUILD "${CTEST_BINARY_DIRECTORY}" OPTIONS "${CTEST_CONFIGURE_OPTIONS}")
|
2015-09-12 05:26:19 +02:00
|
|
|
ctest_read_custom_files(${CTEST_BINARY_DIRECTORY})
|
|
|
|
ctest_build(BUILD "${CTEST_BINARY_DIRECTORY}")
|
2015-09-12 15:52:13 +02:00
|
|
|
if(NOT "$ENV{OPJ_CI_SKIP_TESTS}" STREQUAL "1")
|
|
|
|
ctest_test(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2)
|
2015-09-12 16:36:19 +02:00
|
|
|
if(OPJ_HAS_MEMCHECK)
|
|
|
|
ctest_memcheck(BUILD "${CTEST_BINARY_DIRECTORY}" PARALLEL_LEVEL 2)
|
|
|
|
endif()
|
2015-09-12 15:52:13 +02:00
|
|
|
endif()
|
2015-09-12 05:26:19 +02:00
|
|
|
if ("$ENV{OPJ_DO_SUBMIT}" STREQUAL "1")
|
|
|
|
ctest_submit()
|
|
|
|
endif()
|
2015-09-12 19:32:05 +02:00
|
|
|
# Do not clean, we'll parse the log for known failure
|
|
|
|
#ctest_empty_binary_directory( "${CTEST_BINARY_DIRECTORY}" )
|