From 297dd320115856432bbab493bf5451396de6b2a5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 18 Nov 2008 23:38:18 +0000 Subject: [PATCH] Changed osgbrowser example to use a local CMakeModules/FindXUL.cmake script, and specialization of GTK dependencies to only non Windows/OSX platforms. --- CMakeLists.txt | 4 +- CMakeModules/FindXUL.cmake | 154 +++++++++++++++++++++++++ examples/CMakeLists.txt | 9 +- examples/osgbrowser/CMakeLists.txt | 65 ++++++----- src/osgWrappers/osg/GraphicsThread.cpp | 4 +- 5 files changed, 199 insertions(+), 37 deletions(-) create mode 100644 CMakeModules/FindXUL.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index e09bcaf36..2b49ead73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -307,6 +307,7 @@ FIND_PACKAGE(ZLIB) FIND_PACKAGE(ITK) FIND_PACKAGE(LibVNCServer) FIND_PACKAGE(OurDCMTK) +FIND_PACKAGE(XUL) SET(wxWidgets_USE_LIBS base core gl net) FIND_PACKAGE(wxWidgets) @@ -349,15 +350,12 @@ IF(PKG_CONFIG_FOUND) PKG_CHECK_MODULES(RSVG librsvg-2.0) PKG_CHECK_MODULES(CAIRO cairo) PKG_CHECK_MODULES(POPPLER poppler-glib) - PKG_CHECK_MODULES(XUL xulrunner-xpcom xulrunner-nspr xulrunner-nss xulrunner-plugin xulrunner-js) ENDIF(PKG_CONFIG_FOUND) - - # # Test to determine if we want the "tripledot" form of the GLU tesselator callback. # diff --git a/CMakeModules/FindXUL.cmake b/CMakeModules/FindXUL.cmake new file mode 100644 index 000000000..45ed14b6d --- /dev/null +++ b/CMakeModules/FindXUL.cmake @@ -0,0 +1,154 @@ +# Locate gdal +# This module defines +# XUL_LIBRARIES +# XUL_FOUND, if false, do not try to link to gdal +# XUL_INCLUDE_DIR, where to find the headers +# +# $XUL_DIR is an environment variable that would +# correspond to the ./configure --prefix=$XUL_DIR +# +# Created by Robert Osfield. + +FIND_PATH(XUL_INCLUDE_DIR nsEmbedAPI.h + $ENV{OSG_DIR}/include/xulrunner + $ENV{OSG_DIR}/include + $ENV{OSG_DIR}/xulrunner + $ENV{OSG_DIR} + $ENV{OSGDIR}/include/xulrunner + $ENV{OSGDIR}/include + $ENV{OSGDIR}/xulrunner + $ENV{OSGDIR} + $ENV{OSG_ROOT}/include/xulrunner + $ENV{OSG_ROOT}/include + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include/xulrunner + /usr/local/include + /usr/include/xulrunner + /usr/include + /sw/include/xulrunner # Fink + /sw/include # Fink + /opt/local/include/xulrunner # DarwinPorts + /opt/local/include # DarwinPorts + /opt/csw/include/xulrunner # Blastwave + /opt/csw/include # Blastwave + /opt/include/xulrunner + /opt/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/xulrunner + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include + /usr/freeware/include/xulrunner + /usr/freeware/include +) + +FIND_PATH(NSPR_INCLUDE_DIR prtypes.h + $ENV{OSG_DIR}/include/nspr + $ENV{OSG_DIR}/include + $ENV{OSG_DIR}/nspr + $ENV{OSG_DIR} + $ENV{OSGDIR}/include/nspr + $ENV{OSGDIR}/include + $ENV{OSGDIR}/nspr + $ENV{OSGDIR} + $ENV{OSG_ROOT}/include/nspr + $ENV{OSG_ROOT}/include + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include/nspr + /usr/local/include + /usr/include/nspr + /usr/include + /sw/include/nspr # Fink + /sw/include # Fink + /opt/local/include/nspr # DarwinPorts + /opt/local/include # DarwinPorts + /opt/csw/include/nspr # Blastwave + /opt/csw/include # Blastwave + /opt/include/nspr + /opt/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/nspr + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include + /usr/freeware/include/nspr + /usr/freeware/include +) + +FIND_PATH(MOZJS_INCLUDE_DIR jsapi.h + $ENV{OSG_DIR}/include/mozjs + $ENV{OSG_DIR}/include + $ENV{OSG_DIR}/mozjs + $ENV{OSG_DIR} + $ENV{OSGDIR}/include/mozjs + $ENV{OSGDIR}/include + $ENV{OSGDIR}/mozjs + $ENV{OSGDIR} + $ENV{OSG_ROOT}/include/mozjs + $ENV{OSG_ROOT}/include + ~/Library/Frameworks + /Library/Frameworks + /usr/local/include/mozjs + /usr/local/include + /usr/include/mozjs + /usr/include + /sw/include/mozjs # Fink + /sw/include # Fink + /opt/local/include/mozjs # DarwinPorts + /opt/local/include # DarwinPorts + /opt/csw/include/mozjs # Blastwave + /opt/csw/include # Blastwave + /opt/include/mozjs + /opt/include + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/mozjs + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include + /usr/freeware/include/mozjs + /usr/freeware/include +) + +MACRO(FIND_XUL_LIBRARY MYLIBRARY MYLIBRARYNAME) + + FIND_LIBRARY(${MYLIBRARY} + NAMES ${MYLIBRARYNAME} + PATHS + $ENV{OSG_DIR}/lib + $ENV{OSG_DIR} + $ENV{OSGDIR}/lib + $ENV{OSGDIR} + $ENV{OSG_ROOT}/lib + ~/Library/Frameworks + /Library/Frameworks + /usr/local/lib/xulrunner + /usr/local/lib + /usr/lib/xulrunner + /usr/lib + /sw/lib/xulrunner + /sw/lib + /opt/local/lib/xulrunner + /opt/local/lib + /opt/csw/lib/xulrunner + /opt/csw/lib + /opt/lib/xulrunner + /opt/lib + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib + /usr/freeware/lib64/xulrunner + /usr/freeware/lib64 + ) + +ENDMACRO(FIND_XUL_LIBRARY LIBRARY LIBRARYNAME) + + +FIND_XUL_LIBRARY(XUL_LIBRARY xul plds4 plc4 nspr4) +FIND_XUL_LIBRARY(XUL_MOZJS_LIBRARY mozjs) +FIND_XUL_LIBRARY(XUL_XPCOM_LIBRARY xpcom) +FIND_XUL_LIBRARY(XUL_PLUGIN_LIBRARY plds4) +FIND_XUL_LIBRARY(XUL_NSS_LIBRARY nss3) + + +SET(XUL_FOUND "NO") +IF(XUL_LIBRARY AND XUL_INCLUDE_DIR) + + SET(XUL_FOUND "YES") + SET(XUL_LIBRARIES ${XUL_LIBRARY} ${XUL_MOZJS_LIBRARY} ${XUL_XPCOM_LIBRARY} ${XUL_PLUGIN_LIBRARY} ${XUL_NSS_LIBRARY}) + SET(XUL_INCLUDE_DIRS ${XUL_INCLUDE_DIR} ${NSPR_INCLUDE_DIR} ${MOZJS_INCLUDE_DIR}) + +ENDIF(XUL_LIBRARY AND XUL_INCLUDE_DIR) + +# MESSAGE("XUL_INCLUDE_DIR " ${XUL_INCLUDE_DIR}) +# MESSAGE("XUL_LIBRARIES " ${XUL_LIBRARIES}) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a72d42d6f..ade2d3eb9 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -112,10 +112,11 @@ IF(DYNAMIC_OPENSCENEGRAPH) ADD_SUBDIRECTORY(osgpdf) ENDIF(POPPLER_FOUND AND CAIRO_FOUND) - IF (XUL_FOUND AND GTKGL_FOUND) - ADD_SUBDIRECTORY(osgbrowser) - ENDIF(XUL_FOUND AND GTKGL_FOUND) - + IF(XUL_FOUND) + IF (WIN32 OR APPLE OR GTK_FOUND) + ADD_SUBDIRECTORY(osgbrowser) + ENDIF(WIN32 OR APPLE OR GTK_FOUND) + ENDIF(XUL_FOUND) IF (BUILD_OSG_WRAPPERS) ADD_SUBDIRECTORY(osgintrospection) diff --git a/examples/osgbrowser/CMakeLists.txt b/examples/osgbrowser/CMakeLists.txt index a6412a448..24d29797d 100644 --- a/examples/osgbrowser/CMakeLists.txt +++ b/examples/osgbrowser/CMakeLists.txt @@ -17,36 +17,45 @@ SET(TARGET_H ADD_DEFINITIONS(-DMOZILLA_INTERNAL_API) -# MESSAGE("XUL_LIB_DIRS = " ${XUL_LIB_DIRS}) -# MESSAGE("XUL_LIBRARIES = " ${XUL_LIBRARIES}) -# MESSAGE("XUL_INCLUDE_DIRS = " ${XUL_INCLUDE_DIRS}) - -INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS} +SET(ALL_REQUIRED_XUL_INCLUDE_DIRS ${XUL_INCLUDE_DIRS} - /usr/include/xulrunner/locale - /usr/include/xulrunner/view - /usr/include/xulrunner/content - /usr/include/xulrunner/gfx - /usr/include/xulrunner/layout - /usr/include/xulrunner/webbrwsr - /usr/include/xulrunner/widget - /usr/include/xulrunner/dom - /usr/include/xulrunner/docshell - /usr/include/xulrunner/pref - /usr/include/xulrunner/nkcache - /usr/include/xulrunner/necko/ - /usr/include/xulrunner/profdirserviceprovider - /usr/include/xulrunner/nkcache - /usr/include/xulrunner/xulapp - /usr/include/xulrunner/profile - /usr/include/xulrunner/appshell - /usr/include/xulrunner/xpcom_obsolete - /usr/include/xulrunner/intl - /usr/include/xulrunner/windowwatcher - /usr/include/xulrunner/xpconnect + ${XUL_INCLUDE_DIR}/xpcom + ${XUL_INCLUDE_DIR}/string + ${XUL_INCLUDE_DIR}/locale + ${XUL_INCLUDE_DIR}/view + ${XUL_INCLUDE_DIR}/content + ${XUL_INCLUDE_DIR}/gfx + ${XUL_INCLUDE_DIR}/layout + ${XUL_INCLUDE_DIR}/webbrwsr + ${XUL_INCLUDE_DIR}/widget + ${XUL_INCLUDE_DIR}/dom + ${XUL_INCLUDE_DIR}/docshell + ${XUL_INCLUDE_DIR}/pref + ${XUL_INCLUDE_DIR}/nkcache + ${XUL_INCLUDE_DIR}/necko/ + ${XUL_INCLUDE_DIR}/profdirserviceprovider + ${XUL_INCLUDE_DIR}/nkcache + ${XUL_INCLUDE_DIR}/xulapp + ${XUL_INCLUDE_DIR}/profile + ${XUL_INCLUDE_DIR}/appshell + ${XUL_INCLUDE_DIR}/xpcom_obsolete + ${XUL_INCLUDE_DIR}/intl + ${XUL_INCLUDE_DIR}/windowwatcher + ${XUL_INCLUDE_DIR}/xpconnect ) -LINK_DIRECTORIES( ${XUL_LIB_DIRS}) -SET(TARGET_EXTERNAL_LIBRARIES ${XUL_LIBRARIES}) + +IF (WIN32 OR APPLE) + + INCLUDE_DIRECTORIES(${ALL_REQUIRED_XUL_INCLUDE_DIRS} ) + SET(TARGET_EXTERNAL_LIBRARIES ${XUL_LIBRARIES}) + +ELSE(WIN32 OR APPLE) + + INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS} ${ALL_REQUIRED_XUL_INCLUDE_DIRS} ) + SET(TARGET_EXTERNAL_LIBRARIES ${GTK_LIBRARIES} ${XUL_LIBRARIES}) + +ENDIF(WIN32 OR APPLE) + #### end var setup ### SETUP_EXAMPLE(osgbrowser) diff --git a/src/osgWrappers/osg/GraphicsThread.cpp b/src/osgWrappers/osg/GraphicsThread.cpp index ebb78653d..89795ed9c 100644 --- a/src/osgWrappers/osg/GraphicsThread.cpp +++ b/src/osgWrappers/osg/GraphicsThread.cpp @@ -34,8 +34,8 @@ BEGIN_OBJECT_REFLECTOR(osg::BarrierOperation) I_DeclaringFile("osg/GraphicsThread"); I_BaseType(osg::Operation); I_BaseType(OpenThreads::Barrier); - I_ConstructorWithDefaults2(IN, int, numThreads, , IN, osg::BarrierOperation::PreBlockOp, op, osg::BarrierOperation::NO_OPERATION, - ____BarrierOperation__int__PreBlockOp, + I_ConstructorWithDefaults3(IN, int, numThreads, , IN, osg::BarrierOperation::PreBlockOp, op, osg::BarrierOperation::NO_OPERATION, IN, bool, keep, true, + ____BarrierOperation__int__PreBlockOp__bool, "", ""); I_Method0(void, release,