1. libgd
  2. Untitled project
  3. gd-libgd

Commits

pajoye  committed 1a283dc

- add missing cmake macros/modules

  • Participants
  • Parent commits 34065df
  • Branches master

Comments (0)

Files changed (6)

File src/cmake/modules/FindFontconfig.cmake

View file
+# - Try to find the  Fontconfig
+# Once done this will define
+#
+#  FONTCONFIG_FOUND - system has Fontconfig
+#  FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
+#  FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
+#  FONTCONFIG_INCLUDE_DIR - FontConfig include dir
+# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (FONTCONFIG_LIBRARIES AND FONTCONFIG_DEFINITIONS)
+
+  # in cache already
+  set(FONTCONFIG_FOUND TRUE)
+
+else (FONTCONFIG_LIBRARIES AND FONTCONFIG_DEFINITIONS)
+IF (NOT WIN32)
+  # use pkg-config to get the directories and then use these values
+  # in the FIND_PATH() and FIND_LIBRARY() calls
+  INCLUDE(UsePkgConfig)
+
+  PKGCONFIG(fontconfig _FONTCONFIGIncDir _FONTCONFIGLinkDir _FONTCONFIGLinkFlags _FONTCONFIGCflags)
+
+  set(FONTCONFIG_DEFINITIONS ${_FONTCONFIGCflags} CACHE INTERNAL "The compilation flags for fontconfig")
+ENDIF (NOT WIN32)
+  find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
+    PATHS
+    ${_FONTCONFIGIncDir}
+    /usr/include
+    /usr/local/include
+    /usr/X11/include
+  )
+
+  find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
+    PATHS
+    ${_FONTCONFIGLinkDir}
+    /usr/lib
+    /usr/local/lib
+  )
+
+  if (FONTCONFIG_LIBRARIES)
+     set(FONTCONFIG_FOUND TRUE)
+  endif (FONTCONFIG_LIBRARIES)
+
+  if (FONTCONFIG_FOUND)
+    if (NOT FONTCONFIG_FIND_QUIETLY)
+      message(STATUS "Found FONTCONFIG: ${FONTCONFIG_LIBRARIES}")
+    endif (NOT FONTCONFIG_FIND_QUIETLY)
+  else (FONTCONFIG_FOUND)
+    if (FONTCONFIG_FIND_REQUIRED)
+      message(FATAL_ERROR "Could NOT find FONTCONFIG")
+    endif (FONTCONFIG_FIND_REQUIRED)
+  endif (FONTCONFIG_FOUND)
+
+  MARK_AS_ADVANCED(FONTCONFIG_LIBRARIES)
+
+endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_DEFINITIONS)

File src/cmake/modules/FindFreetype.cmake

View file
+#
+# Find the native FREETYPE includes and library
+#
+
+# This module defines
+# FREETYPE_INCLUDE_DIR, where to find ft2build.h, ftheader.h, ...
+# FREETYPE_LIBRARIES, the libraries to link against to use FREETYPE.
+# FREETYPE_FOUND, If false, do not try to use FREETYPE.
+
+# also defined, but not for general use are
+# FREETYPE_LIBRARY, where to find the FREETYPE library.
+
+FIND_PATH(FREETYPE_INCLUDE_DIR_FT2BUILD ft2build.h
+  /usr/include/
+  /usr/local/include/
+)
+
+FIND_PATH(FREETYPE_INCLUDE_DIR_FTHEADER freetype/config/ftheader.h
+  /usr/include/freetype2
+  /usr/local/include/freetype2
+)
+
+FIND_LIBRARY(FREETYPE_LIBRARY freetype
+  /usr/lib
+  /usr/local/lib
+)
+
+IF (FREETYPE_LIBRARY)
+  IF (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD)
+    SET( FREETYPE_FOUND "YES" )
+    SET( FREETYPE_INCLUDE_DIR
+      ${FREETYPE_INCLUDE_DIR_FT2BUILD}
+      ${FREETYPE_INCLUDE_DIR_FTHEADER} )
+    SET( FREETYPE_LIBRARIES ${FREETYPE_LIBRARY} )
+  ENDIF (FREETYPE_INCLUDE_DIR_FTHEADER AND FREETYPE_INCLUDE_DIR_FT2BUILD)
+ENDIF (FREETYPE_LIBRARY)
+
+MARK_AS_ADVANCED(
+  FREETYPE_INCLUDE_DIR_FT2BUILD
+  FREETYPE_INCLUDE_DIR_FTHEADER
+  )

