From 06cc10aece2b125cb0c6a1c3492883bac04e2f95 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 7 Jun 2022 18:52:45 -0700 Subject: [PATCH 1/3] CMake: link -lm globally on Unix instead of fine-grained It is simpler to express this dependency globally than to try to manage a dependency on such a fundamental part of the C standard library on a case-by-case basis. --- CMakeLists.txt | 1 + cmd/edgepaint/CMakeLists.txt | 1 - cmd/gvmap/CMakeLists.txt | 1 - cmd/smyrna/CMakeLists.txt | 1 - cmd/tools/CMakeLists.txt | 6 ------ lib/glcomp/CMakeLists.txt | 1 - lib/gvc/CMakeLists.txt | 4 ---- lib/pathplan/CMakeLists.txt | 4 ---- lib/sparse/CMakeLists.txt | 4 ---- plugin/lasi/CMakeLists.txt | 1 - 10 files changed, 1 insertion(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ee5f970d..8b18c0d6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,6 +129,7 @@ endif() if(UNIX) find_library(MATH_LIB m) + link_libraries(${MATH_LIB}) endif() if(WIN32) diff --git a/cmd/edgepaint/CMakeLists.txt b/cmd/edgepaint/CMakeLists.txt index 82398933f..8b3e464b3 100644 --- a/cmd/edgepaint/CMakeLists.txt +++ b/cmd/edgepaint/CMakeLists.txt @@ -23,7 +23,6 @@ if(with_sfdp) rbtree sfdpgen sparse - ${MATH_LIB} ) if(NOT HAVE_GETOPT_H) diff --git a/cmd/gvmap/CMakeLists.txt b/cmd/gvmap/CMakeLists.txt index 32c5dfedf..e3d91a1cf 100644 --- a/cmd/gvmap/CMakeLists.txt +++ b/cmd/gvmap/CMakeLists.txt @@ -30,7 +30,6 @@ if(with_sfdp) rbtree sfdpgen sparse - ${MATH_LIB} ) if(NOT HAVE_GETOPT_H) diff --git a/cmd/smyrna/CMakeLists.txt b/cmd/smyrna/CMakeLists.txt index 6621bea4b..1b7597b25 100644 --- a/cmd/smyrna/CMakeLists.txt +++ b/cmd/smyrna/CMakeLists.txt @@ -116,7 +116,6 @@ if(with_smyrna) ${GTK2_LIBRARIES} ${GTKGLEXT_LIBRARIES} ${GTS_LIBRARIES} - ${MATH_LIB} ${XRENDER_LIBRARIES} ) diff --git a/cmd/tools/CMakeLists.txt b/cmd/tools/CMakeLists.txt index 1fc244f27..39a4930f2 100644 --- a/cmd/tools/CMakeLists.txt +++ b/cmd/tools/CMakeLists.txt @@ -231,7 +231,6 @@ target_include_directories(gvcolor SYSTEM PRIVATE target_link_libraries(gvcolor cgraph ingraphs - ${MATH_LIB} ) tool_defaults(gvcolor) @@ -261,11 +260,6 @@ target_include_directories(gvgen SYSTEM PRIVATE target_link_libraries(gvgen cgraph) -# Link to math library -if(UNIX) - target_link_libraries(gvgen ${MATH_LIB}) -endif() - tool_defaults(gvgen) # =================================== gvpack =================================== diff --git a/lib/glcomp/CMakeLists.txt b/lib/glcomp/CMakeLists.txt index e11b9d9c1..1ca639674 100644 --- a/lib/glcomp/CMakeLists.txt +++ b/lib/glcomp/CMakeLists.txt @@ -52,7 +52,6 @@ if(with_smyrna) ${Freetype_LIBRARIES} ${GLUT_LIBRARIES} ${GTK2_LIBRARIES} - ${MATH_LIB} ${PANGOCAIRO_LIBRARIES} ${XRENDER_LIBRARIES} ) diff --git a/lib/gvc/CMakeLists.txt b/lib/gvc/CMakeLists.txt index 81bdeb195..b437bde8c 100644 --- a/lib/gvc/CMakeLists.txt +++ b/lib/gvc/CMakeLists.txt @@ -64,10 +64,6 @@ target_link_libraries(gvc PRIVATE pack ) -target_link_libraries(gvc PUBLIC - ${MATH_LIB} -) - if(LTDL_FOUND) target_include_directories(gvc SYSTEM PRIVATE ${LTDL_INCLUDE_DIRS}) if(NOT WIN32 OR MINGW) diff --git a/lib/pathplan/CMakeLists.txt b/lib/pathplan/CMakeLists.txt index 592c58e26..641296dfd 100644 --- a/lib/pathplan/CMakeLists.txt +++ b/lib/pathplan/CMakeLists.txt @@ -67,7 +67,3 @@ set_target_properties(pathplan PROPERTIES VERSION 4.0.0 SOVERSION 4 ) -target_link_libraries( - pathplan - ${MATH_LIB} -) diff --git a/lib/sparse/CMakeLists.txt b/lib/sparse/CMakeLists.txt index d619d49d1..94293f032 100644 --- a/lib/sparse/CMakeLists.txt +++ b/lib/sparse/CMakeLists.txt @@ -32,7 +32,3 @@ target_include_directories(sparse PRIVATE ../cgraph ../common ) - -target_link_libraries(sparse - ${MATH_LIB} -) diff --git a/plugin/lasi/CMakeLists.txt b/plugin/lasi/CMakeLists.txt index 2655b3615..f7f20d6aa 100644 --- a/plugin/lasi/CMakeLists.txt +++ b/plugin/lasi/CMakeLists.txt @@ -31,7 +31,6 @@ if(Freetype_FOUND AND LASI_FOUND AND PANGOCAIRO_FOUND) target_link_libraries(gvplugin_lasi ${Freetype_LIBRARIES} ${LASI_LIBRARIES} - ${MATH_LIB} ${PANGOCAIRO_LIBRARIES} ) -- GitLab From f857dcbd2d3b15d28c374b41282734b5e676ce53 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 5 Jun 2022 10:54:16 -0700 Subject: [PATCH 2/3] xdot: take a double instead of a float parameter in 'printFloat' Every call to this function passes a double. This change squashes 12 -Wfloat-conversion warnings. --- lib/xdot/xdot.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/xdot/xdot.c b/lib/xdot/xdot.c index ac2ba196c..4d8f54df0 100644 --- a/lib/xdot/xdot.c +++ b/lib/xdot/xdot.c @@ -467,8 +467,7 @@ static void printInt(int i, pf print, void *info) print(buf, info); } -static void printFloat(float f, pf print, void *info, int space) -{ +static void printFloat(double f, pf print, void *info, int space) { char buf[128]; if (space) -- GitLab From 2ec5ce86f648d52c1ab2ec9c2c401f5721bb0798 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Tue, 7 Jun 2022 20:20:44 -0700 Subject: [PATCH 3/3] gvcolor: fix: link -lm Commit 0efe2864048439507ddceda1d82d2159ad171f0d introduced a dependency on libm functions but missed adding this dependency to the Autotools build system. Gitlab: fixes #2246 --- CHANGELOG.md | 2 ++ cmd/tools/Makefile.am | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/tools/Makefile.am b/cmd/tools/Makefile.am index 3f432ea0c..818fe5a58 100644 --- a/cmd/tools/Makefile.am +++ b/cmd/tools/Makefile.am @@ -122,8 +122,8 @@ gvcolor_SOURCES = gvcolor.c colxlate.c colortbl.h gvcolor_LDADD = \ $(top_builddir)/lib/ingraphs/libingraphs_C.la \ - $(top_builddir)/lib/cgraph/libcgraph.la - + $(top_builddir)/lib/cgraph/libcgraph.la \ + $(MATH_LIBS) bcomps_SOURCES = bcomps.c -- GitLab