]> granicus.if.org Git - graphviz/commitdiff
CMake: enable Quartz plugin
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 6 Apr 2022 03:00:12 +0000 (20:00 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 10 Apr 2022 15:31:23 +0000 (08:31 -0700)
It is unclear how valuable this is, given this is only applicable to macOS and
its dependency discovery (based on the Autotools behavior) is fairly ad hoc. But
we still drag it into the CMake world to make progress on unifying the Graphviz
build system.

Gitlab: #1836

plugin/CMakeLists.txt
plugin/quartz/CMakeLists.txt [new file with mode: 0644]

index 2c958466ebc5e34e27bf8d4f1faa95089fc3e320..e2c83a1a30ef7b619a1fb61262faaf22028d1d17 100644 (file)
@@ -10,6 +10,7 @@ add_subdirectory(gtk)
 add_subdirectory(neato_layout)
 add_subdirectory(pango)
 add_subdirectory(poppler)
+add_subdirectory(quartz)
 add_subdirectory(rsvg)
 add_subdirectory(webp)
 add_subdirectory(xlib)
diff --git a/plugin/quartz/CMakeLists.txt b/plugin/quartz/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8653ca6
--- /dev/null
@@ -0,0 +1,53 @@
+if(IS_DIRECTORY "/System/Library/Frameworks/ApplicationServices.framework")
+
+  add_library(gvplugin_quartz SHARED
+    gvplugin_quartz.h
+    GVTextLayout.h
+    gvdevice_quartz.c
+    gvloadimage_quartz.c
+    gvplugin_quartz.c
+    gvrender_quartz.c
+    gvtextlayout_quartz.c
+    GVTextLayout.m
+  )
+
+  target_include_directories(gvplugin_quartz PRIVATE
+    ../../lib
+    ../../lib/cdt
+    ../../lib/cgraph
+    ../../lib/common
+    ../../lib/gvc
+    ../../lib/pathplan
+  )
+
+  target_link_libraries(gvplugin_quartz
+    cgraph
+    gvc
+  )
+
+  # `target_link_options` is only available ≥ CMake 3.13, but this plugin is
+  # only enabled on macOS where we can rely on an up to date CMake
+  target_link_options(gvplugin_quartz PUBLIC
+    -framework ApplicationServices
+  )
+
+  install(
+    TARGETS gvplugin_quartz
+    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+    LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+  )
+
+  set_target_properties(gvplugin_quartz PROPERTIES
+    VERSION ${GRAPHVIZ_PLUGIN_VERSION}.0.0
+    SOVERSION ${GRAPHVIZ_PLUGIN_VERSION}
+  )
+
+  if(MINGW)
+    # work around https://gitlab.kitware.com/cmake/cmake/-/issues/21716
+    set_target_properties(gvplugin_quartz PROPERTIES
+      RUNTIME_OUTPUT_NAME gvplugin_quartz-${GRAPHVIZ_PLUGIN_VERSION}
+    )
+  endif()
+
+endif()