]> granicus.if.org Git - graphviz/commitdiff
add prune to the CMake build system
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 5 Nov 2022 16:24:57 +0000 (09:24 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 10 Nov 2022 04:47:29 +0000 (20:47 -0800)
Gitlab: #1836

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

index c185ed2108ccc47414c091caaed5a1140623725a..b2586f1f8f31e0658501336a20824720e7dab644 100644 (file)
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased (7.0.2)]
 
+### Added
+
+- The `prune` utility is now included in the CMake build system. #1836
+
 ## [7.0.1] – 2022-11-09
 
 ### Added
index 5d708e288a8c813a7d2aa74b5f64954eb0926e52..482a8c44c15baeefede3bd963a573574b8cf2b53 100644 (file)
@@ -247,6 +247,7 @@ include(CTest)
 
 # ======================= Specify subdirectories to build ======================
 add_subdirectory(contrib/diffimg)
+add_subdirectory(contrib/prune)
 add_subdirectory(graphs)
 add_subdirectory(lib)
 add_subdirectory(plugin)
index e98a67205f11363917af6f67c3adb09dd979688f..4cede56875ef005b4a7a98f0ff474b939d6b5180 100644 (file)
@@ -103,7 +103,6 @@ def test_existence(binary: str):
     "gv2gxl",
     "gvedit",
     "gxl2dot",
-    "prune",
   ]
 
   tools_not_built_with_msbuild = [
diff --git a/contrib/prune/CMakeLists.txt b/contrib/prune/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c5b183f
--- /dev/null
@@ -0,0 +1,42 @@
+add_executable(prune generic_list.c prune.c)
+target_include_directories(prune PRIVATE
+  ../../lib
+  ../../lib/cdt)
+target_link_libraries(prune PRIVATE cdt cgraph ingraphs)
+
+if(GETOPT_FOUND)
+  target_include_directories(prune SYSTEM PRIVATE
+    ${GETOPT_INCLUDE_DIRS}
+  )
+endif()
+
+if(NOT HAVE_GETOPT_H)
+  target_link_libraries(prune PRIVATE ${GETOPT_LINK_LIBRARIES})
+endif()
+
+install(
+  TARGETS prune
+  RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+  LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
+  ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+)
+
+if(GZIP)
+  add_custom_target(man-prune ALL DEPENDS prune.1.gz
+                    COMMENT "prune man page")
+  add_custom_command(
+    OUTPUT prune.1.gz
+    COMMAND ${GZIP} -9 --no-name --to-stdout prune.1
+      >"${CMAKE_CURRENT_BINARY_DIR}/prune.1.gz"
+    MAIN_DEPENDENCY prune.1
+    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+    COMMENT "compress prune man page")
+  install(
+    FILES ${CMAKE_CURRENT_BINARY_DIR}/prune.1.gz
+    DESTINATION ${MAN_INSTALL_DIR}/man1)
+else()
+  install(
+    FILES prune.1
+    DESTINATION ${MAN_INSTALL_DIR}/man1
+  )
+endif()