]> granicus.if.org Git - graphviz/commitdiff
Add install of plugin configuration file config6 for CMake builds
authorMagnus Jacobsson <magnus.jacobsson@berotec.se>
Sun, 13 Sep 2020 15:07:44 +0000 (17:07 +0200)
committerMagnus Jacobsson <magnus.jacobsson@berotec.se>
Wed, 30 Sep 2020 07:26:39 +0000 (09:26 +0200)
cmake/configure_plugins.cmake [new file with mode: 0644]
cmd/dot/CMakeLists.txt

diff --git a/cmake/configure_plugins.cmake b/cmake/configure_plugins.cmake
new file mode 100644 (file)
index 0000000..0aea158
--- /dev/null
@@ -0,0 +1,38 @@
+# Run dot -c in the staging install directory to create the config6
+# plugin before the final package is created.
+#
+# This script is called just after the dot executable has been copied
+# to the staging install directory. It's a bit tricky to retrieve the
+# path to that directory since the CPack variables seems to be
+# write-only and none of the CMake internal variables contain the path
+# in all circumstances. Below is a description how this is achieved.
+#
+# For the ZIP CPack generator:
+#   $ENV{DESTDIR} is empty
+#   ${CMAKE_INSTALL_PREFIX} is the absolute path to the staging install directory
+#
+# For the NSIS and DEB CPack generators:
+#   $ENV{DESTDIR} is the absolute path to the staging install directory
+#   ${CMAKE_INSTALL_PREFIX} is the installation prefix used on the target system
+#
+# This means that we can just concatenate $ENV{DESTDIR} and
+# ${CMAKE_INSTALL_PREFIX} to get the location of the 'bin' and 'lib'
+# directories in the staging install area.
+#
+# More info:
+#   https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html#variable:CMAKE_INSTALL_PREFIX
+#   https://cmake.org/cmake/help/latest/envvar/DESTDIR.html
+#   https://cmake.org/cmake/help/latest/module/CPack.html#variable:CPACK_INSTALL_SCRIPTS (cannot use for this. Runs too early)
+#   https://stackoverflow.com/questions/43875499/do-post-processing-after-make-install-in-cmake (no useful answer)
+
+set(ROOT $ENV{DESTDIR}${CMAKE_INSTALL_PREFIX})
+
+if (APPLE)
+  set(ENV{DYLD_LIBRARY_PATH} "${ROOT}/lib")
+elseif (UNIX)
+  set(ENV{LD_LIBRARY_PATH} "${ROOT}/lib")
+endif()
+
+execute_process(
+  COMMAND ${ROOT}/bin/dot -c
+)
index 35927c96700212becf64bd48c4f50eeb5ccd4319..445dbebd1242b2a2490d2c546ea8435446065b40 100644 (file)
@@ -34,3 +34,7 @@ install(
     FILES dot.1 osage.1 patchwork.1
     DESTINATION ${MAN_INSTALL_DIR}
 )
+
+install(
+      SCRIPT ${TOP_SOURCE_DIR}/cmake/configure_plugins.cmake
+)