* .travis.yml, build/travis-ci: new files from

0001-ci-Add-Travis-support-for-Linux-builds-with-Autoconf.patch by
Roger Leigh (sent to mailing list on 2017-06-08)
This patch adds support for the Travis-CI service.

* .appveyor.yml: new file from
0002-ci-Add-AppVeyor-support.patch by Roger Leigh (sent to mailing
list on 2017-06-08)
This patch adds a .appveyor.yml file to the top-level.  This allows
one to opt in to having a branch built on Windows with Cygwin,
MinGW and MSVC automatically when a branch is pushed to GitHub,
GitLab, BitBucket or any other supported git hosting service.

* CMakeLists.txt, test/CMakeLists.txt, test/TiffTestCommon.cmake: apply
patch 0001-cmake-Improve-Cygwin-and-MingGW-test-support.patch from Roger
Leigh (sent to mailing list on 2017-06-08)
This patch makes the CMake build system support running the tests
with MinGW or Cygwin.
This commit is contained in:
Even Rouault 2017-06-08 20:46:10 +00:00
parent 1d658302f8
commit f2a3b02040
7 changed files with 268 additions and 13 deletions

103
.appveyor.yml Normal file
View File

@ -0,0 +1,103 @@
environment:
AV_PROJECTS: 'c:\projects'
AV_TIFF_DOWNLOAD: 'c:\projects\download'
AV_TIFF_SOURCE: 'c:\projects\libtiff'
AV_TIFF_BUILD: 'c:\projects\build'
AV_TIFF_INSTALL: 'c:\projects\install'
matrix:
- compiler: cygwin-cmake
generator: Unix Makefiles
shared: ON
- compiler: cygwin-cmake
generator: Unix Makefiles
shared: OFF
- compiler: mingw64-cmake
generator: Unix Makefiles
shared: ON
- compiler: mingw64-cmake
generator: Unix Makefiles
shared: OFF
- compiler: vc14-cmake
generator: Visual Studio 14 2015 Win64
shared: ON
- compiler: vc14-cmake
generator: Visual Studio 14 2015 Win64
shared: OFF
- compiler: vc14-nmake
cache:
- 'c:\projects\download -> appveyor.yml'
# Operating system (build VM template)
os: 'Visual Studio 2015'
# clone directory
clone_folder: 'c:\projects\libtiff'
clone_depth: 5
platform: x64
configuration: Release
init:
- git config --global core.autocrlf input
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_SOURCE%`) DO SET AV_TIFF_CYG_SOURCE=%%F'
- 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_INSTALL%`) DO SET AV_TIFF_CYG_INSTALL=%%F'
- 'if %compiler%==cygwin-cmake C:\Cygwin64\setup-x86_64 -q -R C:\Cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel'
- 'if %compiler%==cygwin-cmake set "PATH=C:\Cygwin64\bin;%PATH%"'
- 'if %compiler%==mingw64-cmake set "PATH=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%"'
- set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
- 'if %compiler%==mingw64-cmake set "PATH=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%"'
- 'if %compiler%==mingw64-cmake set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -DCMAKE_MAKE_PROGRAM=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\mingw32-make"'
- set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
- set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_INSTALL%"
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_CYG_SOURCE%'
- 'if %compiler%==cygwin-cmake set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'
- 'if %compiler%==vc14-nmake call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %platform%'
before_build:
- mkdir %AV_TIFF_BUILD%
- cd %AV_TIFF_BUILD%
- if NOT %compiler%==vc14-nmake echo Running cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_TIFF_CMAKE_SOURCE%
- 'if %compiler%==cygwin-cmake bash -c "cmake -G \"%generator%\" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%"'
- 'if %compiler%==mingw64-cmake cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
- 'if %compiler%==vc14-cmake cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
build_script:
- if NOT %compiler%==vc14-nmake cd %AV_TIFF_BUILD%
- if %compiler%==vc14-nmake cd %AV_TIFF_SOURCE%
- 'if %compiler%==cygwin-cmake bash -c "cmake --build . --config %configuration% --target install"'
- 'if %compiler%==mingw64-cmake cmake --build . --config %configuration% --target install'
- 'if %compiler%==vc14-cmake cmake --build . --config %configuration% --target install'
- 'if %compiler%==vc14-nmake nmake /f Makefile.vc EXTRAFLAGS=/DHAVE_SNPRINTF=1'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%\bin'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%\lib'
- 'if %compiler%==vc14-nmake mkdir %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy tools\*.exe %AV_TIFF_INSTALL%\bin'
- 'if %compiler%==vc14-nmake copy port\*.lib %AV_TIFF_INSTALL%\lib'
- 'if %compiler%==vc14-nmake copy libtiff\tiff.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffio.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffvers.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffconf.h %AV_TIFF_INSTALL%\include'
- 'if %compiler%==vc14-nmake copy libtiff\tiffio.hxx %AV_TIFF_INSTALL%\include'
# scripts to run after build
after_build:
- cd %AV_TIFF_BUILD%
- '7z a %AV_TIFF_SOURCE%\libtiff-build.zip * -tzip'
- cd %AV_TIFF_INSTALL%
- '7z a %AV_TIFF_SOURCE%\libtiff.zip * -tzip'
before_test:
- cd %AV_TIFF_BUILD%
- 'if %compiler%==cygwin-cmake bash -c "ctest -V -C %configuration%"'
- 'if %compiler%==mingw64-cmake ctest -V -C %configuration%'
- 'if %compiler%==vc14-cmake ctest -V -C %configuration%'
# vc14-nmake does not support unit tests
artifacts:
- path: libtiff.zip
name: libtiff.zip
- path: libtiff-build.zip
name: libtiff-build.zip

