]> granicus.if.org Git - graphviz/commitdiff
add 'gvedit' to the CMake build system
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 14 Nov 2022 03:37:35 +0000 (19:37 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 17 Nov 2022 05:09:01 +0000 (21:09 -0800)
Note that we need to disable building GVEdit on Windows in CI because we do not
currently have Qt installed there.¹

Gitlab: closes #1753, closes #1836

¹ See https://gitlab.com/graphviz/graphviz/-/merge_requests/1569 for further
  discussion.

CHANGELOG.md
CMakeLists.txt
ci/cygwin-build.sh
ci/mingw-build.sh
ci/tests.py
ci/windows_build.py
cmd/CMakeLists.txt
cmd/gvedit/CMakeLists.txt [new file with mode: 0644]

index 6a1bb61e90a70b91952e3856805f4be9782b90aa..b808b1712a700f40d9b0ccd3c9ca5ea5eab24806 100644 (file)
@@ -8,8 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added
 
-- The `cluster`, `dot_builtins`, `dot2gxl`, `gv2gxl`, and `prune` utilities are
-  now included in the CMake build system. #1836
+- The `cluster`, `dot_builtins`, `dot2gxl`, `gv2gxl`, `gvedit`, and `prune`
+  utilities are now included in the CMake build system. #1753, #1836
 
 ### Changed
 
index 482a8c44c15baeefede3bd963a573574b8cf2b53..fc3a377b2db99571d3a2a2721f4ffa03447f6135 100644 (file)
@@ -7,6 +7,7 @@ include(FeatureSummary)
 option(enable_ltdl     "Support on-demand plugin loading" ON)
 option(with_expat      "Support HTML-like labels through expat" ON )
 option(with_digcola    "DIGCOLA features in neato layout engine" ON )
+option(with_gvedit     "GVEdit interactive graph editor" ON)
 option(with_ipsepcola  "IPSEPCOLA features in neato layout engine (disabled by default - C++ portability issues)." OFF )
 option(with_ortho      "ORTHO features in neato layout engine." ON )
 option(with_sfdp       "sfdp layout engine." ON )
index 542cc0f740dc5fb9e1335041b52cefb62ac76fcf..73b73defa53f2fcdf841aa65c184f2133823ed2b 100644 (file)
@@ -27,8 +27,9 @@ export CC="ccache ${CC:-cc}"
 export CXX="ccache ${CXX:-c++}"
 export CCACHE_DIR=ccache-cache
 
-# use the libs installed with cygwinsetup instead of those in
-# https://gitlab.com/graphviz/graphviz-windows-dependencies
-export CMAKE_OPTIONS=-Duse_win_pre_inst_libs=OFF
+# Use the libs installed with cygwinsetup instead of those in
+# https://gitlab.com/graphviz/graphviz-windows-dependencies. Also disable GVEdit
+# because we do not have Qt installed.
+export CMAKE_OPTIONS="-Duse_win_pre_inst_libs=OFF -Dwith_gvedit=OFF"
 
 ci/build.sh
index f20b07b25dd21d257477541975f8e41dccfe1fa5..711edf0fb9ce322f0d92f81791311c4173d19cd1 100644 (file)
@@ -10,9 +10,10 @@ ci/mingw-install.sh
 export PATH=$PATH:/c/Git/cmd
 
 if [ "${build_system}" = "cmake" ]; then
-    # use the libs installed with pacman instead of those in
-    # https://gitlab.com/graphviz/graphviz-windows-dependencies
-    export CMAKE_OPTIONS=-Duse_win_pre_inst_libs=OFF
+    # Use the libs installed with pacman instead of those in
+    # https://gitlab.com/graphviz/graphviz-windows-dependencies. Also disable
+    # GVEdit because we do not have Qt installed.
+    export CMAKE_OPTIONS="-Duse_win_pre_inst_libs=OFF -Dwith_gvedit=OFF"
 fi
 
 ci/build.sh
index db90d79cd7bd7642d71ad1bd7fe21240b5e0c325..73f917fc11bcb55f0ce1817781252d8896aedc85 100644 (file)
@@ -97,10 +97,6 @@ def test_existence(binary: str):
   check that a given binary was built and is on $PATH
   """
 
-  tools_not_built_with_cmake = [
-    "gvedit",
-  ]
-
   tools_not_built_with_msbuild = [
     "cluster",
     "dot2gxl",
@@ -131,14 +127,6 @@ def test_existence(binary: str):
     check_that_tool_does_not_exist(binary, os_id)
     pytest.skip("smyrna is not built for Centos (#1834)")
 
-  # FIXME: Remove skip when
-  # https://gitlab.com/graphviz/graphviz/-/issues/1753 and
-  # https://gitlab.com/graphviz/graphviz/-/issues/1836 is fixed
-  if os.getenv("build_system") == "cmake":
-    if binary in tools_not_built_with_cmake:
-      check_that_tool_does_not_exist(binary, os_id)
-      pytest.skip(f"{binary} is not built with CMake (#1753 & #1836)")
-
   # FIXME: Remove skip when
   # https://gitlab.com/graphviz/graphviz/-/issues/1837 is fixed
   if os.getenv("build_system") == "msbuild":
@@ -162,6 +150,10 @@ def test_existence(binary: str):
     check_that_tool_does_not_exist(binary, os_id)
     pytest.skip(f"{binary} is not built on 64-bit Windows due to lacking libgd")
 
+  if binary == "gvedit" and platform.system() == "Windows":
+    check_that_tool_does_not_exist(binary, os_id)
+    pytest.skip(f"{binary} is not built on Windows due to lacking Qt")
+
   # FIXME: Smyrna dependencies are not avaiable in other jobs
   if binary == "smyrna" and is_cmake() and platform.system() != "Linux":
     check_that_tool_does_not_exist(binary, os_id)
index be60c4cc3a78e4d745bc8eb1d952f869823d6d11..8d1f0ec12011b36ad6de254c1044171cd6b63a3c 100644 (file)
@@ -37,8 +37,8 @@ def main(args: List[str]) -> int: #pylint: disable=C0116
     os.makedirs(build)
     run(["cmake", "--version"], build)
     run(["cmake", "--log-level=VERBOSE", "-G", "Visual Studio 16 2019", "-A",
-         options.platform, "-Dwith_cxx_api=ON", "--warn-uninitialized",
-         "-Werror=dev", ".."],
+         options.platform, "-Dwith_cxx_api=ON", "-Dwith_gvedit=OFF",
+         "--warn-uninitialized", "-Werror=dev", ".."],
         build)
     run(["cmake", "--build", ".", "--config", options.configuration], build)
     run(["cpack", "-C", options.configuration], build)
index a5f73a8a290e02a90e979a7daef609a0edfd6712..68ff9271cc6063815f38b80242c8f08b7866c3e5 100644 (file)
@@ -1,5 +1,6 @@
 add_subdirectory(dot)
 add_subdirectory(edgepaint)
+add_subdirectory(gvedit)
 add_subdirectory(gvmap)
 add_subdirectory(gvpr)
 add_subdirectory(mingle)
diff --git a/cmd/gvedit/CMakeLists.txt b/cmd/gvedit/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e712304
--- /dev/null
@@ -0,0 +1,76 @@
+if(with_gvedit)
+  find_package(Qt5 COMPONENTS Core PrintSupport Widgets REQUIRED)
+
+  add_executable(gvedit
+    csettings.cpp
+    imageviewer.cpp
+    main.cpp
+    mainwindow.cpp
+    mdi.qrc
+    mdichild.cpp
+  )
+
+  set_target_properties(gvedit PROPERTIES
+    AUTOMOC ON
+    AUTORCC ON
+    AUTOUIC ON
+    AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui"
+  )
+
+  target_compile_definitions(gvedit PRIVATE DEMAND_LOADING=1)
+
+  target_include_directories(gvedit PRIVATE
+    ../../lib
+    ../../lib/cdt
+    ../../lib/cgraph
+    ../../lib/common
+    ../../lib/gvc
+    ../../lib/pathplan
+  )
+
+  target_link_libraries(gvedit PRIVATE
+    cdt
+    cgraph
+    gvc
+  )
+
+  target_link_libraries(gvedit PRIVATE Qt5::Core Qt5::PrintSupport Qt5::Widgets)
+
+  if(EXPAT_FOUND)
+    target_include_directories(gvedit SYSTEM PRIVATE ${EXPAT_INCLUDE_DIRS})
+    target_link_libraries(gvedit PRIVATE ${EXPAT_LIBRARIES})
+  endif()
+
+  install(
+    TARGETS gvedit
+    RUNTIME DESTINATION ${BINARY_INSTALL_DIR}
+    LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
+    ARCHIVE DESTINATION ${LIBRARY_INSTALL_DIR}
+  )
+
+  install(
+    FILES ../../doc/infosrc/attrs
+    DESTINATION ${DATA_INSTALL_DIR}/graphviz/gvedit
+    RENAME attrs.txt
+  )
+
+  if(GZIP)
+    add_custom_target(man-gvedit ALL DEPENDS gvedit.1.gz
+                      COMMENT "gvedit man page")
+    add_custom_command(
+      OUTPUT gvedit.1.gz
+      COMMAND ${GZIP} -9 --no-name --to-stdout gvedit.1
+        >"${CMAKE_CURRENT_BINARY_DIR}/gvedit.1.gz"
+      MAIN_DEPENDENCY gvedit.1
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+      COMMENT "compress gvedit man page")
+    install(
+      FILES ${CMAKE_CURRENT_BINARY_DIR}/gvedit.1.gz
+      DESTINATION ${MAN_INSTALL_DIR}/man1)
+  else()
+    install(
+      FILES gvedit.1
+      DESTINATION ${MAN_INSTALL_DIR}/man1
+    )
+  endif()
+endif()