Permalink
Browse files

add support for SVG symbology in cmake build (#4634)

note that svg-cairo does not properly link against current versions
of cairo as it uses an obsolete API. Support for SVG symbols is
disabled by default because of this
  • Loading branch information...
1 parent 24105e2 commit 2c7a6059815d1e34c19d7cde0a2626b927397e6a @tbonfort tbonfort committed Jul 22, 2013
Showing with 66 additions and 0 deletions.
  1. +13 −0 CMakeLists.txt
  2. +52 −0 cmake/FindSVGCairo.cmake
  3. +1 −0 mapserver-config.h.in
View
@@ -116,6 +116,7 @@ option(WITH_GD "Choose if (old) GD support should be built in" OFF)
option(WITH_FRIBIDI "Choose if FriBidi glyph shaping support should be built in (usefull for left-to-right languages)" ON)
option(WITH_ICONV "Choose if Iconv Internationalization support should be built in" ON)
option(WITH_CAIRO "Choose if CAIRO rendering support should be built in (required for SVG and PDF output)" ON)
+option(WITH_SVGCAIRO "Choose SVG symbology support should be built in (requires cairo, libsvg, libsvg-cairo)" OFF)
option(WITH_MYSQL "Choose if MYSQL joining support should be built in" OFF)
option(WITH_FCGI "Choose if FastCGI support should be built in" ON)
option(WITH_GEOS "Choose if GEOS geometry operations support should be built in" ON)
@@ -492,6 +493,17 @@ if(WITH_GDAL)
endif(GDAL_FOUND)
endif (WITH_GDAL)
+if(WITH_SVGCAIRO)
+ find_package(SVGCAIRO)
+ if(SVGCAIRO_FOUND)
+ include_directories(${SVGCAIRO_INCLUDE_DIR})
+ ms_link_libraries( ${SVG_LIBRARY} ${SVGCAIRO_LIBRARY})
+ set (USE_SVG_CAIRO 1)
+ else(SVGCAIRO_FOUND)
+ report_optional_not_found(SVGCAIRO)
+ endif(SVGCAIRO_FOUND)
+endif (WITH_SVGCAIRO)
+
if(WITH_OGR)
if(GDAL_FOUND)
set (USE_OGR 1)
@@ -764,6 +776,7 @@ status_optional_component("MYSQL" "${USE_MYSQL}" "${MYSQL_LIBRARY}")
status_optional_component("FRIBIDI" "${USE_FRIBIDI}" "${FRIBIDI_LIBRARY}")
status_optional_component("GIF" "${USE_GIF}" "${GIF_LIBRARY}")
status_optional_component("CAIRO" "${USE_CAIRO}" "${CAIRO_LIBRARY}")
+status_optional_component("SVGCAIRO" "${USE_SVG_CAIRO}" "${SVGCAIRO_LIBRARY}")
status_optional_component("CURL" "${USE_CURL}" "${CURL_LIBRARY}")
status_optional_component("PROJ" "${USE_PROJ}" "${PROJ_LIBRARY}")
status_optional_component("LIBXML2" "${USE_LIBXML2}" "${LIBXML2_LIBRARY}")
@@ -0,0 +1,52 @@
+# - Find LibSVG and LibSVG-Cairo
+#
+# Following variables are provided:
+# SVG_FOUND
+# True if libsvg has been found
+# SVG_INCLUDE_DIR
+# The include directories of libsvg
+# SVG_LIBRARY
+# libsvg library list
+# Following variables are provided:
+# SVGCAIRO_FOUND
+# True if libsvg-cairo has been found
+# SVGCAIRO_INCLUDE_DIR
+# The include directories of libsvg-cairo
+# SVGCAIRO_LIBRARY
+# libsvg-cairo library list
+
+
+find_package(PkgConfig)
+pkg_check_modules(PC_SVG QUIET libsvg>=0.1.4)
+pkg_check_modules(PC_SVGCAIRO QUIET libsvg-cairo>=0.1.6)
+
+find_path(SVG_INCLUDE_DIR
+ NAMES svg.h
+ HINTS ${PC_SVG_INCLUDE_DIR} ${PC_SVG_INCLUDE_DIRS}
+)
+
+find_library(SVG_LIBRARY
+ NAME svg
+ HINTS ${PC_SVG_LIBDIR} ${PC_SVG_LIBRARY_DIRS}
+)
+
+find_path(SVGCAIRO_INCLUDE_DIR
+ NAMES svg-cairo.h
+ HINTS ${PC_SVGCAIRO_INCLUDE_DIR} ${PC_SVGCAIRO_INCLUDE_DIRS}
+)
+
+find_library(SVGCAIRO_LIBRARY
+ NAME svg-cairo
+ HINTS ${PC_SVGCAIRO_LIBDIR} ${PC_SVGCAIRO_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+
+set(SVG_INCLUDE_DIRS ${SVG_INCLUDE_DIR})
+set(SVG_LIBRARIES ${SVG_LIBRARY})
+find_package_handle_standard_args(SVG DEFAULT_MSG SVG_LIBRARY SVG_INCLUDE_DIR)
+mark_as_advanced(SVG_LIBRARY SVG_INCLUDE_DIR)
+set(SVGCAIRO_INCLUDE_DIRS ${SVGCAIRO_INCLUDE_DIR})
+set(SVGCAIRO_LIBRARIES ${SVGCAIRO_LIBRARY})
+find_package_handle_standard_args(SVGCAIRO DEFAULT_MSG SVGCAIRO_LIBRARY SVGCAIRO_INCLUDE_DIR)
+mark_as_advanced(SVGCAIRO_LIBRARY SVGCAIRO_INCLUDE_DIR)
@@ -35,6 +35,7 @@
#cmakedefine USE_XMLMAPFILE 1
#cmakedefine USE_GENERIC_MS_NINT 1
#cmakedefine POSTGIS_HAS_SERVER_VERSION 1
+#cmakedefine USE_SVG_CAIRO 1
/*windows specific hacks*/
#if defined(_WIN32)

0 comments on commit 2c7a605

Please sign in to comment.