2017.06.07 22:30 "[Tiff] [PATCH] Windows CI support for GitHub and AppVeyor", by Roger Leigh

2017.06.08 09:47 "Re: [Tiff] [PATCH] Windows CI support for GitHub and AppVeyor", by

On 2017-06-07 23:30, Roger Leigh wrote:

> Hi,
>
> Attached are two patches to improve the Windows support for libtiff.
>
> - 0001-cmake-Improve-Cygwin-and-MingGW-test-support.patch
> This patch makes the CMake build system support running the tests
> with MinGW or Cygwin
>
> - 0002-ci-Add-AppVeyor-support.patch

>   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.

Updated copies of the patch attached. I also added support for testing the nmake Makefile.vc build as well.

You can see this in action here: https://ci.appveyor.com/project/rleigh-codelibre/libtiff/build/1.0.43

Regards,
Roger

From 4cb0b53fbc12b202644427f386cf436fd309fcdd Mon Sep 17 00:00:00 2001 From: Roger Leigh <rleigh@codelibre.net> Date: Wed, 7 Jun 2017 23:04:04 +0100 Subject: [PATCH 1/2] cmake: Improve Cygwin and MingGW test support

---

 CMakeLists.txt            |  2 +-
 test/CMakeLists.txt       | 29 +++++++++++++++++------------
 test/TiffTestCommon.cmake |  5 +++++
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ee6fd46..52b5ae99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -467,7 +467,7 @@ report_values(CMAKE_HOST_SYSTEM_PROCESSOR HOST_FILLORDER
               HOST_BIG_ENDIAN HAVE_IEEEFP)

 # Large file support
-if (UNIX)
+if (UNIX OR MINGW)

   # This might not catch every possibility catered for by
   # AC_SYS_LARGEFILE.

   add_definitions(-D_FILE_OFFSET_BITS=64)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b9e373f9..731aa806 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -185,6 +185,18 @@ target_link_libraries(custom_dir tiff port)
 set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/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)
   add_test(NAME "${name}"
            COMMAND "${CMAKE_COMMAND}"
@@ -193,9 +205,8 @@ macro(tiff_test_convert name command1 command2 command3 infile outfile validate)
            "-DCONVERT_COMMAND3=${command3}"
            "-DINFILE=${infile}"
            "-DOUTFILE=${outfile}"

            "-DVALIDATE=${validate}"
+ ${tiff_test_extra_args}
            -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
 endmacro()

@@ -205,8 +216,7 @@ macro(tiff_test_stdout name command infile outfile)
            "-DSTDOUT_COMMAND=${command}"
            "-DINFILE=${infile}"
            "-DOUTFILE=${outfile}"

+ ${tiff_test_extra_args}
            -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
 endmacro()

@@ -215,8 +225,7 @@ macro(tiff_test_reader name command infile)
            COMMAND "${CMAKE_COMMAND}"
            "-DREADER_COMMAND=${command}"
            "-DINFILE=${infile}"

+ ${tiff_test_extra_args}
            -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
 endmacro()

@@ -344,9 +353,7 @@ add_test(NAME "tiffcp-split"
          "-DTESTFILES=${ESCAPED_UNCOMPRESSED}"

          "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-c

From 50bdbb8fbb0867dcf5423da46b9c5e8446a16a3c Mon Sep 17 00:00:00 2001

From: Roger Leigh <rleigh@dundee.ac.uk> Date: Wed, 7 Jun 2017 14:05:40 +0100 Subject: [PATCH 2/2] ci: Add AppVeyor support

---

 .appveyor.yml | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

 create mode 100644 .appveyor.yml

diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644

index 00000000..fb534236

--- /dev/null

+++ b/.appveyor.yml

@@ -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 -q -R C:\Cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel' -cmake C:\Cygwin64\setup-x86_64
+  - 'if %compiler%==cygwin "PATH=C:\Cygwin64\bin;%PATH%"' -cmake set
+  - 'if %compiler%==mingw "PATH=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%"' 64-cmake set
+  - set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
+  - 'if %compiler%==mingw "PATH=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%"' 64-cmake set
+  - 'if %compiler%==mingw "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"' 64-cmake set
+  - set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
+  - set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_INSTALL%"
+  - 'if %compiler%==cygwin "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_CYG_SOURCE%' -cmake set
+  - 'if %compiler%==cygwin "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'-cmake set

+ - '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_PR