]> granicus.if.org Git - graphviz/commitdiff
add 'cluster' to the CMake build system
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 5 Nov 2022 23:38:05 +0000 (16:38 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 10 Nov 2022 15:51:52 +0000 (07:51 -0800)
From the Autotools build system, it looks like this should link against GTS. But
apparently it does not need to.

Gitlab: #1836

CHANGELOG.md
ci/tests.py
cmd/gvmap/CMakeLists.txt

index b2586f1f8f31e0658501336a20824720e7dab644..c9d957c587f43223b48ac9760864375b2b4d7613 100644 (file)
@@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added
 
-- The `prune` utility is now included in the CMake build system. #1836
+- The `cluster` and `prune` utilities is now included in the CMake build
+  system. #1836
 
 ## [7.0.1] – 2022-11-09
 
index 4cede56875ef005b4a7a98f0ff474b939d6b5180..530ae02f335bc8bd8461ff7ff7f103ca2a61a879 100644 (file)
@@ -98,7 +98,6 @@ def test_existence(binary: str):
   """
 
   tools_not_built_with_cmake = [
-    "cluster",
     "dot_builtins",
     "gv2gxl",
     "gvedit",
index 3f02bab712ab5db891796494a0c30441797d72cc..d5b0d4226d9c7f04d2ae9533e7f93581164a967d 100644 (file)
@@ -1,5 +1,68 @@
 if(with_sfdp)
 
+  add_executable(cluster
+    cluster.c
+    country_graph_coloring.c
+    make_map.c
+    power.c
+  )
+
+  target_include_directories(cluster PRIVATE
+    ../../lib
+    ../../lib/cdt
+    ../../lib/cgraph
+    ../../lib/common
+  )
+
+  if(GETOPT_FOUND)
+    target_include_directories(cluster SYSTEM PRIVATE
+      ${GETOPT_INCLUDE_DIRS}
+    )
+  endif()
+
+  target_link_libraries(cluster PRIVATE
+    cgraph
+    edgepaintlib
+    gvc
+    ingraphs
+    neatogen
+    rbtree
+    sfdpgen
+    sparse
+  )
+
+  if(NOT HAVE_GETOPT_H)
+    target_link_libraries(cluster PRIVATE ${GETOPT_LINK_LIBRARIES})
+  endif()
+
+  find_program(GZIP gzip)
+  if(GZIP)
+    add_custom_target(man-cluster ALL DEPENDS cluster.1.gz
+                      COMMENT "cluster man page")
+    add_custom_command(
+      OUTPUT cluster.1.gz
+      COMMAND ${GZIP} -9 --no-name --to-stdout cluster.1
+        >"${CMAKE_CURRENT_BINARY_DIR}/cluster.1.gz"
+      MAIN_DEPENDENCY cluster.1
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+      COMMENT "compress cluster man page")
+    install(
+      FILES ${CMAKE_CURRENT_BINARY_DIR}/cluster.1.gz
+      DESTINATION ${MAN_INSTALL_DIR}/man1)
+  else()
+    install(
+      FILES cluster.1
+      DESTINATION ${MAN_INSTALL_DIR}/man1
+    )
+  endif()
+
+  install(
+    TARGETS cluster
+    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+    LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+  )
+
   add_executable(gvmap
     country_graph_coloring.c
     country_graph_coloring.h