Opened 15 years ago

Closed 13 years ago

#17 closed enhancement (fixed)

CMake build configuration for GeoTIFF

Reported by: mloskot Owned by: mloskot
Priority: normal Milestone:
Component: libgeotiff Version:
Keywords: cmake, build Cc:

Description

This is patch that brings CMake build configuration for GeoTIFF library (static and shared) and utility programs. The patch includes FindGeoTIFF.cmake module that can be used by end-users to detect GeoTIFF in their CMake-configured projects.

The configuration should be ready to use on Windows with Visual Studio compilers, however tests are needed. For Windows, it's easy to get Zlib, JPEG and PROJ.4 support using OSGeo4W packages.

If the patch is approved, I'm willing to maintain this CMake build configuration for GeoTIFF.

Example of building GeoTIFF using CMake after the patch is applied:

  • Prepare build location, preferable outside source tree
mloskot@dog:~/dev/libgeotiff/_svn$ mkdir build
mloskot@dog:~/dev/libgeotiff/_svn$ cd trunk
mloskot@dog:~/dev/libgeotiff/_svn/trunk$ svn up
At revision 1659.
mloskot@dog:~/dev/libgeotiff/_svn/trunk$ cd ../build
mloskot@dog:~/dev/libgeotiff/_svn/build$
  • Configure with custom installation prefix, PROJ.4 and libtiff detected automatically and libjpeg and libz requested explicitly. If verbose Makefiles are needed, add -DCMAKE_VERBOSE_MAKEFILE=ON option:
mloskot@dog:~/dev/libgeotiff/_svn/build$ cmake ../trunk \
-DCMAKE_INSTALL_PREFIX=$HOME/usr \
-DWITH_JPEG=ON -DWITH_ZLIB=ON
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for include files HAVE_STDIO_H
-- Looking for include files HAVE_STDIO_H - found
-- Looking for include files HAVE_STDLIB_H
-- Looking for include files HAVE_STDLIB_H - found
-- Looking for include files HAVE_STRING_H
-- Looking for include files HAVE_STRING_H - found
-- Found GeoTIFF CSV files in: /home/mloskot/dev/libgeotiff/_svn/trunk/csv
-- Enable in-code GeoTIFF EPSG tables: FALSE
-- Found TIFF: /usr/lib/libtiff.so
-- Looking for TIFFOpen
-- Looking for TIFFOpen - found
-- Looking for TIFFMergeFieldInfo
-- Looking for TIFFMergeFieldInfo - found
-- Found PROJ4: /usr/lib/libproj.so
-- Looking for projects.h header from PROJ.4 library - found
-- Found ZLIB: /usr/lib/libz.so
-- Found JPEG: /usr/lib/libjpeg.so
-- Generating geo_config.h header
-- Generating geo_config.h header - done
-- Adding GeoTIFF utilities to build
-- Adding GeoTIFF utilities to build - done: makegeo;listgeo;applygeo;geotifcp;csv2html
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mloskot/dev/libgeotiff/_svn/build
  • Build
