From: Matthew Fernandez Date: Mon, 14 Nov 2022 03:37:35 +0000 (-0800) Subject: add 'gvedit' to the CMake build system X-Git-Tag: 7.0.2~2^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=473399214a3a989ae06897962d11aef4559882a6;p=graphviz add 'gvedit' to the CMake build system 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. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a1bb61e9..b808b1712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 482a8c44c..fc3a377b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/ci/cygwin-build.sh b/ci/cygwin-build.sh index 542cc0f74..73b73defa 100644 --- a/ci/cygwin-build.sh +++ b/ci/cygwin-build.sh @@ -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 diff --git a/ci/mingw-build.sh b/ci/mingw-build.sh index f20b07b25..711edf0fb 100644 --- a/ci/mingw-build.sh +++ b/ci/mingw-build.sh @@ -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 diff --git a/ci/tests.py b/ci/tests.py index db90d79cd..73f917fc1 100644 --- a/ci/tests.py +++ b/ci/tests.py @@ -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) diff --git a/ci/windows_build.py b/ci/windows_build.py index be60c4cc3..8d1f0ec12 100644 --- a/ci/windows_build.py +++ b/ci/windows_build.py @@ -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) diff --git a/cmd/CMakeLists.txt b/cmd/CMakeLists.txt index a5f73a8a2..68ff9271c 100644 --- a/cmd/CMakeLists.txt +++ b/cmd/CMakeLists.txt @@ -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 index 000000000..e71230405 --- /dev/null +++ b/cmd/gvedit/CMakeLists.txt @@ -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()