]> granicus.if.org Git - graphviz/commitdiff
CMake: enable libgd support on macOS when possible smattr/48F581D5-5BD5-4555-8460-C8B620B657CD-2
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Feb 2022 22:38:01 +0000 (14:38 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 5 Mar 2022 17:58:47 +0000 (09:58 -0800)
As discussed in the comment in this commit, we hard code the options the
Homebrew libgd package is built with.¹ It seems not possible to build a libgd
without GIF support, so perhaps the `HAVE_GD_GIF` logic in the Graphviz code
base could be simplified in future.

Gitlab: #1786

¹ https://github.com/Homebrew/homebrew-core/blob/1a7c405f0e4da91c378d1ebb73ee0d90b2775d32/Formula/gd.rb#L27-L48

ci/tests.py
cmake/FindGD.cmake

index 221b30067e478cde3b2729ba0af851d093b4628e..4b5820cf85292e5cb5acbd7b15d04a3093bc9e35 100644 (file)
@@ -174,7 +174,8 @@ def check_that_tool_does_not_exist(tool, os_id):
   assert shutil.which(tool) is None, f"{tool} has been resurrected in the " \
     f'{os.getenv("build_system")} build on {os_id}. Please remove skip.'
 
-@pytest.mark.xfail(is_cmake() and not is_centos(),
+@pytest.mark.xfail(is_cmake() and not is_centos()
+                   and not platform.system() == "Darwin",
                    reason="png:gd unavailable when built with CMake",
                    strict=True) # FIXME
 def test_1786():
index fddbbb1bf7abade6a60d7c0b6e78bf56c53e743b..d7e0cc968814d790e93b3a0707bbc29a192b3601 100644 (file)
@@ -50,6 +50,17 @@ if(GD_LIBRARY)
       set(HAVE_GD_GIF 1)
     endif()
   else()
-    message(WARNING "gdlib-config not found; skipping feature checks")
+    if(APPLE)
+      # At time of writing, Macports does not package libgd. So assume the user
+      # obtained this through Homebrew and hard code the options the Homebrew
+      # package enables.
+      set(HAVE_GD_PNG 1)
+      set(HAVE_GD_JPEG 1)
+      set(HAVE_GD_FONTCONFIG 1)
+      set(HAVE_GD_FREETYPE 1)
+      set(HAVE_GD_GIF 1)
+    else()
+      message(WARNING "gdlib-config not found; skipping feature checks")
+    endif()
   endif()
 endif()