
Thread
2015.06.18 22:08 "Re: [Tiff] CMake support for building libtiff", by Roger Leigh
On 17/06/2015 22:38, Roger Leigh wrote:
On 16/06/2015 14:39, Roger Leigh wrote:
Would there be any interest in having support for building libtiff with CMake? This would allow for easier building on Windows and other platforms since it can generate build files for a whole host of different build tools and IDEs. For example, on Windows it generates project files for specific visual studio versions. On Unix it generates standard Makefiles. It also allows seamless integration of libtiff into libtiff-using projects (embedded directly or downloaded and build as a "superbuild"), and is quite a bit simpler to manage and use than the autotools (I switched after 15 years of autotools use).
I'm happy to do the work and submit this for inclusion. I just wanted to check if this was something which was of interest for others as well, and which wasn't totally objectionable to the maintainers.
Thanks all for the responses. I'll do this over the next few days. [It's not just for the sake of it; I need the support for a work project, in particular better Windows support.]
Just to give you an idea of what this will look like, I've attached the fruits of my days' labour, made against the 4.0.4 beta release. This is a conversion of
- configure.ac including all the portability checks and retaining exact compatibility WRT the header generation
- port/Makefile.am
- libtiff/Makefile.am
- tools/Makefile.am
- In other words, sufficient to build libtiff (shared and static) plus the tools. It doesn't have install rules yet, so "make install" does nothing.
To try out:
- apply the patch
- make a build directory and change into it
- run "cmake /path/to/libtiff/source"
- run "make"
I have now completed the conversion and I have attached a set of patches to add CMake support (against the 4.0.4 beta release). This has been tested on the following platforms:
- FreeBSD 10.1 / clang 3.4
- Linux (Ubuntu 15.04) / gcc 4.9
- MacOS X (10.10 with homebrew) / clang 3.5
- Windows (Visual Studio 2015 RC) / MSVC18
Note that I converted the shell-based testcases to use CMake natively. This means you can run all the unit tests on Windows for the first time (and they all pass).
Caveat: Visual Studio 2013 and earlier don't provide snprintf(3). libtiff builds but the tests and tools do not all build; unless there's a workaround, I'll need to selectively disable building of the tools and tests when using these versions.
I'd be very interested in any feedback, particularly from Windows users.
I'll follow up with a patch to disable the non-buildable components
tomorrow; you can just comment out the test/tools/contrib directories in the top-level CMakeLists.txt in the interim.
Regards,
Roger