mloskot@dog:~/dev/libgeotiff/_svn/build$ gmake
Scanning dependencies of target geotiff_archive
[  2%] Building C object CMakeFiles/geotiff_archive.dir/cpl_serv.c.o
[  5%] Building C object CMakeFiles/geotiff_archive.dir/cpl_csv.c.o
[  8%] Building C object CMakeFiles/geotiff_archive.dir/geo_extra.c.o
[ 10%] Building C object CMakeFiles/geotiff_archive.dir/geo_free.c.o
[ 13%] Building C object CMakeFiles/geotiff_archive.dir/geo_get.c.o
[ 16%] Building C object CMakeFiles/geotiff_archive.dir/geo_names.c.o
[ 18%] Building C object CMakeFiles/geotiff_archive.dir/geo_new.c.o
[ 21%] Building C object CMakeFiles/geotiff_archive.dir/geo_normalize.c.o
[ 24%] Building C object CMakeFiles/geotiff_archive.dir/geo_print.c.o
[ 27%] Building C object CMakeFiles/geotiff_archive.dir/geo_set.c.o
[ 29%] Building C object CMakeFiles/geotiff_archive.dir/geo_simpletags.c.o
[ 32%] Building C object CMakeFiles/geotiff_archive.dir/geo_tiffp.c.o
[ 35%] Building C object CMakeFiles/geotiff_archive.dir/geo_trans.c.o
[ 37%] Building C object CMakeFiles/geotiff_archive.dir/geo_write.c.o
[ 40%] Building C object CMakeFiles/geotiff_archive.dir/geotiff_proj4.c.o
Linking C static library bin/Debug/libgeotiff.a
[ 40%] Built target geotiff_archive
Scanning dependencies of target geotiff_library
[ 43%] Building C object CMakeFiles/geotiff_library.dir/cpl_serv.c.o
[ 45%] Building C object CMakeFiles/geotiff_library.dir/cpl_csv.c.o
[ 48%] Building C object CMakeFiles/geotiff_library.dir/geo_extra.c.o
[ 51%] Building C object CMakeFiles/geotiff_library.dir/geo_free.c.o
[ 54%] Building C object CMakeFiles/geotiff_library.dir/geo_get.c.o
[ 56%] Building C object CMakeFiles/geotiff_library.dir/geo_names.c.o
[ 59%] Building C object CMakeFiles/geotiff_library.dir/geo_new.c.o
[ 62%] Building C object CMakeFiles/geotiff_library.dir/geo_normalize.c.o
[ 64%] Building C object CMakeFiles/geotiff_library.dir/geo_print.c.o
[ 67%] Building C object CMakeFiles/geotiff_library.dir/geo_set.c.o
[ 70%] Building C object CMakeFiles/geotiff_library.dir/geo_simpletags.c.o
[ 72%] Building C object CMakeFiles/geotiff_library.dir/geo_tiffp.c.o
[ 75%] Building C object CMakeFiles/geotiff_library.dir/geo_trans.c.o
[ 78%] Building C object CMakeFiles/geotiff_library.dir/geo_write.c.o
[ 81%] Building C object CMakeFiles/geotiff_library.dir/geotiff_proj4.c.o
Linking C shared library bin/Debug/libgeotiff.so
[ 81%] Built target geotiff_library
Scanning dependencies of target xtiff
[ 83%] Building C object libxtiff/CMakeFiles/xtiff.dir/xtiff.c.o
Linking C static library ../bin/Debug/libxtiff.a
[ 83%] Built target xtiff
Scanning dependencies of target applygeo
[ 86%] Building C object bin/CMakeFiles/applygeo.dir/applygeo.c.o
Linking C executable Debug/applygeo
[ 86%] Built target applygeo
Scanning dependencies of target csv2html
[ 89%] Building C object bin/CMakeFiles/csv2html.dir/csv2html.c.o
[ 91%] Building C object bin/CMakeFiles/csv2html.dir/__/cpl_csv.c.o
Linking C executable Debug/csv2html
[ 91%] Built target csv2html
Scanning dependencies of target geotifcp
[ 94%] Building C object bin/CMakeFiles/geotifcp.dir/geotifcp.c.o
Linking C executable Debug/geotifcp
[ 94%] Built target geotifcp
Scanning dependencies of target listgeo
[ 97%] Building C object bin/CMakeFiles/listgeo.dir/listgeo.c.o
Linking C executable Debug/listgeo
[ 97%] Built target listgeo
Scanning dependencies of target makegeo
[100%] Building C object bin/CMakeFiles/makegeo.dir/makegeo.c.o
Linking C executable Debug/makegeo
[100%] Built target makegeo
  • Install run-time and development files