31
.travis.yml Normal file
View File

@ -0,0 +1,31 @@
language: c
sudo: false
dist: trusty
cache:
directories:
- download
addons:
apt_packages:
- libjpeg8-dev
- libjbig-dev
- liblzma-dev
- zlib1g-dev
compiler:
- gcc
- clang
env:
matrix:
- BUILD=autoconf
- BUILD=cmake TOOL="Unix Makefiles" TYPE=Release
- BUILD=cmake TOOL="Ninja" TYPE=Release
matrix:
fast_finish: true
script:
- ./build/travis-ci "$BUILD" "$TOOL" "$TYPE"

View File

@ -467,7 +467,7 @@ report_values(CMAKE_HOST_SYSTEM_PROCESSOR HOST_FILLORDER
HOST_BIG_ENDIAN HAVE_IEEEFP) HOST_BIG_ENDIAN HAVE_IEEEFP)
# Large file support # Large file support
if (UNIX) if (UNIX OR MINGW)
# This might not catch every possibility catered for by # This might not catch every possibility catered for by
# AC_SYS_LARGEFILE. # AC_SYS_LARGEFILE.
add_definitions(-D_FILE_OFFSET_BITS=64) add_definitions(-D_FILE_OFFSET_BITS=64)

View File

@ -1,3 +1,24 @@
2017-06-08 Even Rouault <even.rouault at spatialys.com>
* .travis.yml, build/travis-ci: new files from
0001-ci-Add-Travis-support-for-Linux-builds-with-Autoconf.patch by
Roger Leigh (sent to mailing list on 2017-06-08)
This patch adds support for the Travis-CI service.
* .appveyor.yml: new file from
0002-ci-Add-AppVeyor-support.patch by Roger Leigh (sent to mailing
list on 2017-06-08)
This patch adds a .appveyor.yml file to the top-level. This allows
one to opt in to having a branch built on Windows with Cygwin,
MinGW and MSVC automatically when a branch is pushed to GitHub,
GitLab, BitBucket or any other supported git hosting service.
* CMakeLists.txt, test/CMakeLists.txt, test/TiffTestCommon.cmake: apply
patch 0001-cmake-Improve-Cygwin-and-MingGW-test-support.patch from Roger
Leigh (sent to mailing list on 2017-06-08)
This patch makes the CMake build system support running the tests
with MinGW or Cygwin.
2017-06-08 Even Rouault <even.rouault at spatialys.com> 2017-06-08 Even Rouault <even.rouault at spatialys.com>
* libtiff/tif_swab.c: if DISABLE_CHECK_TIFFSWABMACROS is defined, do not do * libtiff/tif_swab.c: if DISABLE_CHECK_TIFFSWABMACROS is defined, do not do

