# Top-level CMakeLists.txt for the CMake-based build and test system
# of the AGG (Anti-Grain Geometry) library.

# Copyright (C) 2006 Werner Smekal
# Copyright (C) 2013-2014 Alan W. Irwin

# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
# by the Free Software Foundation; version 2 of the License.
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public License
# along with this file; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA

# CMakeLists.txt for the agg 2.5 library.  (AWI has double-checked that
# the agg_LIB_SRCS and agg_LIB_HDRS lists below are consistent with that
# version of agg.)
# This build system currently
# only makes the agg library (static/shared) but no executables
# Put this file in the main directory, create and cd into a build directory,
# and run this cmake command:
#    cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=../local ..
# or similar.

# It is a fatal error if no working C++ compiler is available to build
# the shapelib library and utilities
project(shapelib CXX)

message(STATUS "CMake version = ${CMAKE_VERSION}")
message(STATUS "CMAKE_SYSTEM = ${CMAKE_SYSTEM}")
message(STATUS "CMAKE_GENERATOR = ${CMAKE_GENERATOR}")
message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")

cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)

# libraries are all shared by default.
option(BUILD_SHARED_LIBS "Build shared libraries" ON)

set(
  agg_LIB_SRCS
    src/agg_arc.cpp
    src/agg_arrowhead.cpp
    src/agg_bezier_arc.cpp
    src/agg_bspline.cpp
    src/agg_curves.cpp
    src/agg_vcgen_contour.cpp
    src/agg_vcgen_dash.cpp
    src/agg_vcgen_markers_term.cpp
    src/agg_vcgen_smooth_poly1.cpp
    src/agg_vcgen_stroke.cpp
    src/agg_vcgen_bspline.cpp
    src/agg_gsv_text.cpp
    src/agg_image_filters.cpp
    src/agg_line_aa_basics.cpp
    src/agg_line_profile_aa.cpp
    src/agg_rounded_rect.cpp
    src/agg_sqrt_tables.cpp
    src/agg_embedded_raster_fonts.cpp
    src/agg_trans_affine.cpp
    src/agg_trans_warp_magnifier.cpp
    src/agg_trans_single_path.cpp
    src/agg_trans_double_path.cpp
    src/agg_vpgen_clip_polygon.cpp
    src/agg_vpgen_clip_polyline.cpp
    src/agg_vpgen_segmentator.cpp
    src/ctrl/agg_cbox_ctrl.cpp
    src/ctrl/agg_gamma_ctrl.cpp
    src/ctrl/agg_gamma_spline.cpp
    src/ctrl/agg_rbox_ctrl.cpp
    src/ctrl/agg_slider_ctrl.cpp
    src/ctrl/agg_spline_ctrl.cpp
    src/ctrl/agg_scale_ctrl.cpp
    src/ctrl/agg_polygon_ctrl.cpp
    src/ctrl/agg_bezier_ctrl.cpp
    gpc/gpc.c
)

