]> granicus.if.org Git - graphviz/commitdiff
move 'gvpack' into C++
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 13 Apr 2022 15:15:47 +0000 (08:15 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 25 Apr 2022 02:12:48 +0000 (19:12 -0700)
When ipsepcola is enabled, `gvpack` transitively links against lib/vpsc which is
partly written in C++. A consequence of this is that building `gvpack` requires
a C++ toolchain and linking against the C++ standard library. With this in mind,
there is no advantage for `gvpack` itself to be written in C instead of C++.
Moving to C++ will allow removing some manual memory management and data
structures.

This commit itself is just a straight rename. Upcoming changes will make the
code more idiomatic C++.

Gitlab: #2154

ci/clang_format.py
cmd/tools/CMakeLists.txt
cmd/tools/Makefile.am
cmd/tools/gvpack.cpp [moved from cmd/tools/gvpack.c with 100% similarity]
cmd/tools/gvpack.vcxproj
cmd/tools/gvpack.vcxproj.filters

index 6a80e5d3e821ace47efbd330918f01403ca3e9ad..8d4fd549e07e075af12686633b60ac3d71db4e71 100644 (file)
@@ -212,7 +212,7 @@ EXCLUDE = (
   "cmd/tools/gv2gxl.c",
   "cmd/tools/gvcolor.c",
   "cmd/tools/gvgen.c",
-  "cmd/tools/gvpack.c",
+  "cmd/tools/gvpack.cpp",
   "cmd/tools/gxl2gv.c",
   "cmd/tools/matrix_market.c",
   "cmd/tools/matrix_market.h",
index 4e04aade5c4f6c332b541566e4cc5e1f701d372b..1fc244f27cbe70eee91f70c0359cd8568eba26bd 100644 (file)
@@ -275,7 +275,7 @@ add_definitions(-DDEMAND_LOADING=0)
 
 add_executable(gvpack
   # Source files
-  gvpack.c
+  gvpack.cpp
 )
 
 target_include_directories(gvpack PRIVATE
index 218c0756a065994e51448a49faa04aeb32bbc13e..b4c73a2605aaced092b1efbc80e1c2926d9008da 100644 (file)
@@ -139,7 +139,7 @@ gc_LDADD = \
        $(top_builddir)/lib/cgraph/libcgraph.la
 
 
-gvpack_SOURCES = gvpack.c
+gvpack_SOURCES = gvpack.cpp
 gvpack_CPPFLAGS = $(AM_CPPFLAGS) -DDEMAND_LOADING=0
 
 gvpack_LDADD = \
@@ -149,12 +149,8 @@ gvpack_LDADD = \
        $(top_builddir)/lib/cdt/libcdt.la \
        $(top_builddir)/plugin/neato_layout/libgvplugin_neato_layout.la
 
-# add a non-existent C++ source to force the C++ compiler to be used for
-# linking, so the C++ standard library is included for our C++ dependencies
-nodist_EXTRA_gvpack_SOURCES = fake.cxx
-
 if ENABLE_STATIC
-gvpack_static_SOURCES = gvpack.c
+gvpack_static_SOURCES = gvpack.cpp
 gvpack_static_CPPFLAGS = $(AM_CPPFLAGS) -DDEMAND_LOADING=0
 gvpack_static_LDADD = \
        $(top_builddir)/plugin/neato_layout/libgvplugin_neato_layout_C.la \
@@ -164,10 +160,6 @@ gvpack_static_LDADD = \
        $(top_builddir)/lib/cgraph/libcgraph_C.la \
        $(top_builddir)/lib/cdt/libcdt_C.la \
        $(EXPAT_LIBS) $(Z_LIBS) $(GTS_LIBS) $(SOCKET_LIBS) $(IPSEPCOLA_LIBS) $(MATH_LIBS)
-
-# add a non-existent C++ source to force the C++ compiler to be used for
-# linking, so the C++ standard library is included for our C++ dependencies
-nodist_EXTRA_gvpack_static_SOURCES = fake.cxx
 endif
 
 
similarity index 100%
rename from cmd/tools/gvpack.c
rename to cmd/tools/gvpack.cpp
index 97f19def104a6f19b9b60edd7cc90c44330da435..575b20222e40a84c17459cdbe1c1bbe30e1dc2d1 100644 (file)
     <ClInclude Include="graph_generator.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="gvpack.c" />
+    <ClCompile Include="gvpack.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\lib\gvc.vcxproj">
index dfe588e1017990fe171279d71286a4ac7f284787..32da2832ad1085582baa669add21fd897cb2d539 100644 (file)
@@ -20,7 +20,7 @@
     </ClInclude>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="gvpack.c">
+    <ClCompile Include="gvpack.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
   </ItemGroup>