Moved finding of RSVG, Poppler-glib and GtkGl out into their own Find*.cmake modules to enable easier specialization.
This commit is contained in:
parent
bda7ef8179
commit
6cc7e109d3
@ -385,6 +385,9 @@ FIND_PACKAGE(XUL)
|
||||
FIND_PACKAGE(FFmpeg)
|
||||
FIND_PACKAGE(DirectShow)
|
||||
FIND_PACKAGE(SDL)
|
||||
FIND_PACKAGE(Poppler-glib)
|
||||
FIND_PACKAGE(RSVG)
|
||||
FIND_PACKAGE(GtkGl)
|
||||
|
||||
# Include macro utilities here
|
||||
INCLUDE(OsgMacroUtils)
|
||||
@ -409,28 +412,6 @@ ELSE()
|
||||
|
||||
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
|
||||
IF (BUILD_OSG_EXAMPLES)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Locate gdal
|
||||
# Locate FLTK
|
||||
# This module defines
|
||||
# FLTK_LIBRARY
|
||||
# FLTK_FOUND, if false, do not try to link to gdal
|
||||
|
16
CMakeModules/FindGtkGl.cmake
Normal file
16
CMakeModules/FindGtkGl.cmake
Normal 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()
|
41
CMakeModules/FindPoppler-glib.cmake
Normal file
41
CMakeModules/FindPoppler-glib.cmake
Normal 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()
|
16
CMakeModules/FindRSVG.cmake
Normal file
16
CMakeModules/FindRSVG.cmake
Normal 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()
|
@ -93,10 +93,10 @@ IF (NOT DYNAMIC_OPENSCENEGRAPH)
|
||||
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_freetype)
|
||||
ENDIF(FREETYPE_FOUND)
|
||||
|
||||
IF(POPPLER_FOUND AND CAIRO_FOUND)
|
||||
IF(POPPLER_FOUND)
|
||||
ADD_DEFINITIONS(-DUSE_POPPLER_CAIRO)
|
||||
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_pdf)
|
||||
ENDIF(POPPLER_FOUND AND CAIRO_FOUND)
|
||||
ENDIF(POPPLER_FOUND)
|
||||
ENDIF()
|
||||
|
||||
IF (WIN32)
|
||||
|
@ -234,11 +234,11 @@ IF(ZLIB_FOUND)
|
||||
ADD_SUBDIRECTORY(zip)
|
||||
ENDIF()
|
||||
|
||||
IF(RSVG_FOUND AND CAIRO_FOUND)
|
||||
IF(RSVG_FOUND)
|
||||
ADD_SUBDIRECTORY(svg)
|
||||
ENDIF()
|
||||
|
||||
IF(POPPLER_FOUND AND CAIRO_FOUND)
|
||||
IF(POPPLER_FOUND)
|
||||
ADD_SUBDIRECTORY(pdf)
|
||||
ENDIF()
|
||||
|
||||
|
@ -1,33 +1,10 @@
|
||||
INCLUDE(CheckCXXSourceRuns)
|
||||
SET(TARGET_SRC ReaderWriterPDF.cpp )
|
||||
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES( ${CAIRO_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} )
|
||||
LINK_DIRECTORIES(${CAIRO_LIBRARY_DIRS} ${POPPLER_LIBRARY_DIRS})
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${CAIRO_LIBRARIES} ${POPPLER_LIBRARIES} )
|
||||
|
||||
# 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)
|
||||
SET(TARGET_ADDED_LIBRARIES osgWidget)
|
||||
|
||||
|
||||
IF (POPPLER_HAS_CAIRO)
|
||||
|
||||
SET(TARGET_SRC ReaderWriterPDF.cpp )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CAIRO_INCLUDE_DIRS} ${POPPLER_INCLUDE_DIRS} )
|
||||
LINK_DIRECTORIES(${CAIRO_LIBRARY_DIRS} ${POPPLER_LIBRARY_DIRS})
|
||||
SET(TARGET_EXTERNAL_LIBRARIES ${CAIRO_LIBRARIES} ${POPPLER_LIBRARIES} )
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgWidget)
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(pdf pdf)
|
||||
|
||||
ENDIF()
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(pdf pdf)
|
||||
|
Loading…
Reference in New Issue
Block a user