Skip to content

Commit

Permalink
Update cmakelists, make it more targetable
Browse files Browse the repository at this point in the history
  • Loading branch information
xakod committed Mar 16, 2022
1 parent a40657d commit 9a5c262
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 173 deletions.
102 changes: 1 addition & 101 deletions agg-src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -93,106 +93,6 @@ 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 )

# sdl 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 )

Expand Down
Loading

0 comments on commit 9a5c262

Please sign in to comment.