File src/cmake/modules/FindGD.cmake

View file
+# - Find GD
+# Find the native GD includes and library
+# This module defines
+#  GD_INCLUDE_DIR, where to find gd.h, etc.
+#  GD_LIBRARIES, the libraries needed to use GD.
+#  GD_FOUND, If false, do not try to use GD.
+# also defined, but not for general use are
+#  GD_LIBRARY, where to find the GD library.
+#  GD_SUPPORTS_PNG, GD_SUPPORTS_JPEG, GD_SUPPORTS_GIF, test
+#  support for image formats in GD.
+
+FIND_PATH(GD_INCLUDE_DIR gd.h
+/usr/local/include
+/usr/include
+)
+
+if(WIN32 AND NOT CYGWIN)
+  SET(GD_NAMES ${GD_NAMES} bgd)
+else(WIN32)
+  SET(GD_NAMES ${GD_NAMES} gd)
+endif(WIN32 AND NOT CYGWIN)
+
+FIND_LIBRARY(GD_LIBRARY
+  NAMES ${GD_NAMES}
+  PATHS /usr/lib /usr/local/lib
+  )
+
+IF (GD_LIBRARY AND GD_INCLUDE_DIR)
+    SET(GD_LIBRARIES ${GD_LIBRARY})
+    SET(GD_FOUND "YES")
+ELSE (GD_LIBRARY AND GD_INCLUDE_DIR)
+  SET(GD_FOUND "NO")
+ENDIF (GD_LIBRARY AND GD_INCLUDE_DIR)
+message("Found GD: ${GD_FOUND}")
+IF (GD_FOUND)
+	IF (WIN32 AND NOT CYGWIN)
+		SET(GD_SUPPORTS_PNG ON)
+		SET(GD_SUPPORTS_JPEG ON)
+		SET(GD_SUPPORTS_GIF ON)
+		get_filename_component(GD_LIBRARY_DIR ${GD_LIBRARY} PATH)
+	ELSE (WIN32 AND NOT CYGWIN)
+		INCLUDE(CheckLibraryExists)
+		GET_FILENAME_COMPONENT(GD_LIB_PATH ${GD_LIBRARY} PATH)
+		GET_FILENAME_COMPONENT(GD_LIB ${GD_LIBRARY} NAME)
+
+		CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImagePng" "${GD_LIB_PATH}" GD_SUPPORTS_PNG)
+		IF (GD_SUPPORTS_PNG)
+			find_package(PNG)
+			IF (PNG_FOUND)
+				SET(GD_LIBRARIES ${GD_LIBRARIES} ${PNG_LIBRARIES})
+			SET(GD_INCLUDE_DIR ${GD_INCLUDE_DIR} ${PNG_INCLUDE_DIR})
+			ELSE (PNG_FOUND)
+				SET(GD_SUPPORTS_PNG "NO")
+			ENDIF (PNG_FOUND)
+		ENDIF (GD_SUPPORTS_PNG)
+
+		CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImageJpeg" "${GD_LIB_PATH}" GD_SUPPORTS_JPEG)
+		IF (GD_SUPPORTS_JPEG)
+			find_package(JPEG)
+			IF (JPEG_FOUND)
+				SET(GD_LIBRARIES ${GD_LIBRARIES} ${JPEG_LIBRARIES})
+				SET(GD_INCLUDE_DIR ${GD_INCLUDE_DIR} ${JPEG_INCLUDE_DIR})
+			ELSE (JPEG_FOUND)
+				SET(GD_SUPPORTS_JPEG "NO")
+			ENDIF (JPEG_FOUND)
+		ENDIF (GD_SUPPORTS_JPEG)
+
+		CHECK_LIBRARY_EXISTS("${GD_LIBRARY}" "gdImageGif" "${GD_LIB_PATH}" GD_SUPPORTS_GIF)
+
+		# Trim the list of include directories
+		SET(GDINCTRIM)
+		FOREACH(GD_DIR ${GD_INCLUDE_DIR})
+			SET(GD_TMP_FOUND OFF)
+			FOREACH(GD_TRIMMED ${GDINCTRIM})
+				IF ("${GD_DIR}" STREQUAL "${GD_TRIMMED}")
+				SET(GD_TMP_FOUND ON)
+				ENDIF ("${GD_DIR}" STREQUAL "${GD_TRIMMED}")
+			ENDFOREACH(GD_TRIMMED ${GDINCTRIM})
+			IF (NOT GD_TMP_FOUND)
+				SET(GDINCTRIM "${GDINCTRIM}" "${GD_DIR}")
+			ENDIF (NOT GD_TMP_FOUND)
+		ENDFOREACH(GD_DIR ${GD_INCLUDE_DIR})
+		SET(GD_INCLUDE_DIR ${GDINCTRIM})
+
+		SET(GD_LIBRARY_DIR)
+
+		# Generate trimmed list of library directories and list of libraries
+		FOREACH(GD_LIB ${GD_LIBRARIES})
+			GET_FILENAME_COMPONENT(GD_NEXTLIBDIR ${GD_LIB} PATH)
+			SET(GD_TMP_FOUND OFF)
+			FOREACH(GD_LIBDIR ${GD_LIBRARY_DIR})
+				IF ("${GD_NEXTLIBDIR}" STREQUAL "${GD_LIBDIR}")
+					SET(GD_TMP_FOUND ON)
+				ENDIF ("${GD_NEXTLIBDIR}" STREQUAL "${GD_LIBDIR}")
+			ENDFOREACH(GD_LIBDIR ${GD_LIBRARIES})
+			IF (NOT GD_TMP_FOUND)
+				SET(GD_LIBRARY_DIR "${GD_LIBRARY_DIR}" "${GD_NEXTLIBDIR}")
+			ENDIF (NOT GD_TMP_FOUND)
+		ENDFOREACH(GD_LIB ${GD_LIBRARIES})
+	ENDIF (WIN32 AND NOT CYGWIN)
+ENDIF (GD_FOUND)
+
+IF (GD_FOUND)
+   IF (NOT GD_FIND_QUIETLY)
+      MESSAGE(STATUS "Found GD: ${GD_LIBRARY}")
+   ENDIF (NOT GD_FIND_QUIETLY)
+ELSE (GD_FOUND)
+   IF (GD_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "Could not find GD library")
+   ENDIF (GD_FIND_REQUIRED)
+ENDIF (GD_FOUND)
+
+MARK_AS_ADVANCED(
+  GD_LIBRARY
+  GD_LIBRARIES
+  GD_INCLUDE_DIR
+  GD_LIBRARY_DIR
+  GD_SUPPORTS_PNG
+  GD_SUPPORTS_JPEG
+  GD_SUPPORTS_GIF
+)