90
build/travis-ci Normal file
View File

@ -0,0 +1,90 @@
#!/bin/sh
# This script is used for testing the build, primarily for use
# with travis, but may be used by hand as well.
set -e
set -x
# Test autoconf build
autoconf_build()
{
mkdir autoconf-build
cd autoconf-build
../configure --prefix=$(readlink -f ../autoconf-install)
make
make install
make check
}
# Install needed tools
cmake_deps()
{
mkdir -p download
mkdir -p tools
cmake_file="cmake-3.8.2-Linux-x86_64.tar.gz"
cmake_url="https://cmake.org/files/v3.8/${cmake_file}"
cmake_hash="574673d3f37b0be6a0813b894a8bce9c4af08c13f1ec25c030a69f42e0e4b349e0192385ef20c8a9271055b7c3b24c5b20fb5009762131a3fba3d17576e641f1"
ninja_file="ninja-linux.zip"
ninja_url="https://github.com/ninja-build/ninja/releases/download/v1.7.2/${ninja_file}"
ninja_hash="2dddc52750c5e6f841acd0d978b894c9a6562f12ddb4ba9e5118a213f54265f065682ffe1bc7bc2ac6146760145d17800a4b7373791cd1fbbaf0836faf050e19"
(
cd download
if [ ! -f "$cmake_file" ] || [ "$(sha512sum "$cmake_file")" != "$cmake_hash $cmake_file" ]; then
wget "$cmake_url"
if [ "$(sha512sum "$cmake_file")" != "$cmake_hash $cmake_file" ]; then
echo "Error: cmake download hash mismatch" >&2
exit 1
fi
fi
tar xf "$cmake_file"
cp -a ${cmake_file%.tar.gz}/* ../tools
if [ "$1" = "Ninja" ]; then
if [ ! -f "$ninja_file" ] || [ "$(sha512sum "$ninja_file")" != "$ninja_hash $ninja_file" ]; then
wget "$ninja_url"
if [ "$(sha512sum "$ninja_file")" != "$ninja_hash $ninja_file" ]; then
echo "Error: ninja download hash mismatch" >&2
exit 1
fi
fi
unzip "$ninja_file"
mv ninja ../tools/bin
fi
)
}
# Test autoconf build
cmake_build()
{
PATH="$(pwd)/tools/bin:$PATH"
mkdir cmake-build
cd cmake-build
cmake -G "$1" -DCMAKE_BUILD_TYPE="$2" -DCMAKE_INSTALL_PREFIX=../autoconf-install ..
cmake --build .
cmake --build . --target install
ctest -V
}
build=$1
shift
case $build in
autoconf)
echo "Testing Autoconf build"
autoconf_build "$@"
;;
cmake)
echo "Testing CMake build"
cmake_deps "$@"
cmake_build "$@"
;;
*)
echo "Invalid argument: \"$arg\"" >&2
exit 1
;;
esac
exit 0

View File

@ -185,6 +185,18 @@ target_link_libraries(custom_dir tiff port)
set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output") set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output")
file(MAKE_DIRECTORY "${TEST_OUTPUT}") file(MAKE_DIRECTORY "${TEST_OUTPUT}")
set(tiff_test_extra_args
"-DTIFFCP=$<TARGET_FILE:tiffcp>"
"-DTIFFINFO=$<TARGET_FILE:tiffinfo>"
"-DTIFFSPLIT=$<TARGET_FILE:tiffsplit>"
"-DLIBTIFF=$<TARGET_FILE:tiff>")
if(WIN32)
list(APPEND tiff_test_extra_args "-DWIN32=${WIN32}")
endif()
if(CYGWIN)
list(APPEND tiff_test_extra_args "-DCYGWIN=${CYGWIN}")
endif()
macro(tiff_test_convert name command1 command2 command3 infile outfile validate) macro(tiff_test_convert name command1 command2 command3 infile outfile validate)
add_test(NAME "${name}" add_test(NAME "${name}"
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
@ -193,9 +205,8 @@ macro(tiff_test_convert name command1 command2 command3 infile outfile validate)
"-DCONVERT_COMMAND3=${command3}" "-DCONVERT_COMMAND3=${command3}"
"-DINFILE=${infile}" "-DINFILE=${infile}"
"-DOUTFILE=${outfile}" "-DOUTFILE=${outfile}"
"-DTIFFINFO=$<TARGET_FILE:tiffinfo>"
"-DLIBTIFF=$<TARGET_FILE:tiff>"
"-DVALIDATE=${validate}" "-DVALIDATE=${validate}"
${tiff_test_extra_args}
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
endmacro() endmacro()
@ -205,8 +216,7 @@ macro(tiff_test_stdout name command infile outfile)
"-DSTDOUT_COMMAND=${command}" "-DSTDOUT_COMMAND=${command}"
"-DINFILE=${infile}" "-DINFILE=${infile}"
"-DOUTFILE=${outfile}" "-DOUTFILE=${outfile}"
"-DTIFFINFO=$<TARGET_FILE:tiffinfo>" ${tiff_test_extra_args}
"-DLIBTIFF=$<TARGET_FILE:tiff>"
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
endmacro() endmacro()
@ -215,8 +225,7 @@ macro(tiff_test_reader name command infile)
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
"-DREADER_COMMAND=${command}" "-DREADER_COMMAND=${command}"
"-DINFILE=${infile}" "-DINFILE=${infile}"
"-DTIFFINFO=$<TARGET_FILE:tiffinfo>" ${tiff_test_extra_args}
"-DLIBTIFF=$<TARGET_FILE:tiff>"
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake") -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
endmacro() endmacro()
@ -344,9 +353,7 @@ add_test(NAME "tiffcp-split"
"-DTESTFILES=${ESCAPED_UNCOMPRESSED}" "-DTESTFILES=${ESCAPED_UNCOMPRESSED}"
"-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-conjoined.tif" "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-conjoined.tif"
"-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-split-" "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-split-"
"-DTIFFCP=$<TARGET_FILE:tiffcp>" ${tiff_test_extra_args}
"-DTIFFSPLIT=$<TARGET_FILE:tiffsplit>"
"-DLIBTIFF=$<TARGET_FILE:tiff>"
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake")
add_test(NAME "tiffcp-split-join" add_test(NAME "tiffcp-split-join"
COMMAND "${CMAKE_COMMAND}" COMMAND "${CMAKE_COMMAND}"
@ -354,9 +361,7 @@ add_test(NAME "tiffcp-split-join"
"-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-join-conjoined.tif" "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-join-conjoined.tif"
"-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-join-split-" "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-join-split-"
"-DRECONJOINED=${TEST_OUTPUT}/tiffcp-split-join-reconjoined.tif" "-DRECONJOINED=${TEST_OUTPUT}/tiffcp-split-join-reconjoined.tif"
"-DTIFFCP=$<TARGET_FILE:tiffcp>" ${tiff_test_extra_args}
"-DTIFFSPLIT=$<TARGET_FILE:tiffsplit>"
"-DLIBTIFF=$<TARGET_FILE:tiff>"
-P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake") -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake")
# PDF # PDF

View File

@ -101,3 +101,8 @@ if(WIN32)
file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR) file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR)
set(ENV{PATH} "${LIBTIFF_DIR};$ENV{PATH}") set(ENV{PATH} "${LIBTIFF_DIR};$ENV{PATH}")
endif() endif()
if(CYGWIN)
get_filename_component(LIBTIFF_DIR "${LIBTIFF}" DIRECTORY)
file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR)
set(ENV{PATH} "${LIBTIFF_DIR}:$ENV{PATH}")
endif()