]> granicus.if.org Git - graphviz/commitdiff
add 'gvmap' and 'gvmap.sh' to the CMake build system
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 1 May 2022 21:47:25 +0000 (14:47 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 22 May 2022 17:34:51 +0000 (10:34 -0700)
Something strange I discovered while integrating this: the CI CentOS Autotools
jobs happily build and install `gvmap` and `cluster` despite not having libgts
installed. That is, the libgts dependency claimed in cmd/gvmap/Makefile.am
appears spurious. This all works out because nothing in that Makefile properly
indicates a requirement for libgts, so Make happily evaluates `$(GTS_LIBS)` to
the empty string.

And yet, when you attempt to remove this libgts usage you will find the CI
Ubuntu Autotools jobs fail. There is apparently a transitive dependency on
libgts when it is installed. So we leave everything as-is for now.

None of this is a concern in the CMake build system because CMake understands
transitive dependencies and applies these without having to be explicitly told.
But in future we should probably trace what the exact relationship of these
tools to libgts is.

Gitlab: #1753, #1836

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

index fbb1ac005e6c59262fe0eebdaea25f0545abc64a..63f1ac79f8e3f4e2ce2b94e5ac21e196f212667c 100644 (file)
@@ -15,10 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - **Breaking**: The `Agiodisc_t` struct member `putstr` that was previously an
   `fputs` analog is replaced by `printf` that is required to behave similar to
   `fprintf`.
-- 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
+- the `mingle`, `diffimg`, `gvmap`, and `edgepaint` binaries are now included in
+  the CMake build system
+- the `gvmap.sh` and `vimdot` scripts are 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 e879e2cd4723847587d9ac95ee1ac6ab697b6791..1ac57504988209b694e4dc25c636db8c09ce46ed 100644 (file)
@@ -103,8 +103,6 @@ def test_existence(binary: str):
     "dot_builtins",
     "gv2gxl",
     "gvedit",
-    "gvmap",
-    "gvmap.sh",
     "gxl2dot",
     "prune",
   ]
@@ -175,9 +173,9 @@ 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":
+  if binary in ("gvmap.sh", "vimdot") and platform.system() == "Windows":
     check_that_tool_does_not_exist(binary, os_id)
-    pytest.skip("vimdot is not installed on Windows")
+    pytest.skip(f"{binary} is not installed on Windows")
 
   assert shutil.which(binary) is not None
 
index b4338d508805648cd46c3621523a236af96c3322..a5f73a8a290e02a90e979a7daef609a0edfd6712 100644 (file)
@@ -1,5 +1,6 @@
 add_subdirectory(dot)
 add_subdirectory(edgepaint)
+add_subdirectory(gvmap)
 add_subdirectory(gvpr)
 add_subdirectory(mingle)
 add_subdirectory(smyrna)
diff --git a/cmd/gvmap/CMakeLists.txt b/cmd/gvmap/CMakeLists.txt
new file mode 100644 (file)
index 0000000..32c5dfe
--- /dev/null
@@ -0,0 +1,75 @@
+if(with_sfdp)
+
+  add_executable(gvmap
+    country_graph_coloring.c
+    country_graph_coloring.h
+    gvmap.c
+    make_map.c
+    make_map.h
+    power.c
+    power.h
+  )
+
+  target_include_directories(gvmap PRIVATE
+    ../../lib
+    ../../lib/common
+    ../../lib/cgraph
+    ../../lib/cdt
+  )
+
+  target_include_directories(gvmap SYSTEM PRIVATE
+    ${GETOPT_INCLUDE_DIRS}
+  )
+
+  target_link_libraries(gvmap
+    cgraph
+    edgepaintlib
+    gvc
+    ingraphs
+    neatogen
+    rbtree
+    sfdpgen
+    sparse
+    ${MATH_LIB}
+  )
+
+  if(NOT HAVE_GETOPT_H)
+    target_link_libraries(gvmap ${GETOPT_LINK_LIBRARIES})
+  endif()
+
+  find_program(GZIP gzip)
+  if(GZIP)
+    add_custom_target(man-gvmap ALL DEPENDS gvmap.1.gz
+                      COMMENT "gvmap man page")
+    add_custom_command(
+      OUTPUT gvmap.1.gz
+      COMMAND ${GZIP} -9 --no-name --to-stdout gvmap.1
+        >"${CMAKE_CURRENT_BINARY_DIR}/gvmap.1.gz"
+      MAIN_DEPENDENCY gvmap.1
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+      COMMENT "compress gvmap man page")
+    install(
+      FILES ${CMAKE_CURRENT_BINARY_DIR}/gvmap.1.gz
+      DESTINATION ${MAN_INSTALL_DIR}/man1)
+  else()
+    install(
+      FILES gvmap.1
+      DESTINATION ${MAN_INSTALL_DIR}/man1
+    )
+  endif()
+
+  install(
+    TARGETS gvmap
+    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+    LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+  )
+
+  install(
+    FILES gvmap.sh
+    DESTINATION ${BINARY_INSTALL_DIR}
+    PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+      WORLD_READ WORLD_EXECUTE
+  )
+
+endif()