From 057e109aa0b6910510f893a3e7138601edae1710 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 9 Nov 2010 14:57:20 +0000 Subject: [PATCH] From Wang Rui, "I'm now testing static building of OSG and found a possible bug in the present3D application. As static-link present3d should depend on freetype, png, pdf and some other plugins, any mis-compiling of these plugins will make present3d fail to be built. Some lirbaries like poppler and cairo are not popular under Windows, so it is very common that we don't have osgdb_pdf compiled and thus get errors when building present3d. I've modified the CMakeLists and present3d.cpp to avoid this problem." --- applications/present3D/CMakeLists.txt | 40 ++++++++++++++++++++------- applications/present3D/present3D.cpp | 33 +++++++++++++++------- 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/applications/present3D/CMakeLists.txt b/applications/present3D/CMakeLists.txt index 09da1b1d8..d538ab5f7 100644 --- a/applications/present3D/CMakeLists.txt +++ b/applications/present3D/CMakeLists.txt @@ -50,20 +50,40 @@ IF (NOT DYNAMIC_OPENSCENEGRAPH) osgdb_ive osgdb_osg osgdb_p3d - - osgdb_freetype - osgdb_pdf osgdb_rgb - osgdb_jpeg - osgdb_png - - osgdb_ffmpeg - osgdb_openflight osgdb_obj - - osgdb_curl ) + + IF(JPEG_FOUND) + ADD_DEFINITIONS(-DUSE_JPEG) + SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_jpeg) + ENDIF(JPEG_FOUND) + + IF(PNG_FOUND) + ADD_DEFINITIONS(-DUSE_PNG) + SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_png) + ENDIF(PNG_FOUND) + + IF(CURL_FOUND) + ADD_DEFINITIONS(-DUSE_CURL) + SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_curl) + ENDIF(CURL_FOUND) + + IF(FFMPEG_FOUND) + ADD_DEFINITIONS(-DUSE_FFMPEG) + SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_ffmpeg) + ENDIF(FFMPEG_FOUND) + + IF(FREETYPE_FOUND) + ADD_DEFINITIONS(-DUSE_FREETYPE) + SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_freetype) + ENDIF(FREETYPE_FOUND) + + IF(POPPLER_FOUND AND CAIRO_FOUND) + ADD_DEFINITIONS(-DUSE_POPPLER_CAIRO) + SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_pdf) + ENDIF(POPPLER_FOUND AND CAIRO_FOUND) ENDIF() IF (WIN32) diff --git a/applications/present3D/present3D.cpp b/applications/present3D/present3D.cpp index 01842960d..e5e676293 100644 --- a/applications/present3D/present3D.cpp +++ b/applications/present3D/present3D.cpp @@ -56,27 +56,40 @@ #include "SDLIntegration.h" #endif -#if OSG_LIBRARY_STATIC +#ifdef OSG_LIBRARY_STATIC // include the plugins we need USE_OSGPLUGIN(ive) USE_OSGPLUGIN(osg) USE_OSGPLUGIN(p3d) USE_OSGPLUGIN(paths) - - USE_OSGPLUGIN(freetype) USE_OSGPLUGIN(rgb) - USE_OSGPLUGIN(png) - USE_OSGPLUGIN(jpeg) - - USE_OSGPLUGIN(ffmpeg) - USE_OSGPLUGIN(pdf) - USE_OSGPLUGIN(OpenFlight) USE_OSGPLUGIN(obj) - USE_OSGPLUGIN(curl) +#ifdef USE_FREETYPE + USE_OSGPLUGIN(freetype) +#endif +#ifdef USE_PNG + USE_OSGPLUGIN(png) +#endif + +#ifdef USE_JPEG + USE_OSGPLUGIN(jpeg) +#endif + +#ifdef USE_FFMPEG + USE_OSGPLUGIN(ffmpeg) +#endif + +#ifdef USE_POPPLER_CAIRO + USE_OSGPLUGIN(pdf) +#endif + +#ifdef USE_CURL + USE_OSGPLUGIN(curl) +#endif // include the platform specific GraphicsWindow implementation. USE_GRAPHICSWINDOW()