File src/cmake/modules/FindPNG.cmake

View file
+# - Find the native PNG includes and library
+#
+
+# This module defines
+#  PNG_INCLUDE_DIR, where to find png.h, etc.
+#  PNG_LIBRARIES, the libraries to link against to use PNG.
+#  PNG_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
+#  PNG_FOUND, If false, do not try to use PNG.
+# also defined, but not for general use are
+#  PNG_LIBRARY, where to find the PNG library.
+# None of the above will be defined unles zlib can be found.
+# PNG depends on Zlib
+#
+# Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+
+INCLUDE(FindZLIB)
+
+SET(PNG_FOUND "NO")
+
+IF(ZLIB_FOUND)
+  FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
+  /usr/local/include
+  /usr/include
+  /usr/local/include/libpng             # OpenBSD
+  )
+
+  SET(PNG_NAMES ${PNG_NAMES} png libpng)
+  FIND_LIBRARY(PNG_LIBRARY
+    NAMES ${PNG_NAMES}
+    PATHS /usr/lib /usr/local/lib
+  )
+
+  IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
+      # png.h includes zlib.h. Sigh.
+      SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+      SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
+      SET(PNG_FOUND "YES")
+			SET(HAVE_PNG_H)
+      IF (CYGWIN)
+        IF(BUILD_SHARED_LIBS)
+           # No need to define PNG_USE_DLL here, because it's default for Cygwin.
+        ELSE(BUILD_SHARED_LIBS)
+          SET (PNG_DEFINITIONS -DPNG_STATIC)
+        ENDIF(BUILD_SHARED_LIBS)
+      ENDIF (CYGWIN)
+
+  ENDIF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
+
+ENDIF(ZLIB_FOUND)
+
+IF (PNG_FOUND)
+  IF (NOT PNG_FIND_QUIETLY)
+    MESSAGE(STATUS "Found PNG: ${PNG_LIBRARY}")
+  ENDIF (NOT PNG_FIND_QUIETLY)
+ELSE (PNG_FOUND)
+  IF (PNG_FIND_REQUIRED)
+    MESSAGE(FATAL_ERROR "Could not find PNG library")
+  ENDIF (PNG_FIND_REQUIRED)
+ENDIF (PNG_FOUND)
+
+MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )

File src/cmake/modules/FindPTHREAD.cmake

View file
+#############################################################################
+#
+# $Id$
+#
+# Copyright (C) 1998-2006 Inria. All rights reserved.
+#
+# This software was developed at:
+# IRISA/INRIA Rennes
+# Projet Lagadic
+# Campus Universitaire de Beaulieu
+# 35042 Rennes Cedex
+# http://www.irisa.fr/lagadic
+#
+# This file is part of the ViSP toolkit.
+#
+# This file may be distributed under the terms of the Q Public License
+# as defined by Trolltech AS of Norway and appearing in the file
+# LICENSE included in the packaging of this file.
+#
+# Licensees holding valid ViSP Professional Edition licenses may
+# use this file in accordance with the ViSP Commercial License
+# Agreement provided with the Software.
+#
+# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+#
+# Contact visp@irisa.fr if any conditions of this licensing are
+# not clear to you.
+#
+# Description:
+# Try to find pthread library.
+# Once run this will define:
+#
+# PTHREAD_FOUND
+# PTHREAD_INCLUDE_DIR
+# PTHREAD_LIBRARIES
+#
+# Authors:
+# Fabien Spindler
+#
+#############################################################################
+
+#IF(NOT UNIX AND NOT WIN32)
+#  SET(PTHREAD_FOUND FALSE)
+#ELSE(NOT UNIX AND NOT WIN32)
+
+  FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h
+    /usr/include
+    $ENV{PTHREAD_INCLUDE_PATH}
+    )
+  #MESSAGE("DBG PTHREAD_INCLUDE_DIR=${PTHREAD_INCLUDE_DIR}")
+
+  # pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2 are comming from web
+  FIND_LIBRARY(PTHREAD_LIBRARY
+    NAMES pthread pthreadGC2 pthreadVSE pthreadGCE pthreadGC pthreadVC1 pthreadVC2
+    PATHS
+    /usr/lib
+    /usr/local/lib
+    /lib
+    $ENV{PTHREAD_LIBRARY_PATH}
+    )
+
+  #MESSAGE(STATUS "DBG PTHREAD_LIBRARY=${PTHREAD_LIBRARY}")
+
+  ## --------------------------------
+
+  IF(PTHREAD_LIBRARY)
+    SET(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
+  ELSE(PTHREAD_LIBRARY)
+    #MESSAGE(SEND_ERROR "pthread library not found.")
+  ENDIF(PTHREAD_LIBRARY)
+
+  IF(NOT PTHREAD_INCLUDE_DIR)
+    #MESSAGE(SEND_ERROR "pthread include dir not found.")
+  ENDIF(NOT PTHREAD_INCLUDE_DIR)
+
+  IF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
+    SET(PTHREAD_FOUND TRUE)
+  ELSE(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
+    SET(PTHREAD_FOUND FALSE)
+  ENDIF(PTHREAD_LIBRARIES AND PTHREAD_INCLUDE_DIR)
+
+  #MARK_AS_ADVANCED(
+  #  PTHREAD_INCLUDE_DIR
+  #  PTHREAD_LIBRARIES
+  #  )
+  #MESSAGE(STATUS "PTHREAD_FOUND : ${PTHREAD_FOUND}")
+
+#ENDIF(NOT UNIX AND NOT WIN32)

File src/cmake/modules/FindXPM.cmake

View file
+# - Find the native PNG includes and library
+#
+
+# This module defines
+#  XPM_INCLUDE_DIR, where to find png.h, etc.
+#  XPM_LIBRARIES, the libraries to link against to use PNG.
+#  XPM_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
+#  XPM_FOUND, If false, do not try to use PNG.
+# also defined, but not for general use are
+#  XPM_LIBRARY, where to find the PNG library.
+# None of the above will be defined unles zlib can be found.
+# PNG depends on Zlib
+#
+# Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+# See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+
+INCLUDE(FindZLIB)
+
+SET(XPM_FOUND "NO")
+
+FIND_PATH(XPM_XPM_INCLUDE_DIR xpm.h
+/usr/local/include/X11
+/usr/include/X11
+)
+
+SET(XPM_NAMES ${XPM_NAMES} Xpm libXpm)
+FIND_LIBRARY(XPM_LIBRARY
+ NAMES ${XPM_NAMES}
+ PATHS /usr/lib /usr/local/lib
+)
+
+IF (XPM_LIBRARY AND XPM_XPM_INCLUDE_DIR)
+	SET(XPM_INCLUDE_DIR ${XPM_XPM_INCLUDE_DIR})
+	SET(XPM_LIBRARIES ${XPM_LIBRARY})
+	SET(XPM_FOUND "YES")
+
+	IF (CYGWIN)
+	  IF(BUILD_SHARED_LIBS)
+		  # No need to define XPM_USE_DLL here, because it's default for Cygwin.
+	  ELSE(BUILD_SHARED_LIBS)
+		 SET (XPM_DEFINITIONS -DXPM_STATIC)
+	  ENDIF(BUILD_SHARED_LIBS)
+	ENDIF (CYGWIN)
+ENDIF (XPM_LIBRARY AND XPM_XPM_INCLUDE_DIR)
+
+IF (XPM_FOUND)
+  IF (NOT XPM_FIND_QUIETLY)
+    MESSAGE(STATUS "Found XPM: ${XPM_LIBRARY}")
+  ENDIF (NOT XPM_FIND_QUIETLY)
+ELSE (XPM_FOUND)
+  IF (XPM_FIND_REQUIRED)
+    MESSAGE(FATAL_ERROR "Could not find XPM library")
+  ENDIF (XPM_FIND_REQUIRED)
+ENDIF (XPM_FOUND)
+
+MARK_AS_ADVANCED(XPM_XPM_INCLUDE_DIR XPM_LIBRARY )