]> granicus.if.org Git - graphviz/commitdiff
CMake: fix: teach 'gvpack' how to find plugins at run time
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 12 Nov 2022 18:50:53 +0000 (10:50 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 19 Nov 2022 03:06:11 +0000 (19:06 -0800)
Because `gvpack` links against the plugins as libraries rather than loading them
on demand, the dynamic linker needs to be able to locate the plugin libraries at
run time.

CC: Jaroslav Škarvada <jskarvad@redhat.com>
Gitlab: fixes #1838
Red Hat: fixes https://bugzilla.redhat.com/show_bug.cgi?id=1838679

CHANGELOG.md
cmd/tools/CMakeLists.txt
tests/test_tools.py

index 2f0218a5d237be91594de0b07fd38397f7dbaf53..ade52d5366da3892989fe6997131a00775421172 100644 (file)
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 - The CMake build system no longer builds auxiliary tools beyond `gvpack` with
   demand loading disabled.
+- `gvpack` built with the CMake build system can now find plugins correctly at
+  run time. #1838
 
 ## [7.0.2] – 2022-11-18
 
index c5da67d11bd33d9ac662bbfc44a6ee7c9981473c..6928bf6a74b25dcf5aa55144afba5e853e3945fe 100644 (file)
@@ -287,6 +287,15 @@ add_executable(gvpack
   gvpack.cpp
 )
 
+# teach gvpack how to find plugins at run time
+if(APPLE)
+  set_target_properties(gvpack PROPERTIES
+    INSTALL_RPATH "@executable_path/../${PLUGIN_INSTALL_DIR}")
+else()
+  set_target_properties(gvpack PROPERTIES
+    INSTALL_RPATH "\$ORIGIN/../${PLUGIN_INSTALL_DIR}")
+endif()
+
 target_compile_definitions(gvpack PRIVATE DEMAND_LOADING=0)
 
 target_include_directories(gvpack PRIVATE
index 686090e221c4933cbc9e20353c0b212fae32638f..cee205c7c659bd5e9c60c7c1ca4a80e10a95acea 100644 (file)
@@ -72,13 +72,6 @@ def test_tools(tool):
   if tool == "smyrna" and os.getenv("build_system") == "msbuild":
     pytest.skip("smyrna fails to start because of missing DLLs in Windows MSBuild builds (#1829)")
 
-  # FIXME: Remove skip when
-  # https://gitlab.com/graphviz/graphviz/-/issues/1838 is fixed
-  if tool == "gvpack" and platform.system() != "Windows":
-    if os.getenv("build_system") == "cmake":
-      pytest.skip("gvpack does not find libgvplugin_neato_layout.so.6"
-                  "when built with CMake (#1838)")
-
   # Ensure that X fails to open display
   environ_copy = os.environ.copy()
   environ_copy.pop("DISPLAY", None)