]> granicus.if.org Git - graphviz/commitdiff
CMake: enable Ghostscript plugin
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 3 Apr 2022 19:39:30 +0000 (12:39 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 7 Apr 2022 13:46:40 +0000 (06:46 -0700)
Gitlab: #1836

cmake/FindGS.cmake [new file with mode: 0644]
plugin/CMakeLists.txt
plugin/gs/CMakeLists.txt [new file with mode: 0644]

diff --git a/cmake/FindGS.cmake b/cmake/FindGS.cmake
new file mode 100644 (file)
index 0000000..96c1933
--- /dev/null
@@ -0,0 +1,19 @@
+find_path(GS_INCLUDE_DIR ghostscript/iapi.h)
+find_library(GS_LIBRARY NAMES gs)
+find_program(GS_RUNTIME_LIBRARY gs.dll)
+
+include(FindPackageHandleStandardArgs)
+if(WIN32)
+  find_package_handle_standard_args(GS DEFAULT_MSG
+                                    GS_LIBRARY GS_INCLUDE_DIR
+                                    GS_RUNTIME_LIBRARY)
+else()
+  find_package_handle_standard_args(GS DEFAULT_MSG
+                                    GS_LIBRARY GS_INCLUDE_DIR)
+endif()
+
+mark_as_advanced(GS_INCLUDE_DIR GS_LIBRARY GS_RUNTIME_LIBRARY)
+
+set(GS_INCLUDE_DIRS ${GS_INCLUDE_DIR})
+set(GS_LIBRARIES ${GS_LIBRARY})
+set(GS_RUNTIME_LIBRARIES ${GS_RUNTIME_LIBRARY})
index 6606fd26cdc47d689b94cab08270163bec7b2b9c..16a41b4193a750bd20f8420e09e7b18a3323eeee 100644 (file)
@@ -3,6 +3,7 @@ add_subdirectory(devil)
 add_subdirectory(dot_layout)
 add_subdirectory(gd)
 add_subdirectory(gdiplus)
+add_subdirectory(gs)
 add_subdirectory(neato_layout)
 add_subdirectory(pango)
 add_subdirectory(webp)
diff --git a/plugin/gs/CMakeLists.txt b/plugin/gs/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ea39a81
--- /dev/null
@@ -0,0 +1,49 @@
+find_package(GS)
+find_package(PANGOCAIRO)
+
+if(GS_FOUND AND PANGOCAIRO_FOUND)
+
+  add_library(gvplugin_gs SHARED
+    gvloadimage_gs.c
+    gvplugin_gs.c
+  )
+
+  target_include_directories(gvplugin_gs PRIVATE
+    ../../lib
+    ../../lib/cdt
+    ../../lib/cgraph
+    ../../lib/common
+    ../../lib/gvc
+    ../../lib/pathplan
+  )
+
+  target_include_directories(gvplugin_gs SYSTEM PRIVATE
+    ${GS_INCLUDE_DIRS}
+    ${PANGOCAIRO_INCLUDE_DIRS}
+  )
+
+  target_link_libraries(gvplugin_gs
+    ${GS_LIBRARIES}
+    ${PANGOCAIRO_LIBRARIES}
+  )
+
+  install(
+    TARGETS gvplugin_gs
+    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+    LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+  )
+
+  set_target_properties(gvplugin_gs 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_gs PROPERTIES
+      RUNTIME_OUTPUT_NAME gvplugin_gs-${GRAPHVIZ_PLUGIN_VERSION}
+    )
+  endif()
+
+endif()