set(
  agg_LIB_HDRS
    include/agg_alpha_mask_u8.h
    include/agg_arc.h
    include/agg_array.h
    include/agg_arrowhead.h
    include/agg_basics.h
    include/agg_bezier_arc.h
    include/agg_bitset_iterator.h
    include/agg_blur.h
    include/agg_bounding_rect.h
    include/agg_bspline.h
    include/agg_clip_liang_barsky.h
    include/agg_color_gray.h
    include/agg_color_rgba.h
    include/agg_config.h
    include/agg_conv_adaptor_vcgen.h
    include/agg_conv_adaptor_vpgen.h
    include/agg_conv_bspline.h
    include/agg_conv_clip_polygon.h
    include/agg_conv_clip_polyline.h
    include/agg_conv_close_polygon.h
    include/agg_conv_concat.h
    include/agg_conv_contour.h
    include/agg_conv_curve.h
    include/agg_conv_dash.h
    include/agg_conv_gpc.h
    include/agg_conv_marker.h
    include/agg_conv_marker_adaptor.h
    include/agg_conv_segmentator.h
    include/agg_conv_shorten_path.h
    include/agg_conv_smooth_poly1.h
    include/agg_conv_stroke.h
    include/agg_conv_transform.h
    include/agg_conv_unclose_polygon.h
    include/agg_curves.h
    include/agg_dda_line.h
    include/agg_ellipse.h
    include/agg_ellipse_bresenham.h
    include/agg_embedded_raster_fonts.h
    include/agg_font_cache_manager.h
    include/agg_gamma_functions.h
    include/agg_gamma_lut.h
    include/agg_glyph_raster_bin.h
    include/agg_gradient_lut.h
    include/agg_gsv_text.h
    include/agg_image_accessors.h
    include/agg_image_filters.h
    include/agg_line_aa_basics.h
    include/agg_math.h
    include/agg_math_stroke.h
    include/agg_path_length.h
    include/agg_path_storage.h
    include/agg_path_storage_integer.h
    include/agg_pattern_filters_rgba.h
    include/agg_pixfmt_amask_adaptor.h
    include/agg_pixfmt_gray.h
    include/agg_pixfmt_rgb.h
    include/agg_pixfmt_rgb_packed.h
    include/agg_pixfmt_rgba.h
    include/agg_pixfmt_transposer.h
    include/agg_rasterizer_cells_aa.h
    include/agg_rasterizer_compound_aa.h
    include/agg_rasterizer_outline.h
    include/agg_rasterizer_outline_aa.h
    include/agg_rasterizer_scanline_aa.h
    include/agg_rasterizer_sl_clip.h
    include/agg_renderer_base.h
    include/agg_renderer_markers.h
    include/agg_renderer_mclip.h
    include/agg_renderer_outline_aa.h
    include/agg_renderer_outline_image.h
    include/agg_renderer_primitives.h
    include/agg_renderer_raster_text.h
    include/agg_renderer_scanline.h
    include/agg_rendering_buffer.h
    include/agg_rendering_buffer_dynarow.h
    include/agg_rounded_rect.h
    include/agg_scanline_bin.h
    include/agg_scanline_boolean_algebra.h
    include/agg_scanline_p.h
    include/agg_scanline_storage_aa.h
    include/agg_scanline_storage_bin.h
    include/agg_scanline_u.h
    include/agg_shorten_path.h
    include/agg_simul_eq.h
    include/agg_span_allocator.h
    include/agg_span_converter.h
    include/agg_span_gouraud.h
    include/agg_span_gouraud_gray.h
    include/agg_span_gouraud_rgba.h
    include/agg_span_gradient.h
    include/agg_span_gradient_alpha.h
    include/agg_span_image_filter.h
    include/agg_span_image_filter_gray.h
    include/agg_span_image_filter_rgb.h
    include/agg_span_image_filter_rgba.h
    include/agg_span_interpolator_adaptor.h
    include/agg_span_interpolator_linear.h
    include/agg_span_interpolator_persp.h
    include/agg_span_interpolator_trans.h
    include/agg_span_pattern_gray.h
    include/agg_span_pattern_rgb.h
    include/agg_span_pattern_rgba.h
    include/agg_span_solid.h
    include/agg_span_subdiv_adaptor.h
    include/agg_trans_affine.h
    include/agg_trans_bilinear.h
    include/agg_trans_double_path.h
    include/agg_trans_perspective.h
    include/agg_trans_single_path.h
    include/agg_trans_viewport.h
    include/agg_trans_warp_magnifier.h
    include/agg_vcgen_bspline.h
    include/agg_vcgen_contour.h
    include/agg_vcgen_dash.h
    include/agg_vcgen_markers_term.h
    include/agg_vcgen_smooth_poly1.h
    include/agg_vcgen_stroke.h
    include/agg_vcgen_vertex_sequence.h
    include/agg_vertex_sequence.h
    include/agg_vpgen_clip_polygon.h
    include/agg_vpgen_clip_polyline.h
    include/agg_vpgen_segmentator.h
    include/ctrl/agg_bezier_ctrl.h
    include/ctrl/agg_cbox_ctrl.h
    include/ctrl/agg_ctrl.h
    include/ctrl/agg_gamma_ctrl.h
    include/ctrl/agg_gamma_spline.h
    include/ctrl/agg_polygon_ctrl.h
    include/ctrl/agg_rbox_ctrl.h
    include/ctrl/agg_scale_ctrl.h
    include/ctrl/agg_slider_ctrl.h
    include/ctrl/agg_spline_ctrl.h
    include/util/agg_color_conv.h
    include/util/agg_color_conv_rgb16.h
    include/util/agg_color_conv_rgb8.h
    include/platform/agg_platform_support.h
    include/platform/mac/agg_mac_pmap.h
    include/platform/win32/agg_win32_bmp.h
)

INCLUDE_DIRECTORIES(
  include
)


ADD_LIBRARY(
  agg
  ${agg_LIB_SRCS}
)

INSTALL(
  TARGETS
    agg
  ARCHIVE DESTINATION 
    lib
  LIBRARY DESTINATION 
    lib
  RUNTIME DESTINATION
    bin
)

INSTALL(
  FILES
    ${agg_LIB_HDRS}
  DESTINATION
    include/agg2
)
