]> granicus.if.org Git - graphviz/commitdiff
CMake: Add support for GNU Triangulated Surface Library
authorNehal J Wani <nehaljw.kkd1@gmail.com>
Tue, 16 Feb 2021 23:38:18 +0000 (18:38 -0500)
committerNehal J Wani <nehaljw.kkd1@gmail.com>
Mon, 9 Jan 2023 21:41:50 +0000 (21:41 +0000)
CMakeLists.txt
cmake/FindGTS.cmake [new file with mode: 0644]
cmake/config_checks.cmake
config-cmake.h.in
lib/neatogen/CMakeLists.txt

index e425ae38c055882d26e45e05f32260f82d837980..2883c2565b47cae7cd8806a90264b16750b92853 100644 (file)
@@ -113,6 +113,7 @@ if(with_expat)
 endif()
 
 find_package(GD)
+find_package(GTS)
 
 if(enable_ltdl)
   find_package(LTDL)
diff --git a/cmake/FindGTS.cmake b/cmake/FindGTS.cmake
new file mode 100644 (file)
index 0000000..ae4176a
--- /dev/null
@@ -0,0 +1,50 @@
+include(FindPackageHandleStandardArgs)
+if(WIN32)
+  find_path(GTS_INCLUDE_DIR gts.h)
+  find_path(GLIB_INCLUDE_DIR glib.h PATH_SUFFIXES glib-2.0)
+  find_path(GLIBCONFIG_INCLUDE_DIR glibconfig.h
+            PATH_SUFFIXES glib-2.0/include lib/glib-2.0/include)
+
+  find_library(GTS_LIBRARY NAMES gts)
+  find_library(GLIB_LIBRARY NAMES glib-2.0)
+
+  find_program(GTS_RUNTIME_LIBRARY gts.dll)
+  find_program(GLIB_RUNTIME_LIBRARY NAMES glib-2.dll libglib-2.0-0.dll)
+
+  find_package_handle_standard_args(GTS DEFAULT_MSG
+    GTS_INCLUDE_DIR
+    GLIB_INCLUDE_DIR
+    GLIBCONFIG_INCLUDE_DIR
+
+    GTS_LIBRARY
+    GLIB_LIBRARY
+
+    GTS_RUNTIME_LIBRARY
+    GLIB_RUNTIME_LIBRARY
+  )
+
+  set(GTS_INCLUDE_DIRS
+    ${GTS_INCLUDE_DIR}
+    ${GLIB_INCLUDE_DIR}
+    ${GLIBCONFIG_INCLUDE_DIR}
+  )
+
+  set(GTS_LIBRARIES
+    ${GTS_LIBRARY}
+    ${GLIB_LIBRARY}
+  )
+
+  set(GTS_RUNTIME_LIBRARIES
+    ${GTS_RUNTIME_LIBRARY}
+    ${GLIB_RUNTIME_LIBRARY}
+  )
+else()
+  find_package(PkgConfig)
+  pkg_check_modules(GTS gts)
+
+  find_package_handle_standard_args(GTS DEFAULT_MSG
+    GTS_INCLUDE_DIRS
+    GTS_LIBRARIES
+    GTS_LINK_LIBRARIES
+  )
+endif()
index 8046df3e3bd6d5e8f09b20941596fe3665841d84..d633d07493c6c4509fe5ea7a33bf5143aba084d6 100644 (file)
@@ -32,6 +32,7 @@ if(with_expat AND EXPAT_FOUND)
   set(HAVE_EXPAT 1)
 endif()
 set( HAVE_LIBGD     ${GD_FOUND}         )
+set( HAVE_GTS       ${GTS_FOUND}        )
 if(with_zlib AND ZLIB_FOUND)
   set(HAVE_ZLIB 1)
 endif()
index c850d221b9f138c94474a11748c40b7d84034387..6017b42b13b29d86cdb436bfda759ea74837f2a9 100644 (file)
@@ -39,6 +39,7 @@ typedef SSIZE_T ssize_t;
 #cmakedefine HAVE_GD_FREETYPE
 #cmakedefine HAVE_GD_GIF
 #cmakedefine HAVE_ZLIB
+#cmakedefine HAVE_GTS
 
 // Values
 #define BROWSER "@BROWSER@"
index 129e65faf1bcd240930e80efa1b67ed85959eec6..728a2b0ceda79058eb73bd04d2ba19bee2c33b31 100644 (file)
@@ -105,4 +105,15 @@ target_link_libraries(neatogen PRIVATE
   gvc
   pathplan
   sparse
+  rbtree
 )
+
+if(GTS_FOUND)
+  target_include_directories(neatogen PRIVATE
+    ${GTS_INCLUDE_DIRS}
+  )
+
+  target_link_libraries(neatogen PRIVATE
+    ${GTS_LINK_LIBRARIES}
+  )
+endif()