]> granicus.if.org Git - graphviz/commitdiff
CMake: enable xlib plugin and 'vimdot'
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 30 Mar 2022 02:38:58 +0000 (19:38 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 2 Apr 2022 19:59:55 +0000 (12:59 -0700)
Gitlab: #1836

CHANGELOG.md
ci/tests.py
plugin/CMakeLists.txt
plugin/xlib/CMakeLists.txt [new file with mode: 0644]

index d7bd825f2327aebb2639dd84d4e4653bc6306568..d401294e71901c8c51014a6823a044fff816b154 100644 (file)
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 - the `mingle`, `diffimg`, and `edgepaint` binaries are now included in the
   CMake build system
+- the `vimdot` script is now installed by the CMake build system on operating
+  systems other than Windows
 - a brief note about the (previously undocumented) behavior of Graphviz when
   sent `SIGUSR1` is now mentioned in the man page
 - build system support for `dotty`, `lefty`, and `lneato` has been removed
index 4831d62fd5efd66f6194e880e749c79030daf4e2..f85a636e23976667cc93d971eb004013914c45f5 100644 (file)
@@ -106,7 +106,6 @@ def test_existence(binary: str):
     "gvmap.sh",
     "gxl2dot",
     "prune",
-    "vimdot",
   ]
 
   tools_not_built_with_msbuild = [
@@ -175,6 +174,10 @@ def test_existence(binary: str):
     check_that_tool_does_not_exist(binary, os_id)
     pytest.skip("smyrna is not built on non-Linux due to lacking dependencies")
 
+  if binary == "vimdot" and platform.system() == "Windows":
+    check_that_tool_does_not_exist(binary, os_id)
+    pytest.skip("vimdot is not installed on Windows")
+
   assert shutil.which(binary) is not None
 
 def check_that_tool_does_not_exist(tool, os_id):
index 45169133995f752ed935780767af3321e88320f5..6606fd26cdc47d689b94cab08270163bec7b2b9c 100644 (file)
@@ -6,3 +6,4 @@ add_subdirectory(gdiplus)
 add_subdirectory(neato_layout)
 add_subdirectory(pango)
 add_subdirectory(webp)
+add_subdirectory(xlib)
diff --git a/plugin/xlib/CMakeLists.txt b/plugin/xlib/CMakeLists.txt
new file mode 100644 (file)
index 0000000..682d106
--- /dev/null
@@ -0,0 +1,84 @@
+find_package(PANGOCAIRO)
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+  pkg_check_modules(X11 x11)
+  pkg_check_modules(XRENDER xrender)
+endif()
+
+if(PANGOCAIRO_FOUND AND X11_FOUND AND XRENDER_FOUND)
+
+  add_library(gvplugin_xlib SHARED
+    gvdevice_xlib.c
+    gvplugin_xlib.c
+  )
+
+  target_include_directories(gvplugin_xlib PRIVATE
+    ${GRAPHVIZ_LIB_DIR}
+    ${GRAPHVIZ_LIB_DIR}/cdt
+    ${GRAPHVIZ_LIB_DIR}/cgraph
+    ${GRAPHVIZ_LIB_DIR}/common
+    ${GRAPHVIZ_LIB_DIR}/gvc
+    ${GRAPHVIZ_LIB_DIR}/pathplan
+  )
+
+  target_include_directories(gvplugin_xlib PRIVATE SYSTEM
+    ${PANGOCAIRO_INCLUDE_DIRS}
+    ${X11_INCLUDE_DIRS}
+    ${XRENDER_INCLUDE_DIRS}
+  )
+
+  target_link_libraries(gvplugin_xlib
+    ${PANGOCAIRO_LINK_LIBRARIES}
+    ${X11_LINK_LIBRARIES}
+    ${XRENDER_LINK_LIBRARIES}
+  )
+
+  install(
+    TARGETS gvplugin_xlib
+    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+    LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+  )
+
+  set_target_properties(gvplugin_xlib 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_xlib PROPERTIES
+      RUNTIME_OUTPUT_NAME gvplugin_xlib-${GRAPHVIZ_PLUGIN_VERSION}
+    )
+  endif()
+
+  install(
+    FILES vimdot.sh
+    DESTINATION ${BINARY_INSTALL_DIR}
+    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+      WORLD_READ WORLD_EXECUTE
+    RENAME vimdot
+  )
+
+  find_program(GZIP gzip)
+  if(GZIP)
+    add_custom_target(man-vimdot ALL DEPENDS vimdot.1.gz
+                      COMMENT "vimdot man page")
+    add_custom_command(
+      OUTPUT vimdot.1.gz
+      COMMAND ${GZIP} -9 --no-name --to-stdout vimdot.1
+        >"${CMAKE_CURRENT_BINARY_DIR}/vimdot.1.gz"
+      MAIN_DEPENDENCY vimdot.1
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+      COMMENT "compress vimdot man page")
+    install(
+      FILES ${CMAKE_CURRENT_BINARY_DIR}/vimdot.1.gz
+      DESTINATION ${MAN_INSTALL_DIR}/man1)
+  else()
+    install(
+      FILES vimdot.1
+      DESTINATION ${MAN_INSTALL_DIR}/man1
+    )
+  endif()
+
+endif()