mloskot@dog:~/dev/libgeotiff/_svn/build$ gmake install
[ 40%] Built target geotiff_archive
[ 81%] Built target geotiff_library
[ 83%] Built target xtiff
[ 86%] Built target applygeo
[ 91%] Built target csv2html
[ 94%] Built target geotifcp
[ 97%] Built target listgeo
[100%] Built target makegeo
Install the project...
-- Install configuration: "Debug"
-- Installing: /home/mloskot/usr/share/doc/AUTHORS
-- Installing: /home/mloskot/usr/share/doc/ChangeLog
-- Installing: /home/mloskot/usr/share/doc/COPYING
-- Installing: /home/mloskot/usr/share/doc/INSTALL
-- Installing: /home/mloskot/usr/share/doc/LICENSE
-- Installing: /home/mloskot/usr/share/doc/README
-- Installing: /home/mloskot/usr/share/doc/README_BIN
-- Installing: /home/mloskot/usr/share/doc/README.WIN
-- Installing: /home/mloskot/usr/share/epsg_csv/alias.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/area.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/change.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/codes.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_axis.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_axis_name.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_operation.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_operation_method.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_operation_parameter.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_operation_parameter_value.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_operation_path.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_reference_system.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/coordinate_system.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/datum.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/ellipsoid.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/esri_datum_override.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/gcs.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/gcs.override.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/naming_system.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/pcs.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/pcs.override.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/prime_meridian.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/projop_wparm.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/stateplane.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/unit_of_measure.csv
-- Installing: /home/mloskot/usr/share/epsg_csv/version_history.csv
-- Installing: /home/mloskot/usr/include/geotiff.h
-- Installing: /home/mloskot/usr/include/geotiffio.h
-- Installing: /home/mloskot/usr/include/geovalues.h
-- Installing: /home/mloskot/usr/include/geonames.h
-- Installing: /home/mloskot/usr/include/geokeys.h
-- Installing: /home/mloskot/usr/include/geo_config.h
-- Installing: /home/mloskot/usr/include/geo_tiffp.h
-- Installing: /home/mloskot/usr/include/geo_keyp.h
-- Installing: /home/mloskot/usr/include/geo_normalize.h
-- Installing: /home/mloskot/usr/include/cpl_serv.h
-- Installing: /home/mloskot/usr/include/geo_simpletags.h
-- Installing: /home/mloskot/usr/include/epsg_datum.inc
-- Installing: /home/mloskot/usr/include/epsg_gcs.inc
-- Installing: /home/mloskot/usr/include/epsg_pm.inc
-- Installing: /home/mloskot/usr/include/epsg_units.inc
-- Installing: /home/mloskot/usr/include/geo_ctrans.inc
-- Installing: /home/mloskot/usr/include/epsg_ellipse.inc
-- Installing: /home/mloskot/usr/include/epsg_pcs.inc
-- Installing: /home/mloskot/usr/include/epsg_proj.inc
-- Installing: /home/mloskot/usr/include/epsg_vertcs.inc
-- Installing: /home/mloskot/usr/include/geokeys.inc
-- Installing: /home/mloskot/usr/lib/libgeotiff.a
-- Installing: /home/mloskot/usr/lib/libgeotiff.so
-- Installing: /home/mloskot/usr/bin/makegeo
-- Removed runtime path from "/home/mloskot/usr/bin/makegeo"
-- Installing: /home/mloskot/usr/bin/listgeo
-- Removed runtime path from "/home/mloskot/usr/bin/listgeo"
-- Installing: /home/mloskot/usr/bin/applygeo
-- Removed runtime path from "/home/mloskot/usr/bin/applygeo"
-- Installing: /home/mloskot/usr/bin/geotifcp
-- Removed runtime path from "/home/mloskot/usr/bin/geotifcp"
-- Installing: /home/mloskot/usr/bin/csv2html
-- Removed runtime path from "/home/mloskot/usr/bin/csv2html"
mloskot@dog:~/dev/libgeotiff/_svn/build$ 

Coments, tests and improvements are welcome.

Attachments (2)

cmake-config-for-geotiff-r1659.patch (18.8 KB ) - added by mloskot 15 years ago.
Patch with CMake build configuration for GeoTIFF
cmake-config-for-geotiff-r1671.patch (19.4 KB ) - added by mloskot 15 years ago.
Updated patch with CMake build configuration for GeoTIFF (added GEOTIFF_BUILD_PEDANTIC option)

Download all attachments as: .zip

Change History (4)

by mloskot, 15 years ago

Patch with CMake build configuration for GeoTIFF

by mloskot, 15 years ago

Updated patch with CMake build configuration for GeoTIFF (added GEOTIFF_BUILD_PEDANTIC option)

comment:1 by mloskot, 15 years ago

Owner: changed from warmerdam to mloskot

comment:2 by hobu, 13 years ago

Resolution: fixed
Status: newclosed

Added in r2005. I'll assume maintenance of this build system and will apply updates as necessary to keep it from bitrotting.

Note: See TracTickets for help on using tickets.