]> granicus.if.org Git - graphviz/commitdiff
CMake: enable Rsvg plugin
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 7 Apr 2022 00:49:56 +0000 (17:49 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 Apr 2022 15:01:35 +0000 (08:01 -0700)
Gitlab: #1836

CMakeLists.txt
cmake/config_checks.cmake
plugin/CMakeLists.txt
plugin/rsvg/CMakeLists.txt [new file with mode: 0644]

index 16f6ad94af99ed3b2d92940e67c62748c3f6960b..28e8283a0fe57beddf3ec053e57b4f7307720e80 100644 (file)
@@ -202,6 +202,11 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/graphviz_version.h DESTINATION ${HEADE
 
 message(STATUS "Graphviz version: ${GRAPHVIZ_VERSION_FULL}")
 
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+  pkg_check_modules(SVG_2_36 librsvg-2.0>=2.36.0 cairo>=1.0.0)
+endif()
+
 include(config_checks)
 if(NOT HAVE_GETOPT_H)
   find_package(GETOPT REQUIRED)
index 97b03cc900aa56217a51c91ba4708280d4c719b4..78a49008688f8b6a0e0ae06c56b78ef449d2d65b 100644 (file)
@@ -42,6 +42,7 @@ set( HAVE_ANN       ${ANN_FOUND}        )
 set( HAVE_EXPAT     ${EXPAT_FOUND}      )
 set( HAVE_LIBGD     ${GD_FOUND}         )
 set( HAVE_ZLIB      ${ZLIB_FOUND}       )
+set( HAVE_SVG_2_36  ${SVG_2_36_FOUND}   )
 
 if(LTDL_FOUND)
   set(ENABLE_LTDL 1)
index 42c13d6c48d7ba1eb89895e0f91a205aa118d197..c4608aa7eeb7ce3d1e7fd56a82b5a3925f6f2fd8 100644 (file)
@@ -8,5 +8,6 @@ add_subdirectory(glitz)
 add_subdirectory(gs)
 add_subdirectory(neato_layout)
 add_subdirectory(pango)
+add_subdirectory(rsvg)
 add_subdirectory(webp)
 add_subdirectory(xlib)
diff --git a/plugin/rsvg/CMakeLists.txt b/plugin/rsvg/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f95fcfd
--- /dev/null
@@ -0,0 +1,49 @@
+find_package(PANGOCAIRO)
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+  pkg_check_modules(RSVG librsvg-2.0)
+  pkg_check_modules(XRENDER xrender)
+endif()
+
+if(PANGOCAIRO_FOUND AND RSVG_FOUND AND XRENDER_FOUND)
+
+  add_library(gvplugin_rsvg SHARED
+    gvloadimage_rsvg.c
+    gvplugin_rsvg.c
+  )
+
+  target_include_directories(gvplugin_rsvg PRIVATE
+    ../../lib
+    ../../lib/cdt
+    ../../lib/cgraph
+    ../../lib/common
+    ../../lib/gvc
+    ../../lib/pathplan
+  )
+
+  target_include_directories(gvplugin_rsvg SYSTEM PRIVATE
+    ${PANGOCAIRO_LIBRARIES}
+    ${RSVG_LIBRARIES}
+    ${XRENDER_LIBRARIES}
+  )
+
+  install(
+    TARGETS gvplugin_rsvg
+    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+    LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+  )
+
+  set_target_properties(gvplugin_rsvg PROPERTIES
+    VERSION ${GRAPHVIZ_PLUGIN_VERSION}.0.0
+    SOVERSION ${GRAPHVIZ_PLUGIN_VERSION}
+  )
+
+  if(MINGW)
+    # work around https://gitlab.kitware.com/cmake/cmake/-/issues/21716
+    set_target_properties(gvplugin_rsvg PROPERTIES
+      RUNTIME_OUTPUT_NAME gvplugin_rsvg-${GRAPHVIZ_PLUGIN_VERSION}
+    )
+  endif()
+
+endif()