Moved finding of RSVG, Poppler-glib and GtkGl out into their own Find*.cmake modules to enable easier specialization.

This commit is contained in:
Robert Osfield 2010-11-11 16:51:46 +00:00
parent bda7ef8179
commit 6cc7e109d3
8 changed files with 88 additions and 57 deletions

View File

@ -385,6 +385,9 @@ FIND_PACKAGE(XUL)
FIND_PACKAGE(FFmpeg) FIND_PACKAGE(FFmpeg)
FIND_PACKAGE(DirectShow) FIND_PACKAGE(DirectShow)
FIND_PACKAGE(SDL) FIND_PACKAGE(SDL)
FIND_PACKAGE(Poppler-glib)
FIND_PACKAGE(RSVG)
FIND_PACKAGE(GtkGl)
# Include macro utilities here # Include macro utilities here
INCLUDE(OsgMacroUtils) INCLUDE(OsgMacroUtils)
@ -409,28 +412,6 @@ ELSE()
ENDIF() ENDIF()
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(GTK gtk+-2.0)
IF(WIN32)
PKG_CHECK_MODULES(GTKGL gtkglext-win32-1.0)
ELSE()
PKG_CHECK_MODULES(GTKGL gtkglext-x11-1.0)
ENDIF()
PKG_CHECK_MODULES(RSVG librsvg-2.0)
PKG_CHECK_MODULES(CAIRO cairo)
PKG_CHECK_MODULES(POPPLER poppler-glib)
ENDIF()
#optional example related dependencies #optional example related dependencies
IF (BUILD_OSG_EXAMPLES) IF (BUILD_OSG_EXAMPLES)

View File

@ -1,4 +1,4 @@
# Locate gdal # Locate FLTK
# This module defines # This module defines
# FLTK_LIBRARY # FLTK_LIBRARY
# FLTK_FOUND, if false, do not try to link to gdal # FLTK_FOUND, if false, do not try to link to gdal

View File

@ -0,0 +1,16 @@
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(GTK gtk+-2.0)
IF(WIN32)
PKG_CHECK_MODULES(GTKGL gtkglext-win32-1.0)
ELSE()
PKG_CHECK_MODULES(GTKGL gtkglext-x11-1.0)
ENDIF()
ENDIF()

View File

@ -0,0 +1,41 @@
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(CAIRO cairo)
PKG_CHECK_MODULES(POPPLER poppler-glib)
IF (POPPLER_FOUND)
INCLUDE(CheckCXXSourceRuns)
SET(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIRS})
# Do step by step checking,
CHECK_CXX_SOURCE_RUNS("
#include <cstdlib>
#include <poppler.h>
int main()
{
#ifdef POPPLER_HAS_CAIRO
return EXIT_SUCCESS;
#else
return EXIT_FAILURE
#endif
}
" POPPLER_HAS_CAIRO)
IF (NOT POPPLER_HAS_CAIRO)
SET(POPPLER_FOUND FALSE)
ENDIF()
ENDIF()
# IF (POPPLER_FOUND AND (NOT POPPLER_LIBRARIES OR NOT POPPLER_INCLUDE_DIRS) )
# SET(POPPLER_FOUND FALSE)
# ENDIF()
ENDIF()

View File

@ -0,0 +1,16 @@
#use pkg-config to find various modues
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(RSVG librsvg-2.0)
PKG_CHECK_MODULES(CAIRO cairo)
IF (RSVG_FOUND AND NOT CAIRO_FOUND)
SET(RSVG_FOUND FALSE)
ENDIF()
ENDIF()

View File

@ -93,10 +93,10 @@ IF (NOT DYNAMIC_OPENSCENEGRAPH)
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_freetype) SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_freetype)
ENDIF(FREETYPE_FOUND) ENDIF(FREETYPE_FOUND)
IF(POPPLER_FOUND AND CAIRO_FOUND) IF(POPPLER_FOUND)
ADD_DEFINITIONS(-DUSE_POPPLER_CAIRO) ADD_DEFINITIONS(-DUSE_POPPLER_CAIRO)
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_pdf) SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_pdf)
ENDIF(POPPLER_FOUND AND CAIRO_FOUND) ENDIF(POPPLER_FOUND)
ENDIF() ENDIF()
IF (WIN32) IF (WIN32)

View File

@ -234,11 +234,11 @@ IF(ZLIB_FOUND)
ADD_SUBDIRECTORY(zip) ADD_SUBDIRECTORY(zip)
ENDIF() ENDIF()
IF(RSVG_FOUND AND CAIRO_FOUND) IF(RSVG_FOUND)
ADD_SUBDIRECTORY(svg) ADD_SUBDIRECTORY(svg)
ENDIF() ENDIF()
IF(POPPLER_FOUND AND CAIRO_FOUND) IF(POPPLER_FOUND)
ADD_SUBDIRECTORY(pdf) ADD_SUBDIRECTORY(pdf)
ENDIF() ENDIF()

View File

@ -1,24 +1,3 @@
INCLUDE(CheckCXXSourceRuns)
SET(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIRS})
# Do step by step checking,
CHECK_CXX_SOURCE_RUNS("
#include <cstdlib>
#include <poppler.h>
int main()
{
#ifdef POPPLER_HAS_CAIRO
return EXIT_SUCCESS;
#else
return EXIT_FAILURE
#endif
}
" POPPLER_HAS_CAIRO)
IF (POPPLER_HAS_CAIRO)
SET(TARGET_SRC ReaderWriterPDF.cpp ) SET(TARGET_SRC ReaderWriterPDF.cpp )
INCLUDE_DIRECTORIES( ${CAIRO_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} ) INCLUDE_DIRECTORIES( ${CAIRO_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} )
@ -29,5 +8,3 @@ IF (POPPLER_HAS_CAIRO)
#### end var setup ### #### end var setup ###
SETUP_PLUGIN(pdf pdf) SETUP_PLUGIN(pdf pdf)
ENDIF()