From cccf5cf4612f334599a314365f411188a8be01eb Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 26 Feb 2022 14:38:01 -0800 Subject: [PATCH] CMake: enable libgd support on macOS when possible MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 3 ++- cmake/FindGD.cmake | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ci/tests.py b/ci/tests.py index 221b30067..4b5820cf8 100644 --- a/ci/tests.py +++ b/ci/tests.py @@ -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(): diff --git a/cmake/FindGD.cmake b/cmake/FindGD.cmake index fddbbb1bf..d7e0cc968 100644 --- a/cmake/FindGD.cmake +++ b/cmake/FindGD.cmake @@ -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() -- 2.40.0