diff --git a/agg-src/CMakeLists.txt b/agg-src/CMakeLists.txt index b7c53dcb..8a1fbcb8 100644 --- a/agg-src/CMakeLists.txt +++ b/agg-src/CMakeLists.txt @@ -3,7 +3,7 @@ PROJECT( antigrain ) # additional are modified Find routines SET ( CMAKE_MODULE_PATH "${antigrain_SOURCE_DIR}/bin" ) -CMAKE_MINIMUM_REQUIRED( VERSION 2.4.8 ) +CMAKE_MINIMUM_REQUIRED( VERSION 3.0 ) SET(AGG_MAJOR_VERSION 0 ) SET(AGG_MINOR_VERSION 1 ) @@ -28,6 +28,16 @@ OPTION( agg_USE_SDL_PLATFORM "Use SDL as platform" OFF) OPTION( agg_USE_PACK "Package Agg" OFF) OPTION( agg_USE_AGG2D "Agg 2D graphical context" OFF) OPTION( agg_USE_DEBUG "For debug version" OFF) +OPTION( agg_BUILD_EXAMPLES "Build the AGG examples" ON) +OPTION( agg_BUILD_DEMO "Build the AGG demo" ON) +OPTION( agg_BUILD_PLATFORM "Build the AGG platform helper" ON) +OPTION( agg_BUILD_CONTROLS "Build the AGG controls" ON) + +IF( agg_BUILD_DEMO OR agg_BUILD_EXAMPLES ) + MESSAGE(STATUS "Force enable the platform and controls helper due to Demo / Example being build.") + SET( agg_BUILD_PLATFORM ON CACHE BOOL "Build the AGG platform helper" FORCE) + SET( agg_BUILD_CONTROLS ON CACHE BOOL "Build the AGG controls" FORCE) +ENDIF( agg_BUILD_DEMO OR agg_BUILD_EXAMPLES ) IF( agg_USE_DEBUG ) #SET( PFDEBUG "d" ) @@ -83,110 +93,12 @@ IF ( ${CMAKE_GENERATOR} MATCHES "Borland Makefiles" ) ENDIF ( ${CMAKE_GENERATOR} MATCHES "Borland Makefiles" ) -################################################## -# Set all includes, flags, libraries, related to expat -################################################## - -IF( agg_USE_EXPAT ) - - FIND_PACKAGE( EXPAT ) - - IF(EXPAT_FOUND) - INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIRS}) - LINK_LIBRARIES(${EXPAT_LIBRARIES}) - ELSE(EXPAT_FOUND) - MESSAGE(SEND_ERROR "expat not found") - ENDIF(EXPAT_FOUND) -ENDIF( agg_USE_EXPAT ) - -################################################## -# Set all includes, flags, libraries, related to freetype -################################################## - -IF( agg_USE_FREETYPE ) - FIND_PACKAGE( Freetype ) - IF( FREETYPE_FOUND ) - INCLUDE_DIRECTORIES( ${FREETYPE_INCLUDE_DIRS} ) - LINK_LIBRARIES( ${FREETYPE_LIBRARIES} ) - LINK_DIRECTORIES( ${FREETYPE_LINK_DIR} ) - ELSE( FREETYPE_FOUND ) - MESSAGE(SEND_ERROR "freetype not found") - ENDIF( FREETYPE_FOUND ) -ENDIF( agg_USE_FREETYPE ) - -################################################## -# Set all includes, flags, libraries, related to SDL -################################################## - -FIND_PACKAGE( SDL QUIET ) -IF( SDL_FOUND ) - IF ( agg_USE_SDL_PLATFORM ) - INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR}) - LINK_LIBRARIES(${SDL_LIBRARY}) - ENDIF ( agg_USE_SDL_PLATFORM ) -ELSE( SDL_FOUND ) - IF ( agg_USE_SDL_PLATFORM ) - MESSAGE( "SDL libray was not found, disable agg_USE_SDL_PLATFORM please" ) - ENDIF ( agg_USE_SDL_PLATFORM ) -ENDIF( SDL_FOUND ) - -# the main include dir of Agg -INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/include ) -SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} include ) - -# freetype specific lib of Agg -IF( agg_USE_FREETYPE ) - INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/font_freetype ) - SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} font_freetype ) - ADD_DEFINITIONS( -DAGG_USE_FREETYPE ) - SET( AGG_FLAGS ${AGG_FLAGS} -DAGG_USE_FREETYPE ) - LINK_LIBRARIES( freetypefont ) - SET( AGG_LIBRARIES ${AGG_LIBRARIES} aggfontfreetype${PFDEBUG} ) -ENDIF( agg_USE_FREETYPE ) - -# GPC lib if used within Agg -IF ( agg_USE_GPC ) - INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/gpc ) - SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} gpc ) - ADD_DEFINITIONS( -DAGG_USE_GPC ) - SET( AGG_FLAGS ${AGG_FLAGS} -DAGG_USE_GPC ) - LINK_LIBRARIES( gpcbool ) - SET( AGG_LIBRARIES ${AGG_LIBRARIES} gpc${PFDEBUG} ) -ENDIF ( agg_USE_GPC ) - -# agg2d lib if used within Agg -IF ( agg_USE_AGG2D ) - INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/agg2d ) - SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} agg2d ) - ADD_DEFINITIONS( -DAGG_USE_AGG2D ) - OPTION( agg_USE_AGG2D_FREETYPE "Agg 2D graphical context uses freetype" OFF) - SET( AGG_FLAGS ${AGG_FLAGS} -DAGG_USE_AGG2D ) - LINK_LIBRARIES( agg2d ) - SET( AGG_LIBRARIES ${AGG_LIBRARIES} agg2d${PFDEBUG} ) -ENDIF ( agg_USE_AGG2D ) - -IF ( agg_USE_AGG2D_FREETYPE ) - ADD_DEFINITIONS( -DAGG2D_USE_FREETYPE ) - SET( AGG_FLAGS ${AGG_FLAGS} -DAGG2D_USE_FREETYPE ) -ENDIF ( agg_USE_AGG2D_FREETYPE ) - -# sld as platform or os -IF( SDL_FOUND AND agg_USE_SDL_PLATFORM ) - LINK_LIBRARIES( controls sdlplatform antigrain ) - SET( AGG_LIBRARIES ${AGG_LIBRARIES} aggctrl${PFDEBUG} aggsdlplatform${PFDEBUG} agg${PFDEBUG} ) -ELSE( SDL_FOUND AND agg_USE_SDL_PLATFORM ) - LINK_LIBRARIES( controls platform antigrain ) - SET( AGG_LIBRARIES ${AGG_LIBRARIES} aggctrl${PFDEBUG} aggplatform${PFDEBUG} agg${PFDEBUG} ) -ENDIF( SDL_FOUND AND agg_USE_SDL_PLATFORM ) - -SET( AGG_FLAGS ${AGG_FLAGS} CACHE STRING "Agg package flags" FORCE ) -SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} CACHE STRING "Agg package libs include paths" FORCE ) -SET( AGG_LIBRARY_DIRS ${AGG_LIBRARY_DIRS} CACHE STRING "Agg package libs directory paths" FORCE ) -SET( AGG_LIBRARIES ${AGG_LIBRARIES} CACHE STRING "Agg package libraries" FORCE ) ADD_SUBDIRECTORY( src ) -ADD_SUBDIRECTORY( examples ) +IF ( agg_BUILD_EXAMPLES ) + ADD_SUBDIRECTORY( examples ) +ENDIF( agg_BUILD_EXAMPLES ) CONFIGURE_FILE( ${antigrain_SOURCE_DIR}/bin/AggConfig.cmake.in ${antigrain_BINARY_DIR}/bin/AggConfig.cmake @@ -213,7 +125,9 @@ CONFIGURE_FILE( ${antigrain_SOURCE_DIR}/libagg.pc.in libagg.pc @ONLY ) -ADD_SUBDIRECTORY( myapp ) +IF ( agg_BUILD_DEMO ) + ADD_SUBDIRECTORY( myapp ) +ENDIF ( agg_BUILD_DEMO ) INSTALL( FILES ${antigrain_BINARY_DIR}/bin/AggConfigOutBuild.cmake DESTINATION "bin" RENAME AggConfig.cmake ) INSTALL( FILES ${antigrain_BINARY_DIR}/bin/AggConfig.cmake DESTINATION "bin" ) diff --git a/agg-src/examples/CMakeLists.txt b/agg-src/examples/CMakeLists.txt index 8d467207..25b1f6a9 100644 --- a/agg-src/examples/CMakeLists.txt +++ b/agg-src/examples/CMakeLists.txt @@ -3,24 +3,34 @@ ADD_EXECUTABLE( aa_demo ${WIN32GUI} aa_demo.cpp ) +TARGET_LINK_LIBRARIES( aa_demo antigrain ) + ADD_EXECUTABLE( aa_test ${WIN32GUI} aa_test.cpp ) +TARGET_LINK_LIBRARIES( aa_test antigrain ) + ADD_EXECUTABLE( alpha_gradient ${WIN32GUI} alpha_gradient.cpp ) +TARGET_LINK_LIBRARIES( alpha_gradient antigrain ) + ADD_EXECUTABLE( alpha_mask ${WIN32GUI} alpha_mask.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( alpha_mask antigrain ) + ADD_EXECUTABLE( alpha_mask2 ${WIN32GUI} alpha_mask.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( alpha_mask2 antigrain ) + ADD_EXECUTABLE( alpha_mask3 ${WIN32GUI} alpha_mask.cpp make_arrows.cpp @@ -28,108 +38,158 @@ ADD_EXECUTABLE( alpha_mask3 ${WIN32GUI} parse_lion.cpp ) +TARGET_LINK_LIBRARIES( alpha_mask3 antigrain ) + ADD_EXECUTABLE( bezier_div ${WIN32GUI} bezier_div.cpp interactive_polygon.cpp ) +TARGET_LINK_LIBRARIES( bezier_div antigrain ) + ADD_EXECUTABLE( blend_color ${WIN32GUI} blend_color.cpp ) +TARGET_LINK_LIBRARIES( blend_color antigrain ) + ADD_EXECUTABLE( blur ${WIN32GUI} blur.cpp ) +TARGET_LINK_LIBRARIES( blur antigrain ) + ADD_EXECUTABLE( bspline ${WIN32GUI} bspline.cpp interactive_polygon.cpp ) +TARGET_LINK_LIBRARIES( bspline antigrain ) + ADD_EXECUTABLE( circles ${WIN32GUI} circles.cpp ) +TARGET_LINK_LIBRARIES( circles antigrain ) + ADD_EXECUTABLE( component_rendering ${WIN32GUI} component_rendering.cpp ) +TARGET_LINK_LIBRARIES( component_rendering antigrain ) + ADD_EXECUTABLE( compositing ${WIN32GUI} compositing.cpp ) +TARGET_LINK_LIBRARIES( compositing antigrain ) + ADD_EXECUTABLE( compositing2 ${WIN32GUI} compositing2.cpp ) +TARGET_LINK_LIBRARIES( compositing2 antigrain ) + ADD_EXECUTABLE( conv_contour ${WIN32GUI} conv_contour.cpp ) +TARGET_LINK_LIBRARIES( conv_contour antigrain ) + ADD_EXECUTABLE( conv_dash_marker ${WIN32GUI} conv_dash_marker.cpp ) +TARGET_LINK_LIBRARIES( conv_dash_marker antigrain ) + ADD_EXECUTABLE( conv_stroke ${WIN32GUI} conv_stroke.cpp ) +TARGET_LINK_LIBRARIES( conv_stroke antigrain ) + ADD_EXECUTABLE( distortions ${WIN32GUI} distortions.cpp ) +TARGET_LINK_LIBRARIES( distortions antigrain ) + ADD_EXECUTABLE( flash_rasterizer ${WIN32GUI} flash_rasterizer.cpp ) +TARGET_LINK_LIBRARIES( flash_rasterizer antigrain ) + ADD_EXECUTABLE( flash_rasterizer2 ${WIN32GUI} flash_rasterizer2.cpp ) +TARGET_LINK_LIBRARIES( flash_rasterizer2 antigrain ) + IF ( agg_USE_FREETYPE ) ADD_EXECUTABLE( freetype_test ${WIN32GUI} freetype_test.cpp make_arrows.cpp make_gb_poly.cpp ) + + TARGET_LINK_LIBRARIES( freetype_test antigrain ) + ENDIF ( agg_USE_FREETYPE ) ADD_EXECUTABLE( gamma_correction ${WIN32GUI} gamma_correction.cpp ) +TARGET_LINK_LIBRARIES( gamma_correction antigrain ) + ADD_EXECUTABLE( gamma_ctrl ${WIN32GUI} gamma_ctrl.cpp ) +TARGET_LINK_LIBRARIES( gamma_ctrl antigrain ) + ADD_EXECUTABLE( gamma_tuner ${WIN32GUI} gamma_tuner.cpp ) +TARGET_LINK_LIBRARIES( gamma_tuner antigrain ) + ADD_EXECUTABLE( gouraud ${WIN32GUI} gouraud.cpp ) +TARGET_LINK_LIBRARIES( gouraud antigrain ) + ADD_EXECUTABLE( gouraud_mesh ${WIN32GUI} gouraud_mesh.cpp ) +TARGET_LINK_LIBRARIES( gouraud_mesh antigrain ) + IF ( agg_USE_GPC ) ADD_EXECUTABLE( gpc_test ${WIN32GUI} gpc_test.cpp make_arrows.cpp make_gb_poly.cpp ) + + TARGET_LINK_LIBRARIES( gpc_test antigrain ) + ENDIF ( agg_USE_GPC ) ADD_EXECUTABLE( gradients ${WIN32GUI} gradients.cpp ) +TARGET_LINK_LIBRARIES( gradients antigrain ) + ADD_EXECUTABLE( gradient_focal ${WIN32GUI} gradient_focal.cpp ) +TARGET_LINK_LIBRARIES( gradient_focal antigrain ) + ADD_EXECUTABLE( gradients_contour ${WIN32GUI} gradients_contour.cpp make_arrows.cpp @@ -137,139 +197,202 @@ ADD_EXECUTABLE( gradients_contour ${WIN32GUI} parse_lion.cpp ) +TARGET_LINK_LIBRARIES( gradients_contour antigrain ) + ADD_EXECUTABLE( graph_test ${WIN32GUI} graph_test.cpp ) +TARGET_LINK_LIBRARIES( graph_test antigrain ) + ADD_EXECUTABLE( idea ${WIN32GUI} idea.cpp ) +TARGET_LINK_LIBRARIES( idea antigrain ) + ADD_EXECUTABLE( image1 ${WIN32GUI} image1.cpp ) +TARGET_LINK_LIBRARIES( image1 antigrain ) + ADD_EXECUTABLE( image_alpha ${WIN32GUI} image_alpha.cpp ) +TARGET_LINK_LIBRARIES( image_alpha antigrain ) + ADD_EXECUTABLE( image_filters ${WIN32GUI} image_filters.cpp ) +TARGET_LINK_LIBRARIES( image_filters antigrain ) + ADD_EXECUTABLE( image_filters2 ${WIN32GUI} image_filters2.cpp ) +TARGET_LINK_LIBRARIES( image_filters2 antigrain ) + ADD_EXECUTABLE( image_fltr_graph ${WIN32GUI} image_fltr_graph.cpp ) + +TARGET_LINK_LIBRARIES( image_fltr_graph antigrain ) + ADD_EXECUTABLE( image_perspective ${WIN32GUI} image_perspective.cpp interactive_polygon.cpp ) +TARGET_LINK_LIBRARIES( image_perspective antigrain ) + ADD_EXECUTABLE( image_resample ${WIN32GUI} image_resample.cpp interactive_polygon.cpp ) +TARGET_LINK_LIBRARIES( image_resample antigrain ) + ADD_EXECUTABLE( image_transforms ${WIN32GUI} image_transforms.cpp ) +TARGET_LINK_LIBRARIES( image_transforms antigrain ) + ADD_EXECUTABLE( line_patterns ${WIN32GUI} line_patterns.cpp ) +TARGET_LINK_LIBRARIES( line_patterns antigrain ) + ADD_EXECUTABLE( line_patterns_clip ${WIN32GUI} line_patterns_clip.cpp ) +TARGET_LINK_LIBRARIES( line_patterns_clip antigrain ) + ADD_EXECUTABLE( lion ${WIN32GUI} lion.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( lion antigrain ) + ADD_EXECUTABLE( lion_lens ${WIN32GUI} lion_lens.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( lion_lens antigrain ) + ADD_EXECUTABLE( lion_outline ${WIN32GUI} lion_outline.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( lion_outline antigrain ) + ADD_EXECUTABLE( mol_view ${WIN32GUI} mol_view.cpp ) +TARGET_LINK_LIBRARIES( mol_view antigrain ) + ADD_EXECUTABLE( multi_clip ${WIN32GUI} multi_clip.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( multi_clip antigrain ) + ADD_EXECUTABLE( pattern_fill ${WIN32GUI} pattern_fill.cpp ) +TARGET_LINK_LIBRARIES( pattern_fill antigrain ) + ADD_EXECUTABLE( pattern_perspective ${WIN32GUI} pattern_perspective.cpp interactive_polygon.cpp ) +TARGET_LINK_LIBRARIES( pattern_perspective antigrain ) + ADD_EXECUTABLE( pattern_resample ${WIN32GUI} pattern_resample.cpp interactive_polygon.cpp ) +TARGET_LINK_LIBRARIES( pattern_resample antigrain ) + ADD_EXECUTABLE( perspective ${WIN32GUI} perspective.cpp interactive_polygon.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( perspective antigrain ) + ADD_EXECUTABLE( polymorphic_renderer ${WIN32GUI} polymorphic_renderer.cpp ) +TARGET_LINK_LIBRARIES( polymorphic_renderer antigrain ) + ADD_EXECUTABLE( rasterizers ${WIN32GUI} rasterizers.cpp ) +TARGET_LINK_LIBRARIES( rasterizers antigrain ) + ADD_EXECUTABLE( rasterizers2 ${WIN32GUI} rasterizers2.cpp ) +TARGET_LINK_LIBRARIES( rasterizers2 antigrain ) + ADD_EXECUTABLE( rasterizer_compound ${WIN32GUI} rasterizer_compound.cpp ) +TARGET_LINK_LIBRARIES( rasterizer_compound antigrain ) + ADD_EXECUTABLE( raster_text ${WIN32GUI} raster_text.cpp ) +TARGET_LINK_LIBRARIES( raster_text antigrain ) + ADD_EXECUTABLE( rounded_rect ${WIN32GUI} rounded_rect.cpp ) +TARGET_LINK_LIBRARIES( rounded_rect antigrain ) + ADD_EXECUTABLE( scanline_boolean ${WIN32GUI} scanline_boolean.cpp interactive_polygon.cpp ) +TARGET_LINK_LIBRARIES( scanline_boolean antigrain ) + ADD_EXECUTABLE( scanline_boolean2 ${WIN32GUI} scanline_boolean2.cpp make_arrows.cpp make_gb_poly.cpp ) +TARGET_LINK_LIBRARIES( scanline_boolean2 antigrain ) + ADD_EXECUTABLE( simple_blur ${WIN32GUI} simple_blur.cpp parse_lion.cpp ) +TARGET_LINK_LIBRARIES( simple_blur antigrain ) + IF(WIN32) ADD_EXECUTABLE( trans_curve1 ${WIN32GUI} @@ -277,21 +400,29 @@ IF(WIN32) interactive_polygon.cpp ) + TARGET_LINK_LIBRARIES( trans_curve1 antigrain ) + ADD_EXECUTABLE( trans_curve2 ${WIN32GUI} trans_curve2.cpp interactive_polygon.cpp ) + TARGET_LINK_LIBRARIES( trans_curve2 antigrain ) + ADD_EXECUTABLE( truetype_test ${WIN32GUI} truetype_test.cpp ) + TARGET_LINK_LIBRARIES( truetype_test antigrain ) + ENDIF(WIN32) ADD_EXECUTABLE( trans_polar ${WIN32GUI} trans_polar.cpp ) +TARGET_LINK_LIBRARIES( trans_polar antigrain ) + IF ( agg_USE_EXPAT ) ADD_EXECUTABLE( svg_test ${WIN32GUI} ./svg_viewer/svg_test.cpp @@ -303,6 +434,9 @@ IF ( agg_USE_EXPAT ) ./svg_viewer/agg_svg_path_tokenizer.cpp ./svg_viewer/agg_svg_path_tokenizer.h ) + + TARGET_LINK_LIBRARIES( svg_test antigrain ) + ENDIF ( agg_USE_EXPAT ) IF(WIN32) @@ -316,12 +450,18 @@ IF(WIN32) parse_lion.cpp ) + + TARGET_LINK_LIBRARIES( pure_api antigrain ) + ENDIF(WIN32) IF( agg_USE_AGG2D ) ADD_EXECUTABLE( agg2_demo ${WIN32GUI} agg2d_demo.cpp ) + + TARGET_LINK_LIBRARIES( agg2_demo antigrain ) + ENDIF( agg_USE_AGG2D ) diff --git a/agg-src/src/CMakeLists.txt b/agg-src/src/CMakeLists.txt index 1e38890a..5cc05705 100644 --- a/agg-src/src/CMakeLists.txt +++ b/agg-src/src/CMakeLists.txt @@ -1,7 +1,3 @@ -SET( util_HEADERS - ${antigrain_SOURCE_DIR}/include/util/agg_color_conv_rgb8.h - ${antigrain_SOURCE_DIR}/include/util/agg_color_conv_rgb16.h - ${antigrain_SOURCE_DIR}/include/util/agg_color_conv.h ) SET( antigrain_HEADERS ${antigrain_SOURCE_DIR}/include/agg_alpha_mask_u8.h @@ -163,123 +159,219 @@ ADD_LIBRARY( antigrain ) #controls code for interactive modifying samples -SET( controls_HEADERS - ${antigrain_SOURCE_DIR}/include/ctrl/agg_slider_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_spline_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_scale_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_rbox_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_polygon_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_gamma_spline.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_gamma_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_cbox_ctrl.h - ${antigrain_SOURCE_DIR}/include/ctrl/agg_bezier_ctrl.h -) +IF( agg_BUILD_CONTROLS ) + SET( controls_HEADERS + ${antigrain_SOURCE_DIR}/include/ctrl/agg_slider_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_spline_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_scale_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_rbox_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_polygon_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_gamma_spline.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_gamma_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_cbox_ctrl.h + ${antigrain_SOURCE_DIR}/include/ctrl/agg_bezier_ctrl.h + ) -ADD_LIBRARY( controls - ctrl/agg_spline_ctrl.cpp - ctrl/agg_slider_ctrl.cpp - ctrl/agg_scale_ctrl.cpp - ctrl/agg_rbox_ctrl.cpp - ctrl/agg_polygon_ctrl.cpp - ctrl/agg_gamma_spline.cpp - ctrl/agg_gamma_ctrl.cpp - ctrl/agg_cbox_ctrl.cpp - ctrl/agg_bezier_ctrl.cpp - - ${controls_HEADERS} -) + ADD_LIBRARY( controls + ctrl/agg_spline_ctrl.cpp + ctrl/agg_slider_ctrl.cpp + ctrl/agg_scale_ctrl.cpp + ctrl/agg_rbox_ctrl.cpp + ctrl/agg_polygon_ctrl.cpp + ctrl/agg_gamma_spline.cpp + ctrl/agg_gamma_ctrl.cpp + ctrl/agg_cbox_ctrl.cpp + ctrl/agg_bezier_ctrl.cpp + + ${controls_HEADERS} + ) + TARGET_INCLUDE_DIRECTORIES( controls PRIVATE ${antigrain_SOURCE_DIR}/include ) + TARGET_INCLUDE_DIRECTORIES( controls PUBLIC ${antigrain_SOURCE_DIR}/include/ctrl ) + TARGET_LINK_LIBRARIES( antigrain PUBLIC controls ) + +ENDIF( agg_BUILD_CONTROLS ) + +# the main include dir of Agg +TARGET_INCLUDE_DIRECTORIES( antigrain PUBLIC ${antigrain_SOURCE_DIR}/include ) +SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} include ) + +################################################## +# Set all includes, flags, libraries, related to expat +################################################## -#freetype library +IF( agg_USE_EXPAT ) + + FIND_PACKAGE( EXPAT ) + + IF(EXPAT_FOUND) + TARGET_INCLUDE_DIRECTORIES( antigrain PUBLIC ${EXPAT_INCLUDE_DIRS}) + TARGET_LINK_LIBRARIES( antigrain PUBLIC ${EXPAT_LIBRARIES}) + ELSE(EXPAT_FOUND) + MESSAGE(SEND_ERROR "expat not found") + ENDIF(EXPAT_FOUND) +ENDIF( agg_USE_EXPAT ) + + + + + +################################################## +# Set all includes, flags, libraries, related to freetype +################################################## IF ( agg_USE_FREETYPE ) + FIND_PACKAGE( Freetype ) + IF( FREETYPE_FOUND ) - INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/font_freetype ) + ADD_LIBRARY( freetypefont + ../font_freetype/agg_font_freetype.h + ../font_freetype/agg_font_freetype.cpp + ) + TARGET_INCLUDE_DIRECTORIES( freetypefont PUBLIC ${FREETYPE_INCLUDE_DIRS} ) + TARGET_LINK_LIBRARIES( freetypefont PUBLIC ${FREETYPE_LIBRARIES} ) + TARGET_LINK_DIRECTORIES( freetypefont PUBLIC ${FREETYPE_LINK_DIR} ) + SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} font_freetype ) + TARGET_COMPILE_DEFINITIONS( freetypefont PUBLIC -DAGG_USE_FREETYPE ) + SET( AGG_FLAGS ${AGG_FLAGS} -DAGG_USE_FREETYPE ) + TARGET_LINK_DIRECTORIES( antigrain PUBLIC freetypefont ) + SET( AGG_LIBRARIES ${AGG_LIBRARIES} aggfontfreetype${PFDEBUG} ) + TARGET_INCLUDE_DIRECTORIES( freetypefont PUBLIC ${antigrain_SOURCE_DIR}/font_freetype ) + SET_TARGET_PROPERTIES( freetypefont PROPERTIES OUTPUT_NAME aggfontfreetype${PFDEBUG} ) - ADD_LIBRARY( freetypefont - ../font_freetype/agg_font_freetype.h - ../font_freetype/agg_font_freetype.cpp - ) - SET_TARGET_PROPERTIES( freetypefont PROPERTIES OUTPUT_NAME aggfontfreetype${PFDEBUG} ) - INSTALL( TARGETS freetypefont DESTINATION lib ) - INSTALL( FILES ../font_freetype/agg_font_freetype.h DESTINATION agg/font_freetype ) + INSTALL( TARGETS freetypefont DESTINATION lib ) + INSTALL( FILES ../font_freetype/agg_font_freetype.h DESTINATION agg/font_freetype ) + ELSE( FREETYPE_FOUND ) + MESSAGE(SEND_ERROR "freetype not found") + ENDIF( FREETYPE_FOUND ) ENDIF ( agg_USE_FREETYPE ) #platform stuff to ease sample use -SET( platform_HEADERS - ${antigrain_SOURCE_DIR}/include/platform/agg_platform_support.h -) +IF( agg_BUILD_PLATFORM ) + SET( platform_HEADERS + ${antigrain_SOURCE_DIR}/include/platform/agg_platform_support.h + ) -IF(WIN32) - INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/font_win32_tt ) + IF(WIN32) - ADD_LIBRARY( platform - ../src/platform/win32/agg_win32_bmp.cpp - ../src/platform/win32/agg_platform_support.cpp - ../font_win32_tt/agg_font_win32_tt.cpp + ADD_LIBRARY( platform + ../src/platform/win32/agg_win32_bmp.cpp + ../src/platform/win32/agg_platform_support.cpp + ../font_win32_tt/agg_font_win32_tt.cpp - ${platform_HEADERS} - ) - INSTALL( FILES ../font_win32_tt/agg_font_win32_tt.h DESTINATION agg/font_win32_tt ) -ENDIF(WIN32) -IF(UNIX) - ADD_LIBRARY( platform - ../src/platform/X11/agg_platform_support.cpp + ${platform_HEADERS} + ) + TARGET_INCLUDE_DIRECTORIES( platform PRIVATE ${antigrain_SOURCE_DIR}/include ) + TARGET_INCLUDE_DIRECTORIES( platform PUBLIC ${antigrain_SOURCE_DIR}/font_win32_tt ) + INSTALL( FILES ../font_win32_tt/agg_font_win32_tt.h DESTINATION agg/font_win32_tt ) + ENDIF(WIN32) + IF(UNIX) + ADD_LIBRARY( platform + ../src/platform/X11/agg_platform_support.cpp - ${platform_HEADERS} - ) -ENDIF(UNIX) -IF(APPLE) - ADD_LIBRARY( platform - ../src/platform/mac/agg_mac_pmap.cpp - ../src/platform/mac/agg_platform_support.cpp + ${platform_HEADERS} + ) + ENDIF(UNIX) + IF(APPLE) + ADD_LIBRARY( platform + ../src/platform/mac/agg_mac_pmap.cpp + ../src/platform/mac/agg_platform_support.cpp - ${platform_HEADERS} - ) -ENDIF(APPLE) + ${platform_HEADERS} + ) + ENDIF(APPLE) -IF( SDL_FOUND AND agg_USE_SDL_PLATFORM ) - ADD_LIBRARY( sdlplatform - ../src/platform/sdl/agg_platform_support.cpp + ################################################## + # Set all includes, flags, libraries, related to SDL + ################################################## + FIND_PACKAGE( SDL QUIET ) + IF( SDL_FOUND ) + IF ( agg_USE_SDL_PLATFORM ) + SET( AGG_LIBRARIES ${AGG_LIBRARIES} aggctrl${PFDEBUG} aggsdlplatform${PFDEBUG} agg${PFDEBUG} ) - ${platform_HEADERS} - ) - INSTALL( TARGETS sdlplatform DESTINATION lib ) - SET_TARGET_PROPERTIES( sdlplatform PROPERTIES OUTPUT_NAME aggsdlplatform${PFDEBUG} ) -ENDIF( SDL_FOUND AND agg_USE_SDL_PLATFORM ) + ADD_LIBRARY( sdlplatform + ../src/platform/sdl/agg_platform_support.cpp + + ${platform_HEADERS} + ) + TARGET_INCLUDE_DIRECTORIES( sdlplatform PUBLIC ${SDL_INCLUDE_DIR}) + TARGET_LINK_LIBRARIES( sdlplatform PUBLIC ${SDL_LIBRARY}) + TARGET_LINK_LIBRARIES( antigrain PUBLIC sdlplatform) + INSTALL( TARGETS sdlplatform DESTINATION lib ) + SET_TARGET_PROPERTIES( sdlplatform PROPERTIES OUTPUT_NAME aggsdlplatform${PFDEBUG} ) + ENDIF ( agg_USE_SDL_PLATFORM ) + ELSE( SDL_FOUND ) + IF ( agg_USE_SDL_PLATFORM ) + MESSAGE( "SDL libray was not found, disable agg_USE_SDL_PLATFORM please" ) + ENDIF ( agg_USE_SDL_PLATFORM ) + + TARGET_LINK_LIBRARIES( antigrain PUBLIC platform) + SET( AGG_LIBRARIES ${AGG_LIBRARIES} aggctrl${PFDEBUG} aggplatform${PFDEBUG} agg${PFDEBUG} ) + ENDIF( SDL_FOUND ) + +ENDIF( agg_BUILD_PLATFORM ) # boolean operations library GPC IF ( agg_USE_GPC ) - INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/gpc ) ADD_LIBRARY( gpcbool ../gpc/gpc.c ../gpc/gpc.h ) + TARGET_INCLUDE_DIRECTORIES( gpcbool PUBLIC ${antigrain_SOURCE_DIR}/gpc ) + SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} gpc ) + TARGET_COMPILE_DEFINITIONS( gpcbool PUBLIC -DAGG_USE_GPC ) + SET( AGG_FLAGS ${AGG_FLAGS} -DAGG_USE_GPC ) + TARGET_LINK_LIBRARIES( antigrain PUBLIC gpcbool ) + SET( AGG_LIBRARIES ${AGG_LIBRARIES} gpc${PFDEBUG} ) + + INSTALL( TARGETS gpcbool DESTINATION lib ) - INSTALL( FILES ../gpc/gpc.h DESTINATION agg/gpc ) + INSTALL( FILES ../gpc/gpc.h DESTINATION agg/gpc ) SET_TARGET_PROPERTIES( gpcbool PROPERTIES OUTPUT_NAME gpc${PFDEBUG} ) ENDIF ( agg_USE_GPC ) IF ( agg_USE_AGG2D ) - INCLUDE_DIRECTORIES( ${antigrain_SOURCE_DIR}/agg2d ) ADD_LIBRARY( agg2d ../agg2d/agg2d.cpp ../agg2d/agg2d.h ) + TARGET_INCLUDE_DIRECTORIES( agg2d PUBLIC ${antigrain_SOURCE_DIR}/agg2d ) + SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} agg2d ) + TARGET_COMPILE_DEFINITIONS( agg2d PUBLIC -DAGG_USE_AGG2D ) + OPTION( agg_USE_AGG2D_FREETYPE "Agg 2D graphical context uses freetype" OFF) + SET( AGG_FLAGS ${AGG_FLAGS} -DAGG_USE_AGG2D ) + TARGET_LINK_LIBRARIES( antigrain PUBLIC agg2d ) + SET( AGG_LIBRARIES ${AGG_LIBRARIES} agg2d${PFDEBUG} ) + INSTALL( TARGETS agg2d DESTINATION lib ) - INSTALL( FILES ../agg2d/agg2d.h DESTINATION agg/agg2d ) + INSTALL( FILES ../agg2d/agg2d.h DESTINATION agg/agg2d ) SET_TARGET_PROPERTIES( agg2d PROPERTIES OUTPUT_NAME agg2d${PFDEBUG} ) ENDIF ( agg_USE_AGG2D ) +IF ( agg_USE_AGG2D_FREETYPE ) + ADD_DEFINITIONS( -DAGG2D_USE_FREETYPE ) + SET( AGG_FLAGS ${AGG_FLAGS} -DAGG2D_USE_FREETYPE ) +ENDIF ( agg_USE_AGG2D_FREETYPE ) + SET_TARGET_PROPERTIES( antigrain PROPERTIES OUTPUT_NAME agg${PFDEBUG} ) -SET_TARGET_PROPERTIES( controls PROPERTIES OUTPUT_NAME aggctrl${PFDEBUG} ) -SET_TARGET_PROPERTIES( platform PROPERTIES OUTPUT_NAME aggplatform${PFDEBUG} ) - -INSTALL( FILES ${antigrain_HEADERS} DESTINATION include/agg2 ) -INSTALL( FILES ${controls_HEADERS} DESTINATION include/agg2/ctrl ) -INSTALL( FILES ${platform_HEADERS} DESTINATION include/agg2/platform ) -INSTALL( FILES ${util_HEADERS} DESTINATION include/agg2/util ) -INSTALL( TARGETS antigrain controls platform DESTINATION lib ) +INSTALL( FILES ${antigrain_HEADERS} DESTINATION agg/include ) +INSTALL( TARGETS antigrain DESTINATION lib ) +IF( agg_BUILD_PLATFORM ) + SET_TARGET_PROPERTIES( platform PROPERTIES OUTPUT_NAME aggplatform${PFDEBUG} ) + INSTALL( FILES ${platform_HEADERS} DESTINATION agg/include/platform ) + INSTALL( TARGETS platform DESTINATION lib ) +ENDIF( agg_BUILD_PLATFORM ) +IF( agg_BUILD_CONTROLS ) + SET_TARGET_PROPERTIES( controls PROPERTIES OUTPUT_NAME aggctrl${PFDEBUG} ) + INSTALL( FILES ${controls_HEADERS} DESTINATION agg/include/ctrl ) + INSTALL( TARGETS controls DESTINATION lib ) +ENDIF( agg_BUILD_CONTROLS ) + + +SET( AGG_FLAGS ${AGG_FLAGS} CACHE STRING "Agg package flags" FORCE ) +SET( AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIRS} CACHE STRING "Agg package libs include paths" FORCE ) +SET( AGG_LIBRARY_DIRS ${AGG_LIBRARY_DIRS} CACHE STRING "Agg package libs directory paths" FORCE ) +SET( AGG_LIBRARIES ${AGG_LIBRARIES} CACHE STRING "Agg package libraries" FORCE )