<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.graphics.openscenegraph.cvs">
    <title>gmane.comp.graphics.openscenegraph.cvs</title>
    <link>http://blog.gmane.org/gmane.comp.graphics.openscenegraph.cvs</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10583"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10578"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10576"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10574"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10573"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10572"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10571"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10569"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10568"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10567"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10566"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10563"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10559"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10552"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10537"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10535"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10528"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10527"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10526"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10525"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10583">
    <title>osgTextBase bugs</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10583</link>
    <description>&lt;pre&gt;Hi,

I ran into an issue with osg::TextBase.cpp not computing the bounding box correctly.  The problem manifested whenever you used user rotations of non-multiple-of-90 degree angles.

I’ve attached a program demonstrating the problem and a patch against the 3.0.1 release that fixed the issue.

John.#include &amp;lt;osg/Geode&amp;gt;
#include &amp;lt;osgViewer/Viewer&amp;gt;
#include &amp;lt;osgGA/TrackballManipulator&amp;gt;
#include &amp;lt;osgText/Text&amp;gt;
#include &amp;lt;osg/PolygonMode&amp;gt;
#include &amp;lt;osg/BlendFunc&amp;gt;

struct BBDrawer : osg::NodeCallback
{
    inline BBDrawer(osg::Group* root) {
        _geom = osg::createTexturedQuadGeometry(osg::Vec3(0,0,0),osg::Vec3(1,0,0),osg::Vec3(0,1,0));
        _geom-&amp;gt;setUseDisplayList(false);
        _geom-&amp;gt;setUseVertexBufferObjects(false);
        _geom-&amp;gt;getOrCreateStateSet()-&amp;gt;setAttributeAndModes(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE));
        osg::Geode* geode = new osg::Geode;
        geode-&amp;gt;addDrawable(_geom);
        root-&amp;gt;addChild(geode);
    }

    virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
    {
        osg::Geode* geode = dynamic_cast&amp;lt;osg::Geode*&amp;gt;(node); if (!geode) return;
        osg::BoundingBox bb = geode-&amp;gt;getBoundingBox(); if (!bb.valid()) return;
        osg::Matrix g2w = osg::computeLocalToWorld(nv-&amp;gt;getNodePath());
        osg::Vec3 corner    =  bb.corner(0x0)*g2w;
        osg::Vec3 widthVec  = (bb.corner(0x1)*g2w - corner);
        osg::Vec3 heightVec = (bb.corner(0x2)*g2w - corner);
        osg::Vec3Array* coords = static_cast&amp;lt;osg::Vec3Array*&amp;gt;(_geom-&amp;gt;getVertexArray());
        (*coords)[0] = corner+heightVec;
        (*coords)[1] = corner;
        (*coords)[2] = corner+widthVec;
        (*coords)[3] = corner+widthVec+heightVec;
        _geom-&amp;gt;setVertexArray(coords);
        _geom-&amp;gt;dirtyBound();
    }

    osg::ref_ptr&amp;lt;osg::Geometry&amp;gt; _geom;
};

void main(int argc, char*argv[])
{
    osgText::Font* font = osgText::readFontFile("fonts/arial.ttf");

    osg::Group* root = new osg::Group;

    osg::Geode* normalG = new osg::Geode;
    osgText::Text* normal = new osgText::Text;
    normal-&amp;gt;setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
    normal-&amp;gt;setAxisAlignment(osgText::Text::USER_DEFINED_ROTATION);
    normal-&amp;gt;setRotation(osg::Quat(osg::DegreesToRadians(45.f),osg::Z_AXIS));
    normal-&amp;gt;setFont(font);
    normal-&amp;gt;setFontResolution(32,32);
    normal-&amp;gt;setCharacterSize(1.f);
    normal-&amp;gt;setText("normal");
    normal-&amp;gt;setName("normal");
    normal-&amp;gt;setDrawMode(osgText::Text::TEXT);

    normalG-&amp;gt;setName("normal");
    normalG-&amp;gt;addDrawable(normal);
    normalG-&amp;gt;setUpdateCallback(new BBDrawer(root));
    root-&amp;gt;addChild(normalG);

    osgGA::TrackballManipulator* manip = new osgGA::TrackballManipulator;
    manip-&amp;gt;setHomePosition(osg::Vec3(0,0,30),osg::Vec3(0,0,0),osg::Vec3(0,0,1));

    osgViewer::Viewer viewer;
    viewer.setUpViewInWindow(16,32,640,480);
    viewer.setCameraManipulator(manip);
    viewer.setSceneData(root);
    viewer.run();
}_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>John Swan-Stone</dc:creator>
    <dc:date>2012-05-25T21:07:37</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10578">
    <title>Three dragger fixes in osgManipulator</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10578</link>
    <description>&lt;pre&gt;Dear all,

I am an employee of dGB Earth Sciences, and we are currently porting
the 3D visualization of our open-source seismic interpretation package
OpendTect to OpenSceneGraph.

I want to submit three minor dragger fixes in osgManipulator.

It concerns the files Dragger.cpp, TabPlaneDragger and TabPlaneDragger.cpp.
The changed files have been drawn from the last public release OSG 3.0.1,
and have been attached to this email.


A&amp;gt; Missing break in switch statement at following function of Dragger.cpp:

bool Dragger::handle(const osgGA::GUIEventAdapter&amp;amp;, osgGA::GUIActionAdapter&amp;amp;)

The case osgGA::GUIEventAdapter::PUSH has no terminating break statement.
This was discovered because I was twice receiving a DraggerCallback with
its MotionCommand-stage set to osgManipulator::MotionCommand::START.


B&amp;gt; Missing body implementation at following function of Dragger.cpp:

Dragger::removeDraggerCallback(DraggerCallback* dc)

While using DraggerCallbacks in my application, this omission resulted
into a crash at removal time. I have added its body implementation analog
to the Dragger::removeTransformUpdating(.,.) function in the same file.


C&amp;gt; Added a default parameter to the following constructor in TabPlaneDragger
    and TabPlaneDragger.cpp:

TabPlaneDragger(float handleScaleFactor=20.0f);

The reason for this is that the default OSG tab sizes are way bigger than
those we used in our application so far. And since handleScaleFactor_
is already a (constant) class member, I see no objection against making
it user defined.

A different solution may be preferred. For example, the handleScaleFactor
parameter might be added to the function setupDefaultGeometry(bool) instead.
Or a separate function setScaleFactor(float) might be added, although that
will only help when it is called before setting up the geometry.


Best regards,

Jaap Glas

&lt;/pre&gt;</description>
    <dc:creator>Jaap Glas</dc:creator>
    <dc:date>2012-05-24T15:04:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10576">
    <title>Small fix for Uniform serializer</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10576</link>
    <description>&lt;pre&gt;Hi Robert,

A very small but maybe fatal problem was found when I saved models with
shader and uniforms (with new double types support) to osgb format and
tried to read it again. The application will crash here. And the serializer
file should be slightly changed to fix it. Please replace the original file
in osgWrappers/serializers/osg/Uniform.cpp.

Cheers,

Wang Rui
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Wang Rui</dc:creator>
    <dc:date>2012-05-22T10:32:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10574">
    <title>Bug in osgUtil::ReversePrimitiveFunctor.cpp</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10574</link>
    <description>&lt;pre&gt;Robert

The v3.01 implementation of the ReversePrimitiveFunctor is incorrect for triangle_strips - at least with odd numbers of vertices since the last vertex will be swapped with data beyond the end of the index array. In general the method is also incorrect in that the triangulation of the strip will change in the reversed strip - important if the strip is not plane. The attached code corrects this by merely reversing the indices of the strip (sharing code with reversing lines &amp;amp; polygons) - however this will still have an error if the normals are per_primitive since the reversed strip has not reversed the associated normals. 

Any suggestions on how to find the normals associated with the reversed strip(s) appreciated - the normals of course are attached to the osg::Geometry not the primitiveset. Should we pass into the reversefunctor the entire geometry?

Geoff/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

#include &amp;lt;osgUtil/ReversePrimitiveFunctor&amp;gt;
#include &amp;lt;algorithm&amp;gt;


template &amp;lt;typename Type&amp;gt;
osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typename Type::value_type* indices)
{
     if (indices==0 || count==0) return NULL;
     
     Type * dePtr = new Type(mode);
     Type &amp;amp; de = *dePtr;
     de.reserve(count);
     
     typedef const typename Type::value_type* IndexPointer;

     switch(mode)
     {
         case(GL_TRIANGLES):
         {
             IndexPointer ilast = &amp;amp;indices[count];
             
             for (IndexPointer iptr=indices; iptr&amp;lt;ilast; iptr+=3)
             {
                 de.push_back(*(iptr));
                 de.push_back(*(iptr+2));
                 de.push_back(*(iptr+1));
             }
             break;
         }
         case (GL_QUADS):
         {
             
             IndexPointer ilast = &amp;amp;indices[count - 3];
             for (IndexPointer iptr = indices; iptr&amp;lt;ilast; iptr+=4)
             {
                 de.push_back(*(iptr));
                 de.push_back(*(iptr+3));
                 de.push_back(*(iptr+2));
                 de.push_back(*(iptr+1));
             }
             break;
         }
         case (GL_QUAD_STRIP):
         {
             IndexPointer ilast = &amp;amp;indices[count];
             for (IndexPointer iptr = indices; iptr&amp;lt;ilast; iptr+=2)
             {
                 de.push_back(*(iptr+1));
                 de.push_back(*(iptr));
             }
             break;
         }
         case (GL_TRIANGLE_FAN):
         {
             de.push_back(*indices);
          
             IndexPointer iptr = indices + 1;
             IndexPointer ilast = &amp;amp;indices[count];
             de.resize(count);
             std::reverse_copy(iptr, ilast, de.begin() + 1);
             
             break;
         }
         case (GL_TRIANGLE_STRIP):
         case (GL_POLYGON):
         case (GL_POINTS):
         case (GL_LINES):
         case (GL_LINE_STRIP):
         case (GL_LINE_LOOP):
         {
             IndexPointer iptr = indices;
             IndexPointer ilast = &amp;amp;indices[count];
             de.resize(count);
             std::reverse_copy(iptr, ilast, de.begin());
             
             break;
         }
         default:
             break;
     }
     
     return &amp;amp;de;
}

namespace osgUtil {

void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count)
{
    if (count==0) return ;
    
    osg::DrawElementsUInt * dePtr = new osg::DrawElementsUInt(mode);
    osg::DrawElementsUInt &amp;amp; de = *dePtr;
    de.reserve(count);

    GLint end = first + count;
    
    switch (mode) 
    {
        case (GL_TRIANGLES): 
        {
            for (GLint i=first; i&amp;lt;end; i+=3) 
            {
                de.push_back(i);
                de.push_back(i+2);
                de.push_back(i+1);
            }
            break;
        }
        case (GL_QUADS): 
        {
            for (GLint i=first; i&amp;lt;end; i+=4) 
            {
                de.push_back(i);
                de.push_back(i+3);
                de.push_back(i+2);
                de.push_back(i+1);
            }
            break;
        }
        case (GL_TRIANGLE_STRIP):
        case (GL_QUAD_STRIP): 
        {
            for (GLint i=first; i&amp;lt;end; i+=2) 
            {
                de.push_back(i+1);
                de.push_back(i);
            }
            break;
        }
        case (GL_TRIANGLE_FAN): 
        {
            de.push_back(first);
    
            for (GLint i=end-1; i&amp;gt;first; i--) 
                de.push_back(i);

            break;
        }
        case (GL_POLYGON):
        case (GL_POINTS):
        case (GL_LINES):
        case (GL_LINE_STRIP):
        case (GL_LINE_LOOP): 
        {
            for (GLint i=end-1; i&amp;gt;=first; i--) 
                de.push_back(i);
    
            break;
        }
        default:
            break;
    }

    _reversedPrimitiveSet = &amp;amp;de;
}

void ReversePrimitiveFunctor::drawElements(GLenum mode,GLsizei count,const GLubyte* indices)
{
    _reversedPrimitiveSet = drawElementsTemplate&amp;lt;osg::DrawElementsUByte&amp;gt;(mode, count, indices);
}
void ReversePrimitiveFunctor::drawElements(GLenum mode,GLsizei count,const GLushort* indices)
{
    _reversedPrimitiveSet = drawElementsTemplate&amp;lt;osg::DrawElementsUShort&amp;gt;(mode, count, indices);
}
void ReversePrimitiveFunctor::drawElements(GLenum mode,GLsizei count,const GLuint* indices)
{
    _reversedPrimitiveSet = drawElementsTemplate&amp;lt;osg::DrawElementsUInt&amp;gt;(mode, count, indices);
}

void ReversePrimitiveFunctor::begin(GLenum mode)
{
    if (_running)
    {
        OSG_WARN &amp;lt;&amp;lt; "ReversePrimitiveFunctor : call \"begin\" without call \"end\"." &amp;lt;&amp;lt; std::endl;
    }
    else
    {
        _running = true;
        
        _reversedPrimitiveSet = new osg::DrawElementsUInt(mode);
    }
}

void ReversePrimitiveFunctor::vertex(unsigned int pos)
{
    if (_running == false)
    {
        OSG_WARN &amp;lt;&amp;lt; "ReversePrimitiveFunctor : call \"vertex(" &amp;lt;&amp;lt; pos &amp;lt;&amp;lt; ")\" without call \"begin\"." &amp;lt;&amp;lt; std::endl;
    }
    else
    {
        static_cast&amp;lt;osg::DrawElementsUInt*&amp;gt;(_reversedPrimitiveSet.get())-&amp;gt;push_back(pos);
    }
}

void ReversePrimitiveFunctor::end()
{ 
    if (_running == false)
    {
        OSG_WARN &amp;lt;&amp;lt; "ReversePrimitiveFunctor : call \"end\" without call \"begin\"." &amp;lt;&amp;lt; std::endl;
    }
    else
    {
        _running = false;
    
        osg::ref_ptr&amp;lt;osg::DrawElementsUInt&amp;gt; tmpDe(static_cast&amp;lt;osg::DrawElementsUInt*&amp;gt;(_reversedPrimitiveSet.get()));
    
        _reversedPrimitiveSet = drawElementsTemplate&amp;lt;osg::DrawElementsUInt&amp;gt;(tmpDe-&amp;gt;getMode(), tmpDe-&amp;gt;size(), &amp;amp;(tmpDe-&amp;gt;front()));
    }
}
} // end osgUtil namespace
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Geoff Michel</dc:creator>
    <dc:date>2012-05-17T07:59:08</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10573">
    <title>Android CMake fix for osgViewer</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10573</link>
    <description>&lt;pre&gt;Hi Robert

Attached is a fix for osgViewers CMakeList.txt when configuring for Android
on OSX. Before it was defaulting into the IF(APPLE) branch when selecting
WindowingSystem.

Then when comparing the "macosx10.7" variable an error was occurring.
Presumable as I was targeting Android.

Cheers
Tom
# FIXME: For OS X, need flag for Framework or dylib
IF(DYNAMIC_OPENSCENEGRAPH)
    ADD_DEFINITIONS(-DOSGVIEWER_LIBRARY)
ELSE()
    ADD_DEFINITIONS(-DOSG_LIBRARY_STATIC)
ENDIF()

SET(LIB_NAME osgViewer)

SET(HEADER_PATH ${OpenSceneGraph_SOURCE_DIR}/include/${LIB_NAME})
SET(TARGET_H
    ${HEADER_PATH}/CompositeViewer
    ${HEADER_PATH}/Export
    ${HEADER_PATH}/GraphicsWindow
    ${HEADER_PATH}/Renderer
    ${HEADER_PATH}/Scene
    ${HEADER_PATH}/Version
    ${HEADER_PATH}/View
    ${HEADER_PATH}/Viewer
    ${HEADER_PATH}/ViewerBase
    ${HEADER_PATH}/ViewerEventHandlers
)

SET(LIB_COMMON_FILES
    CompositeViewer.cpp
    GraphicsWindow.cpp
    HelpHandler.cpp
    Renderer.cpp
    Scene.cpp
    ScreenCaptureHandler.cpp
    StatsHandler.cpp
    Version.cpp
    View.cpp
    Viewer.cpp
    ViewerBase.cpp
    ViewerEventHandlers.cpp
    ${OPENSCENEGRAPH_VERSIONINFO_RC}
)

SET(LIB_EXTRA_LIBS)

IF(WIN32 AND NOT ANDROID)
    #
    # Enable workaround for OpenGL driver issues when used in multithreaded/multiscreen with NVidia drivers on Windows XP 
    # For example: osgviewer dumptruck.osg was showing total garbage (screen looked like shattered, splashed hedgehog) 
    # There were also serious issues with render to texture cameras.
    # Workaround repeats makeCurrentContext call as it was found that this causes the problems to dissapear.
    #
    OPTION(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND "Set to ON if you have NVidia board and drivers earlier than 177.92 ver" OFF)
    MARK_AS_ADVANCED(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
    IF(OSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
        ADD_DEFINITIONS(-DOSG_MULTIMONITOR_MULTITHREAD_WIN32_NVIDIA_WORKAROUND)
    ENDIF()

    SET(TARGET_H_NO_MODULE_INSTALL
        ${HEADER_PATH}/api/Win32/GraphicsHandleWin32
        ${HEADER_PATH}/api/Win32/GraphicsWindowWin32
        ${HEADER_PATH}/api/Win32/PixelBufferWin32
    )
        
    SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
        GraphicsWindowWin32.cpp
        PixelBufferWin32.cpp
    )
ELSE()
    IF(APPLE AND NOT ANDROID)

        IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
            SET(OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Windowing system type for graphics window creation, options only IOS.")
        ELSE()
            IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR
               ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.6" OR
               ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.5")
                SET(OSG_WINDOWING_SYSTEM "Cocoa" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
            ELSE()
                SET(OSG_WINDOWING_SYSTEM "Carbon" CACHE STRING "Windowing system type for graphics window creation, options Carbon, Cocoa or X11.")
            ENDIF()
        ENDIF()

    ELSE()
        IF(ANDROID)
            SET(OSG_WINDOWING_SYSTEM "None" CACHE STRING "None Windowing system type for graphics window creation.")
        ELSE()
            SET(OSG_WINDOWING_SYSTEM "X11" CACHE STRING "Windowing system type for graphics window creation. options only X11")
        ENDIF()
    ENDIF()

    IF(${OSG_WINDOWING_SYSTEM} STREQUAL "Cocoa")
        ADD_DEFINITIONS(-DUSE_DARWIN_COCOA_IMPLEMENTATION)    
 
        IF(OSG_COMPILE_FRAMEWORKS)
           SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
                 ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
                 ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
                 ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
             )
            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa) 
            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Cocoa)
        ELSE()
            SET(TARGET_H_NO_MODULE_INSTALL
                ${HEADER_PATH}/api/Cocoa/GraphicsHandleCocoa
                ${HEADER_PATH}/api/Cocoa/GraphicsWindowCocoa
                ${HEADER_PATH}/api/Cocoa/PixelBufferCocoa
            )
        ENDIF()  
  
        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
            GraphicsWindowCocoa.mm
            DarwinUtils.h
            DarwinUtils.mm
            PixelBufferCocoa.mm
        )
        SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})

    ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon")
        ADD_DEFINITIONS(-DUSE_DARWIN_CARBON_IMPLEMENTATION)     
 
        IF(OSG_COMPILE_FRAMEWORKS)
           SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
                 ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon
                 ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon
                 ${HEADER_PATH}/api/Carbon/PixelBufferCarbon
             )
            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon) 
            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/Carbon/PixelBufferCarbon PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/Carbon)
        ELSE()
            SET(TARGET_H_NO_MODULE_INSTALL
                ${HEADER_PATH}/api/Carbon/GraphicsHandleCarbon
                ${HEADER_PATH}/api/Carbon/GraphicsWindowCarbon
                ${HEADER_PATH}/api/Carbon/PixelBufferCarbon
            )
        ENDIF()

        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
            GraphicsWindowCarbon.cpp
            DarwinUtils.h
            DarwinUtils.mm
            PixelBufferCarbon.cpp
        )

        SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${AGL_LIBRARY} ${LIB_EXTRA_LIBS})

    ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "IOS")

        ADD_DEFINITIONS(-DUSE_IOS_IMPLEMENTATION)     
 
        IF(OSG_COMPILE_FRAMEWORKS)
           SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
                 ${HEADER_PATH}/api/IOS/GraphicsWindowIOS
             )

            SET_PROPERTY(SOURCE ${HEADER_PATH}/api/IOS/GraphicsWindowIOS PROPERTY MACOSX_PACKAGE_LOCATION Headers/api/IOS)
        ELSE()
            SET(TARGET_H_NO_MODULE_INSTALL
                ${HEADER_PATH}/api/IOS/GraphicsWindowIOS
                #${HEADER_PATH}/api/IOS/PixelBufferIOS
            )
        ENDIF()   
 
        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
            GraphicsWindowIOS.mm
            IOSUtils.h
            IOSUtils.mm
        )

        SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS})

    ELSEIF(${OSG_WINDOWING_SYSTEM} STREQUAL "X11")
        # X11 for everybody else
        INCLUDE(FindPkgConfig OPTIONAL)
        IF(PKG_CONFIG_FOUND)
            PKG_CHECK_MODULES(XRANDR xrandr)
            IF(XRANDR_FOUND) 
                OPTION(OSGVIEWER_USE_XRANDR "Set to ON to enable Xrandr support for GraphicsWindowX11." ON)
            ELSE() 
                SET(OSGVIEWER_USE_XRANDR OFF)
            ENDIF()
        ELSE()
            SET(OSGVIEWER_USE_XRANDR OFF)
        ENDIF()

        SET(TARGET_H_NO_MODULE_INSTALL
            ${HEADER_PATH}/api/X11/GraphicsHandleX11
            ${HEADER_PATH}/api/X11/GraphicsWindowX11
            ${HEADER_PATH}/api/X11/PixelBufferX11
        )

        SET(LIB_COMMON_FILES ${LIB_COMMON_FILES} 
            GraphicsWindowX11.cpp 
            PixelBufferX11.cpp
        )
        
        IF(OSGVIEWER_USE_XRANDR)
            ADD_DEFINITIONS(-DOSGVIEWER_USE_XRANDR)
            SET(LIB_PRIVATE_HEADERS ${LIB_PRIVATE_HEADERS} ${XRANDR_INCLUDE_DIRS} )

            IF(X11_Xrandr_LIB)
                SET(LIB_EXTRA_LIBS ${X11_Xrandr_LIB} ${LIB_EXTRA_LIBS})
            ELSE()
                SET(LIB_EXTRA_LIBS ${XRANDR_LIBRARIES} ${LIB_EXTRA_LIBS})
            ENDIF()
        ENDIF()

        # X11 on Apple requires X11 library plus OpenGL linking hack on Leopard
        IF(APPLE)
            # hack for finding the iphone opengl es lib
            IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
                SET(OPENGL_INCLUDE_DIR ${IPHONE_SDKROOT}System/Library/Frameworks)
                SET(OPENGL_LIBRARIES ${IPHONE_SDKROOT}System/Library/Frameworks/OpenGLES)
            ELSE()
                # Find GL/glx.h
                IF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11/include/GL/glx.h)
                    SET(OPENGL_INCLUDE_DIR /usr/X11/include)
                    SET(OPENGL_LIBRARIES /usr/X11/lib/libGL.dylib)
                ELSEIF(EXISTS ${CMAKE_OSX_SYSROOT}/usr/X11R6/include/GL/glx.h)
                    SET(OPENGL_INCLUDE_DIR /usr/X11R6/include)
                    SET(OPENGL_LIBRARIES /usr/X11R6/lib/libGL.dylib)
                ENDIF()
                INCLUDE_DIRECTORIES(BEFORE SYSTEM ${OPENGL_INCLUDE_DIR})

                SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${OPENGL_LIBRARIES} ${LIB_EXTRA_LIBS})
                SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib")
            ENDIF()

        ELSE(APPLE)

            SET(LIB_EXTRA_LIBS ${X11_X11_LIB} ${LIB_EXTRA_LIBS})
        ENDIF(APPLE)
    ELSE()
        MESSAGE(STATUS "Windowing system not supported")
    ENDIF()
ENDIF()


SET(TARGET_SRC
    ${LIB_PRIVATE_HEADERS}
    ${LIB_COMMON_FILES}
)


SET(TARGET_LIBRARIES    
    osgGA
    osgText
    osgDB
    osgUtil
    osg
    OpenThreads
)

SET(TARGET_EXTERNAL_LIBRARIES ${LIB_EXTRA_LIBS})

IF(MINGW OR CYGWIN)
    SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARY} gdi32 )
ENDIF()

SETUP_LIBRARY(${LIB_NAME})

# install these headers manually since setup_library and moduleinstall
# wouldn't keep the structure, e.g. api/X11/xyz.h
FOREACH(HEADERFILE ${TARGET_H_NO_MODULE_INSTALL})
  # get relative path to graphics system dependant header
  FILE(RELATIVE_PATH REL_INCLUDEFILE ${HEADER_PATH} ${HEADERFILE})
  GET_FILENAME_COMPONENT(REL_INCLUDE_PATH ${REL_INCLUDEFILE} PATH)

  INSTALL(FILES ${HEADERFILE} 
    DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}/${REL_INCLUDE_PATH}
    COMPONENT libopenscenegraph-dev
  )
ENDFOREACH()

# for structure in ide
SOURCE_GROUP("${HEADERS_GROUP}\\api" FILES ${TARGET_H_NO_MODULE_INSTALL})
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Thomas Hogarth</dc:creator>
    <dc:date>2012-05-17T00:11:41</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10572">
    <title>Bugfix to prevent crash for NVTTProcessor.cpp</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10572</link>
    <description>&lt;pre&gt;Hi Robert,

the current NVTTProcessor.cpp crashed on my system in the convertRGBAToBGRA method. For me it looks as if it accidentially uses the n variable to access the red channel. I fixed it by reading column*4+0 as it is done for the other channels. The error was introduced with the change to non-contiguous images in OSG

old code: 
[code]
// Convert RGBA to BGRA : nvtt only accepts BGRA pixel format
void NVTTProcessor::convertRGBAToBGRA( std::vector&amp;lt;unsigned char&amp;gt;&amp;amp; outputData, const osg::Image&amp;amp; image )
{
    unsigned int n=0;
    for(int row=0; row&amp;lt;image.t(); ++row)
    {
        const unsigned char* data = image.data(0,row);
        for(int column=0; column&amp;lt;image.s(); ++column)
        {
            outputData[n] = data[column*4+2];
            outputData[n+1] = data[column*4+1];
            outputData[n+2] = data[column*4+n]; // TG crash here
            outputData[n+3] = data[column*4+3];
            n+=4;
        }
    }
}
[/code]

fixed code: 
[code]
// Convert RGBA to BGRA : nvtt only accepts BGRA pixel format
void NVTTProcessor::convertRGBAToBGRA( std::vector&amp;lt;unsigned char&amp;gt;&amp;amp; outputData, const osg::Image&amp;amp; image )
{
    unsigned int n=0;
    for(int row=0; row&amp;lt;image.t(); ++row)
    {
        const unsigned char* data = image.data(0,row);
        for(int column=0; column&amp;lt;image.s(); ++column)
        {
            outputData[n] = data[column*4+2];
            outputData[n+1] = data[column*4+1];
            outputData[n+2] = data[column*4+0]; // works for me
            outputData[n+3] = data[column*4+3];
            n+=4;
        }
    }
}
[/code]

You can reproduce the error with osgdem and the puget dataset: 
[code]
osgdem --compressor-nvtt --xx 10 --yy 10 -t ps_texture_16k.tif --xx 10 --yy 10 -d ps_height_16k.tif -l 4 -v 0.1 -o puget.osgb
[/code]

Thank you!

Cheers,
Tassilo[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47744#47744




Attachments: 
http://forum.openscenegraph.org//files/nvtt_fix_147.zip
&lt;/pre&gt;</description>
    <dc:creator>Tassilo Glander</dc:creator>
    <dc:date>2012-05-16T13:42:14</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10571">
    <title>Added Max PagedLOD Level property to CullSettings</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10571</link>
    <description>&lt;pre&gt;Hi Robert,

With refernce to email "[osg-users] Strategies for reducing visual 
terrain-tile-popping with osgTerrain" (2012-04-24), I've made a small 
patch that can alleviate some of the worst "in-your-face" popping by 
adding CullSettings::setMaxPagedLODLevel(unsigned int). In conjunction 
with LODScale, this setting can be tuned to minimize terrain tile 
popping for flight paths that do not vary to much in altitude.

The changes are made against the 3.0.1 tag. Note that the changes have 
only been tested in SingleTreaded mode

If the addition/changes are acceptable, please feel free to make the 
changes you deem necessary for inclusion in OSG:-) Would have preferred 
not to introduce a dynamic_cast in PageLOD::traverse()....

Best regards,
John

&lt;/pre&gt;</description>
    <dc:creator>John Vidar Larring</dc:creator>
    <dc:date>2012-05-15T12:58:56</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10569">
    <title>IOS CMake adjustment for tutorial</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10569</link>
    <description>&lt;pre&gt;Hi Robert

Attached is a change to the main CMakeLists.txt which just sets the IOS sdk
paths to default to the new /Application/Xcode path. It also sets the
default sdk version to 5.1 and the default min version to 4.0

This is to fit in with the new XCode and the new tutorial on the osg site.

I've seen the thread on automatic selection of the sdk path, which I'm
planning to look into, but this will make things easier on new comers till
then.

Cheers
Tom
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

IF(WIN32)
    CMAKE_MINIMUM_REQUIRED(VERSION 2.4.6 FATAL_ERROR)
ELSE(WIN32)
    IF(APPLE)
        CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)
    ELSE(APPLE)
        CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
    ENDIF(APPLE)
ENDIF(WIN32)

if(COMMAND cmake_policy)
    # Works around warnings libraries linked against that don't
    # have absolute paths (e.g. -lpthreads)
    cmake_policy(SET CMP0003 NEW)

    # Works around warnings about escaped quotes in ADD_DEFINITIONS
    # statements.
    cmake_policy(SET CMP0005 NEW)

    # tell CMake to prefer CMake's own CMake modules when available
    # only available from cmake-2.8.4
    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)
        cmake_policy(SET CMP0017 NEW)
    endif()

    # cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
    # quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
    if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
        cmake_policy(SET CMP0008 OLD)
    endif()
endif()

PROJECT(OpenSceneGraph)

SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 1)
SET(OPENSCENEGRAPH_PATCH_VERSION 3)
SET(OPENSCENEGRAPH_SOVERSION 92)

# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)

SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})

SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})

SET(OSG_PLUGIN_PREFIX "")

IF (CYGWIN)
    SET(OSG_PLUGIN_PREFIX "cygwin_")
ENDIF()

IF(MINGW)
    SET(OSG_PLUGIN_PREFIX "mingw_")
ENDIF()


# We want to build SONAMES shared librariess
SET(OPENSCENEGRAPH_SONAMES TRUE)
SET(OPENTHREADS_SONAMES TRUE)

SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})

# We have some custom .cmake scripts not in the official distribution.
# Maybe this can be used override existing behavior if needed?
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")

## Option to enable Android build using AndroidNDK
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
IF(OSG_BUILD_PLATFORM_ANDROID)

    CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)

    INCLUDE(OsgAndroidMacroUtils)
    SET(ANDROID TRUE)
    IF(NOT ANDROID_PLATFORM)
        MESSAGE("Warning Android Platform version NOT defined, Default selected version: 5")
        SET(ANDROID_PLATFORM 5)
    ENDIF()
    IF(NOT ANDROID_ABI)
        MESSAGE("Warning Android ABI version NOT defined, Default selection: armeabi armeabi-v7a")
        SET(ANDROID_ABI "armeabi armeabi-v7a")
    ENDIF()
    IF(NOT ANDROID_STL)
        MESSAGE("Warning Android STL NOT defined, Default selection: gnustl_static")
        SET(ANDROID_STL "gnustl_static")
    ENDIF()
    IF(ANDROID_DEBUG)
        MESSAGE("Warning Android Build is in debug mode")
        SET(ANDROID_RELEASE_OPTIM "debug")
    ELSE()
        MESSAGE("Warning Android Build is in release mode")
        SET(ANDROID_RELEASE_OPTIM "release")
    ENDIF()
    IF(ANDROID_NEON)
        MESSAGE("Warning Android NEON optimizations enabled, this will not be available on all armeabi-v7a devices ie. Tegra2")
        SET(ANDROID_OPTIM_NEON true)
    ELSE()
        SET(ANDROID_OPTIM_NEON false)
    ENDIF()
    IF(ANDROID_ARM32)
        MESSAGE("Warning ARM 32bit instruction set will be used")
        SET(ANDROID_OPTIM_ARM32 true)
    ELSE()
        SET(ANDROID_OPTIM_ARM32 false)
    ENDIF()

    FIND_PACKAGE(AndroidNDK REQUIRED)

    SET(OSG_ANDROID_TEMPLATES "${CMAKE_SOURCE_DIR}/PlatformSpecifics/Android")

    SET(J  "4" CACHE STRING "how many processes for make -j &amp;lt;J&amp;gt;")

    ADD_CUSTOM_COMMAND(
        OUTPUT    Android-OpenSceneGraph
        DEPENDS   ${CMAKE_BINARY_DIR}/Android.mk
        COMMAND   "${ANDROID_NDK}/ndk-build"
        ARGS      --directory=${CMAKE_BINARY_DIR} NDK_APPLICATION_MK=Application.mk -j${J} NDK_LOG=1
    )

    ADD_CUSTOM_TARGET(ndk ALL echo
          DEPENDS Android-OpenSceneGraph
    )
    install(DIRECTORY include/ DESTINATION include/
        PATTERN ".svn" EXCLUDE
    )
    install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION include/
    )
    install(DIRECTORY ${CMAKE_BINARY_DIR}/obj/ DESTINATION obj/
        PATTERN ".svn" EXCLUDE
        PATTERN "objs" EXCLUDE
    )

    ADD_DEFINITIONS(-DANDROID)

ENDIF()



# Okay, here's the problem: On some platforms, linking against OpenThreads
# is not enough and explicit linking to the underlying thread library
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
# backends (Pthreads, Sproc, Windows) so we don't know what the underlying
# thread library is because some platforms support multiple backends (e.g.
# IRIX supports Sproc and Pthreads). Linking all libraries won't work
# because the libraries may be incompatible.
# So the current solution is to attempt best guess linking and exempt certain
# cases. With IRIX, we're going to hope explicit linking to the underlying
# library is not necessary. We currently don't case for pthreads on Windows
# which might be an issue on things like Cygwin. This may need to be fixed.
IF(NOT ANDROID)
    FIND_PACKAGE(Threads)
ENDIF()
IF(CMAKE_SYSTEM MATCHES IRIX)
    # Erase CMAKE_THREAD_LIBS_INIT and hope it works
    SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
ENDIF()

OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
IF (OSG_MAINTAINER)

    SET(OPENSCENEGRAPH_SVN "trunk")
    #SET(OPENSCENEGRAPH_SVN "branches")
    SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})

    #
    # Provide target for tagging a release
    #
    SET(SVNCOMMAND svn)
    SET(SVNTRUNKDIR     http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
    SET(SVNTAGDIR       http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
    SET(SVNBRANCHDIR    http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)

    IF   (OPENSCENEGRAPH_SVN STREQUAL "trunk")
        SET(SVNSOURCEDIR ${SVNTRUNKDIR})
    ELSE()
        SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
    ENDIF()


    IF   (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
    ELSE()
        SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
    ENDIF()


    ADD_CUSTOM_TARGET(tag-test
        COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
    )

    ADD_CUSTOM_TARGET(tag-run
        COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
    )

    ADD_CUSTOM_TARGET(branch-test
        COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
    )

    ADD_CUSTOM_TARGET(branch-run
        COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
    )

    #
    # Provide target for generating ChangeLog
    #
    SET(GENERATELOGS svn2cl)

    ADD_CUSTOM_TARGET(ChangeLog
        COMMAND ${SVNCOMMAND} update
        COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
    )

ENDIF(OSG_MAINTAINER)

IF(NOT ANDROID)
IF(APPLE)
    # Determine the canonical name of the selected Platform SDK
    EXECUTE_PROCESS(COMMAND "defaults" "read" "${CMAKE_OSX_SYSROOT}/SDKSettings.plist" "CanonicalName"
                    OUTPUT_VARIABLE OSG_OSX_SDK_NAME
                    OUTPUT_STRIP_TRAILING_WHITESPACE)

    # Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
    # Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
    # set to true. Should realy have an OSG_BUILD_PLATFORM variable that we set to our desired platform
    OPTION(OSG_BUILD_PLATFORM_IPHONE "Enable IPhoneSDK Device support" OFF)
    OPTION(OSG_BUILD_PLATFORM_IPHONE_SIMULATOR "Enable IPhoneSDK Simulator support" OFF)

    IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)

        #you need to manually set the default sdk version here
        SET (IPHONE_SDKVER "5.1")

        #the below is taken from ogre, it states the gcc stuff needs to happen before PROJECT() is called. I've no clue if we even need it
        # Force gcc &amp;lt;= 4.2 on iPhone
        include(CMakeForceCompiler)
        CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
        CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
        SET(GCC_THUMB_SUPPORT NO)

        #set either the device sdk or the simulator sdk. Can't find away to separate these in the same project
        IF(OSG_BUILD_PLATFORM_IPHONE)


            SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
            SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk")
        ELSE()
            SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer")
            SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk")
        ENDIF()

        # Apple iOS: Find OpenGLES
        FIND_LIBRARY(OPENGLES_LIBRARY OpenGLES)
    ELSE ()
        FIND_LIBRARY(CARBON_LIBRARY Carbon)
        FIND_LIBRARY(COCOA_LIBRARY Cocoa)

        # Apple OS X: Find OpenGL and AGL
        FIND_PACKAGE(OpenGL)
        FIND_LIBRARY(AGL_LIBRARY AGL)
    ENDIF ()

    OPTION(OSG_COMPILE_FRAMEWORKS "compile frameworks instead of dylibs (experimental)" OFF)
    SET(OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR "&amp;lt; at &amp;gt;executable_path/../Frameworks" CACHE STRING "install name dir for compiled frameworks")
ELSE()
    # Non-Apple: Find OpenGL
    FIND_PACKAGE(OpenGL)
ENDIF()
ENDIF()

IF(UNIX AND NOT ANDROID)
    # Not sure what this will do on Cygwin and Msys
    # Also, remember OS X X11 is a user installed option so it may not exist.
    FIND_PACKAGE(X11)
    # Some Unicies need explicit linkage to the Math library or the build fails.
    FIND_LIBRARY(MATH_LIBRARY m)

    FIND_LIBRARY(DL_LIBRARY dl)
    IF(NOT DL_LIBRARY)
        SET(DL_LIBRARY "") # change from NOTFOUND to empty when passed to linker
    ENDIF()

    IF( CMAKE_SYSTEM MATCHES "Linux" )
        FIND_LIBRARY( RT_LIBRARY rt )
    ENDIF( CMAKE_SYSTEM MATCHES "Linux" )

ENDIF()

INCLUDE_DIRECTORIES(
    ${OpenSceneGraph_SOURCE_DIR}/include
    ${OPENGL_INCLUDE_DIR}
)

# Make the headers visible to everything
IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
   INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
ENDIF()

# Common global definitions
#ADD_DEFINITIONS(-D)
# Platform specific definitions


IF(WIN32 AND NOT ANDROID)

    IF(MSVC)
        # This option is to enable the /MP switch for Visual Studio 2005 and above compilers
        OPTION(WIN32_USE_MP "Set to ON to build OpenSceneGraph with the /MP option (Visual Studio 2005 and above)." OFF)
        MARK_AS_ADVANCED(WIN32_USE_MP)
        IF(WIN32_USE_MP)
            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
        ENDIF(WIN32_USE_MP)

        # turn off various warnings
        # foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
        #     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd${warning}")
        # endforeach(warning)

        # This option is to enable the /DYNAMICBASE switch
        # It is used to workaround a bug in Windows 7 when linking in release, which results in corrupt
        # binaries. See this page for details: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/01/24/the-case-of-the-corrupt-pe-binaries.aspx
        OPTION(WIN32_USE_DYNAMICBASE "Set to ON to build OpenSceneGraph with the /DYNAMICBASE option to work around a bug when linking release executables on Windows 7." OFF)
        MARK_AS_ADVANCED(WIN32_USE_DYNAMICBASE)
        IF(WIN32_USE_DYNAMICBASE)
            SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DYNAMICBASE")
        ENDIF(WIN32_USE_DYNAMICBASE)

        # More MSVC specific compilation flags
        ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
        ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)

        OPTION(MSVC_DISABLE_CHECKED_ITERATORS "Set to ON to disable Visual C++ checked iterators. If you do this you must ensure that every other project in your solution and all dependencies are compiled with _SECURE_SCL=0." OFF)
        MARK_AS_ADVANCED(MSVC_DISABLE_CHECKED_ITERATORS)
        IF(MSVC_DISABLE_CHECKED_ITERATORS)
            ADD_DEFINITIONS(-D_SECURE_SCL=0)
        ENDIF(MSVC_DISABLE_CHECKED_ITERATORS)

        OPTION(MSVC_USE_DEFAULT_STACK_SIZE "Set to ON to use the default Visual C++ stack size. CMake forces a high stack size by default, which can cause problems for applications with large number of threads." OFF)
        MARK_AS_ADVANCED(MSVC_USE_DEFAULT_STACK_SIZE)
        IF(MSVC_USE_DEFAULT_STACK_SIZE)
            STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
            STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
            STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
        ENDIF(MSVC_USE_DEFAULT_STACK_SIZE)

    ENDIF()

    #needed for net plugin
    SET (OSG_SOCKET_LIBS wsock32)
    # Both Cygwin and Msys need -DNOMINMAX ???
    IF(UNIX)
        ADD_DEFINITIONS(-DNOMINMAX)
    ENDIF()

########################################################################################################
# the following options are MSVC specific,
# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
# fron bin folder without requiring installation step.
# it also prepend "osg${OPENSCENEGRAPH_SOVERSION}-" to only .dll files, leaving .lib files untouched in lib
# it also use a hack to get rid of Debug and Release folder in MSVC projects
# all the .dll and .pdb are in bin and all the .lib and .exp are in lib
#
# the second option disable incremental linking in debug build , that is enabled by default by CMake
##########################################################################################################

    IF(MSVC)
        IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
            MESSAGE("Warning:  disabling versioned options 2.4.6 exibits inconsintencies in .pdb naming, at least under MSVC, suggested upgrading at least to 2.4.7")
            SET(OSG_MSVC_VERSIONED_DLL OFF)
            SET(OSG_MSVC_DEBUG_INCREMENTAL_LINK ON)
        ELSE()
            OPTION(OSG_MSVC_VERSIONED_DLL "Set to ON to build OpenSceneGraph with versioned dll names" ON)
            MARK_AS_ADVANCED(OSG_MSVC_VERSIONED_DLL)
            OPTION(OSG_MSVC_DEBUG_INCREMENTAL_LINK "Set to OFF to build OpenSceneGraph without incremental linking in debug (release is off by default)" ON)
            MARK_AS_ADVANCED(OSG_MSVC_DEBUG_INCREMENTAL_LINK)
            IF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
                SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
                SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
                SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
            ENDIF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
        ENDIF()
    ENDIF(MSVC)
ENDIF(WIN32 AND NOT ANDROID)

########################################################################################################
##### these were settings located in SetupCommon.cmake used in Luigi builds.... find out what are useful
########################################################################################################
#luigi#SET(CMAKE_VERBOSE_MAKEFILE TRUE)
#luigi#SET(CMAKE_SKIP_RPATH TRUE)
#luigi#SET(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
#luigi#IF(UNIX)
#luigi#    LIST_CONTAINS(contains "g++" ${CMAKE_CXX_COMPILER_LIST})
#luigi#    IF (contains)
#luigi#        MESSAGE(${MY_MESSAGE_DEFAULT} "${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} setting  CMAKE_CXX_COMPILER to g++")
#luigi#        SET(CMAKE_CXX_COMPILER "g++")
#luigi#        SET(CMAKE_CXX_COMPILER_LOADED 2)
#luigi#        SET(CMAKE_CXX_COMPILER_WORKS 2)
#luigi#    ENDIF (contains)
#luigi#    SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
#luigi#    SET(CMAKE_CXX_FLAGS_DEBUG "-ggdb -gstabs")
#luigi#ENDIF(UNIX)
########################################################################################################

OPTION(OSG_NOTIFY_DISABLED "Set to ON to build OpenSceneGraph with the notify() disabled." OFF)

OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF)
MARK_AS_ADVANCED(OSG_USE_FLOAT_MATRIX)

OPTION(OSG_USE_FLOAT_PLANE "Set to ON to build OpenSceneGraph with float Plane instead of double." OFF)
MARK_AS_ADVANCED(OSG_USE_FLOAT_PLANE)

OPTION(OSG_USE_FLOAT_BOUNDINGSPHERE "Set to ON to build OpenSceneGraph with float BoundingSphere instead of double." ON)
MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGSPHERE)

OPTION(OSG_USE_FLOAT_BOUNDINGBOX "Set to ON to build OpenSceneGraph with float BoundingBox instead of double." ON)
MARK_AS_ADVANCED(OSG_USE_FLOAT_BOUNDINGBOX)

IF (WIN32)
    OPTION(OSG_USE_UTF8_FILENAME "Set to ON to use a UTF8 locale for filenames instead of the default locale." OFF)
    MARK_AS_ADVANCED(OSG_USE_UTF8_FILENAME)
ENDIF()

OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)

OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr&amp;lt;&amp;gt; T* operator() output conversion. " ON)

OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON)
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON)
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF)
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF)
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF)
OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF)

SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")

# SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_MATRICES_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_VERTEX_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_FIXED_FUNCTION_AVAILABLE ${OSG_GL1_AVAILABLE})

OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ${OSG_GL1_AVAILABLE})

OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)

################################################################################
# Set Config file

SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
               "${OPENSCENEGRAPH_CONFIG_HEADER}")

SET(OPENSCENEGRAPH_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/osg/Version")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
               "${OPENSCENEGRAPH_VERSION_HEADER}")

# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")


################################################################################
# Set Version Info resource file

IF(MSVC)
    SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
    CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
                   "${OPENSCENEGRAPH_VERSIONINFO_RC}")
ENDIF()

################################################################################
# Optional build components

# OSG Applications
OPTION(BUILD_OSG_APPLICATIONS "Enable to build OSG Applications (e.g. osgviewer)" ON)

# OSG Examples
OPTION(BUILD_OSG_EXAMPLES "Enable to build OSG Examples" OFF)

################################################################################
# 3rd Party Dependency Stuff
IF(WIN32 AND NOT ANDROID)
    INCLUDE(Find3rdPartyDependencies)
ENDIF()

IF(ANDROID)
    ANDROID_3RD_PARTY()
ELSE()
# Common to all platforms except android:
    FIND_PACKAGE(FreeType)
    FIND_PACKAGE(Inventor)
    FIND_PACKAGE(Jasper)
    FIND_PACKAGE(OpenEXR)
    FIND_PACKAGE(COLLADA)
    FIND_PACKAGE(FBX)
    FIND_PACKAGE(ZLIB)
    FIND_PACKAGE(Xine)
    FIND_PACKAGE(OpenVRML)
    FIND_PACKAGE(Performer)
    FIND_PACKAGE(GDAL)
    FIND_PACKAGE(GTA)
    FIND_PACKAGE(CURL)
    FIND_PACKAGE(LibVNCServer)
    FIND_PACKAGE(OurDCMTK)
    FIND_PACKAGE(OpenAL)
    FIND_PACKAGE(FFmpeg)
    FIND_PACKAGE(DirectShow)
    FIND_PACKAGE(SDL)
    FIND_PACKAGE(Poppler-glib)
    FIND_PACKAGE(RSVG)
    FIND_PACKAGE(GtkGl)
    FIND_PACKAGE(DirectInput)
    FIND_PACKAGE(NVTT)
ENDIF()

IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8)
    FIND_PACKAGE(ITK)
ENDIF()

# Include macro utilities here
INCLUDE(OsgMacroUtils)

OPTION(OSG_USE_QT "Enable to use Qt (build Qt-dependent libraries, plugins and examples)" ON)

IF(OSG_USE_QT AND NOT ANDROID)
# To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=4
    IF  (DESIRED_QT_VERSION)

        IF  (DESIRED_QT_VERSION MATCHES 4)
              FIND_PACKAGE(Qt4)
        ELSE()
              FIND_PACKAGE(Qt3)
        ENDIF()

    ELSE()

        FIND_PACKAGE(Qt4)

        IF  (NOT QT4_FOUND)
            FIND_PACKAGE(Qt3)
        ENDIF()

    ENDIF()
ENDIF()

#optional example related dependencies
IF   (BUILD_OSG_EXAMPLES AND NOT ANDROID)


    FIND_PACKAGE(FLTK)
    FIND_PACKAGE(GLUT)
    FIND_PACKAGE(FOX)

    SET(wxWidgets_USE_LIBS base core gl net)
    FIND_PACKAGE(wxWidgets)

ENDIF(BUILD_OSG_EXAMPLES AND NOT ANDROID)


# Platform specific:
# (We can approach this one of two ways. We can try to FIND everything
# and simply check if we found the packages before actually building
# or we can hardcode the cases. The advantage of the former is that
# packages that are installed on platforms that don't require them
# will still get built (presuming no compatibility issues). But this
# also means modules that are redundant may get built. For example,
# OS X doesn't need GIF, JPEG, PNG, TIFF, etc because it uses QuickTime.
# Also, it will clutter the CMake menu with "NOT_FOUND".
# The downside to the latter is that it is harder to build those
# potentially redundant modules.)

# Image readers/writers depend on 3rd party libraries except for OS X which
# can use Quicktime.
IF(NOT ANDROID)
    IF(NOT APPLE)
        FIND_PACKAGE(GIFLIB)
        FIND_PACKAGE(JPEG)
        FIND_PACKAGE(PNG)
        FIND_PACKAGE(TIFF)

        # QuickTime is required for OS X, but optional for Windows.
        IF(WIN32)
            FIND_PACKAGE(QuickTime)
        ENDIF()

    ELSE()
        FIND_PACKAGE(QuickTime)
        FIND_PACKAGE(QTKit)
        FIND_PACKAGE(CoreVideo)
    ENDIF()
ENDIF()

################################################################################
# Create bin and lib directories if required

IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
   FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin ${CMAKE_BINARY_DIR}/lib ${CMAKE_BINARY_DIR}/lib/${OSG_PLUGINS})
ENDIF()


################################################################################
# Installation stuff

SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows")
SET(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows")

# Set the build postfix extension according to what configuration is being built.
IF (CMAKE_BUILD_TYPE MATCHES "Release")
    SET(CMAKE_BUILD_POSTFIX "${CMAKE_RELEASE_POSTFIX}")
ELSEIF (CMAKE_BUILD_TYPE MATCHES "MinSizeRel")
    SET(CMAKE_BUILD_POSTFIX "${CMAKE_MINSIZEREL_POSTFIX}")
ELSEIF(CMAKE_BUILD_TYPE MATCHES "RelWithDebInfo")
    SET(CMAKE_BUILD_POSTFIX "${CMAKE_RELWITHDEBINFO_POSTFIX}")
ELSEIF(CMAKE_BUILD_TYPE MATCHES "Debug")
    SET(CMAKE_BUILD_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
ELSE()
    SET(CMAKE_BUILD_POSTFIX "")
ENDIF()

IF(UNIX AND NOT WIN32)
  SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
ENDIF()

IF(CYGWIN)
  SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
ENDIF()

IF(UNIX AND NOT WIN32 AND NOT APPLE)
  IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
      SET(LIB_POSTFIX "64" CACHE STRING "suffix for 32/64 dir placement")
      MARK_AS_ADVANCED(LIB_POSTFIX)
  ENDIF()
ENDIF()
IF(NOT DEFINED LIB_POSTFIX)
    SET(LIB_POSTFIX "")
ENDIF()

# Here we apparantly do some funky stuff with making the bin/ and lib/
# folders which is probably needed to work around a very old CMake bug?

#SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin/${CMAKE_SYSTEM_NAME})
SET(OUTPUT_BINDIR ${PROJECT_BINARY_DIR}/bin)
MAKE_DIRECTORY(${OUTPUT_BINDIR})
IF(MSVC AND NOT MSVC_IDE)
    MAKE_DIRECTORY(${OUTPUT_BINDIR}/${OSG_PLUGINS})
ENDIF(MSVC AND NOT MSVC_IDE)

#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
MAKE_DIRECTORY(${OUTPUT_LIBDIR})
IF(NOT MSVC OR MSVC_IDE)
    MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
ENDIF(NOT MSVC OR MSVC_IDE)

# On CMake 2.4.x use EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH and later
# we work around the DLL placement by use of the PREFIX target property hack
#
# On CMake 2.6.x use the newly minted CMAKE_LIBRARY_OUTPUT_DIRECTORY,
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY &amp;amp; CMAKE_RUNTIME_OUTPUT_DIRECTORY
#
# CMake &amp;gt;= 2.8.1 changed the output directory algorithm (See doc).
# Here we also set per-configuration directories (CMAKE_*_OUTPUT_DIRECTORY_&amp;lt;CONFIG&amp;gt;), or else binaries are generated in /bin/Debug and /bin/Release, etc. with MSVC and Xcode.
# (Doc reads "multi-configuration generators (VS, Xcode) do NOT append a per-configuration subdirectory to the specified directory").
# The workaround for 2.6.x (adding "../" as an output prefix for each target) seem to have no effect in &amp;gt;=2.8.1, so there is no need to change this.
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 5)
    # If CMake &amp;lt; 2.6.0
    SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
    SET(LIBRARY_OUTPUT_PATH    ${OUTPUT_LIBDIR})
ELSE()
    # If CMake &amp;gt;= 2.6.0
    SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
    SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
    IF(WIN32)
        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_BINDIR})
    ELSE(WIN32)
        SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR})
    ENDIF(WIN32)

    # Testing CMAKE_VERSION is possible in &amp;gt;= 2.6.4 only
    BUILDER_VERSION_GREATER(2 8 0)
    IF(VALID_BUILDER_VERSION)  # If CMake &amp;gt;= 2.8.1
        FOREACH(CONF ${CMAKE_CONFIGURATION_TYPES})        # For each configuration (Debug, Release, MinSizeRel... and/or anything the user chooses)
            STRING(TOUPPER "${CONF}" CONF)                # Go uppercase (DEBUG, RELEASE...)
            SET("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
            SET("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
            IF(WIN32)
                SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_BINDIR}")
            ELSE()
                SET("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONF}" "${OUTPUT_LIBDIR}")
            ENDIF()
        ENDFOREACH()
    ENDIF(VALID_BUILDER_VERSION)
ENDIF()

#SET(INSTALL_BINDIR OpenSceneGraph/bin)
#SET(INSTALL_INCDIR OpenSceneGraph/include)
#SET(INSTALL_LIBDIR OpenSceneGraph/lib)
#SET(INSTALL_DOCDIR OpenSceneGraph/doc)

################################################################################
# User Options


# Expose CMAKE_INCLUDE_PATH and CMAKE_LIBARY_PATH to the GUI so users
# may set these values without needing to manipulate the environment.
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
# We are proposing that a new variable called CMAKE_PREFIX_PATH be introduced
# to CMake to compliment CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH.
# A formal feature request has been submited to CMake, Bug #4947.
# It is intended for those users who have common prefixes for their INCLUDE
# and LIBRARY locations. So if users have headers in /usr/local/include
# and libraries in /usr/local/lib, the common prefix is /usr/local.
# It should also cover the case where headers and libraries are
# in the same directory.
# Our proposal expects that FIND_* commands will automatically search for
# CMAKE_PREFIX_PATH right after CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH.
# Obviously, since CMake does not currently support this, we must write
# our Find*.cmake modules to explicitly support this. Otherwise, this variable
# will have no impact.
# This is unofficial so this may be removed or changed at anytime.
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths.")

# This is for an advanced option to give aggressive warnings
# under different compilers. If yours is not implemented, this option
# will not be made available.
IF(CMAKE_COMPILER_IS_GNUCXX)
    # To be complete, we might also do GNUCC flags,
    # but everything here is C++ code.
    # -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
    # returns too many hits.
    # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
    # interesting C-specific flag.
    # Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
    # errors instead of warnings for certain issues, including superfluous
    # semicolons and commas, and the use of long long. -fpermissive seems
    # to be the workaround.
    SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)

    # Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors


ELSE()
    IF(MSVC)
        # FIXME: What are good aggressive warning flags for Visual Studio?
        # And do we need to further subcase this for different versions of VS?
        # CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
        SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)


    ELSE()
        # CMake lacks an elseif, so other non-gcc, non-VS compilers need
        # to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
        # remain unset.
    ENDIF()
ENDIF()

# This part is for the CMake menu option to toggle the warnings on/off.
# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
IF(OSG_AGGRESSIVE_WARNING_FLAGS)

    IF (APPLE)
        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS OFF)
    ELSE()
        SET(DEFAULT_USE_AGGRESSIVE_WARNINGS ON)
    ENDIF()

    OPTION(OSG_USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" ${DEFAULT_USE_AGGRESSIVE_WARNINGS})
    MARK_AS_ADVANCED(OSG_USE_AGGRESSIVE_WARNINGS)

    IF(OSG_USE_AGGRESSIVE_WARNINGS)
        # Add flags defined by OSG_AGGRESSIVE_WARNING_FLAGS if they aren't already there
        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
            IF(NOT CMAKE_CXX_FLAGS MATCHES "${flag}")
                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
            ENDIF()
        ENDFOREACH()
    ELSE()
        # Remove all flags considered aggresive
        FOREACH(flag ${OSG_AGGRESSIVE_WARNING_FLAGS})
            STRING(REGEX REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
        ENDFOREACH()
    ENDIF()
ENDIF()


# Dynamic vs Static Linking
OPTION(DYNAMIC_OPENSCENEGRAPH "Set to ON to build OpenSceneGraph for dynamic linking.  Use OFF for static." ON)
IF   (DYNAMIC_OPENSCENEGRAPH)
    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "SHARED")
ELSE ()
    SET(OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC "STATIC")
ENDIF()


# OSG Core
ADD_SUBDIRECTORY(src)

IF   (BUILD_OSG_APPLICATIONS AND NOT ANDROID)
    ADD_SUBDIRECTORY(applications)
ENDIF()

IF   (BUILD_OSG_EXAMPLES)
    ADD_SUBDIRECTORY(examples)
ENDIF()


IF(APPLE)

        #Here we check if the user specified IPhone SDK
    IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)

        #set iphone arch and flags taken from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
        IF(OSG_BUILD_PLATFORM_IPHONE)
            SET(CMAKE_OSX_ARCHITECTURES "armv7" CACHE STRING "Build architectures for iOS" FORCE)
            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=4.0 -mno-thumb -arch armv7 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
        ELSE()
            #simulator uses i386 architectures
            SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for iOS Simulator" FORCE)
            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-thumb -arch i386 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
        ENDIF()

        #here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two seperate projects
        SET(CMAKE_OSX_SYSROOT "${IPHONE_SDKROOT}" CACHE STRING "System root for iOS" FORCE)

        #hack, force link to opengles
        set(CMAKE_EXE_LINKER_FLAGS "-framework Foundation -framework OpenGLES")

        #use the IPhone windowing system
        SET(OSG_WINDOWING_SYSTEM "IOS" CACHE STRING "Forced IPhone windowing system on iOS"  FORCE)
        SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for iOS" FORCE)

        #I think this or similar will be required for IPhone apps
        OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" ON)

    ELSE()

        # Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
        # and 32/64-bit Intel/PPC on &amp;gt;= 10.5. Anything &amp;lt;= 10.3 doesn't support.

        # These are just defaults/recommendations, but how we want to build
        # out of the box. But the user needs to be able to change these options.
        # So we must only set the values the first time CMake is run, or we
        # will overwrite any changes the user sets.
        # FORCE is used because the options are not reflected in the UI otherwise.
        # Seems like a good place to add version specific compiler flags too.
        IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
            IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7")
                SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
                # 64 Bit Works, PPC is not supported any more
                SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
            ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.6" /
                   ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.5")
                SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
                # 64-bit compiles are not supported with Carbon. 
                SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
            ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.4")
                SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
                SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
            ELSE()
                # No Universal Binary support
                # Should break down further to set the -mmacosx-version-min,
                # but the SDK detection is too unreliable here.
            ENDIF()
        ENDIF()

        OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)

    ENDIF()

ENDIF(APPLE)


# For Doxygen
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
# To build the documention, you will have to enable it
# and then do the equivalent of "make DoxygenDoc".
IF(BUILD_DOCUMENTATION)

    OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
    IF(BUILD_REF_DOCS_SEARCHENGINE)
        SET(SEARCHENGINE YES)
    ELSE()
        SET(SEARCHENGINE NO)
    ENDIF()

    OPTION(BUILD_REF_DOCS_TAGFILE "Generate a tag file named osg.tag on the documentation web server" OFF)
    IF(BUILD_REF_DOCS_TAGFILE)
        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg.tag")
    ELSE()
        SET(GENERATE_TAGFILE "")
    ENDIF()

    IF(DOT)
        SET(HAVE_DOT YES)
    ELSE()
        SET(HAVE_DOT NO)
    ENDIF()

    # If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
    SET(GENERATE_HTMLHELP "NO")
    IF(DOCUMENTATION_HTML_HELP)
        # on windows Documentation.cmake finds the html help workshop if it exists. On u*ix we might have it with wine but no way to point it out
        IF(NOT WIN32)
            SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
            MARK_AS_ADVANCED(HTML_HELP_COMPILER)
        ENDIF()
        # this var sets a proper value in .doxygen files when configuring them below
        SET(GENERATE_HTMLHELP "YES")
    endif()

    # This processes our doxyfile.cmake and substitutes paths to generate
    # a final Doxyfile
    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake
        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
    )
    # copy the osg logo to documentations target folder
    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
        ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs/osg32-32.png COPYONLY
    )
    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenSceneGraphReferenceDocs DESTINATION doc COMPONENT openscenegraph-doc)

    # now set up openthreads documentation generation
    IF(BUILD_REF_DOCS_TAGFILE)
        SET(GENERATE_TAGFILE "${OpenSceneGraph_BINARY_DIR}/doc/OpenThreadsReferenceDocs/ot.tag")
    ENDIF()

    # This processes our openthreads.doxyfile.cmake and generate a final doxyfile
    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/openthreads.doxyfile.cmake
        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
    )
    # copy the osg logo to documentations target folder
    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/PlatformSpecifics/Windows/icons/src/osg32-32.png
        ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs/osg32-32.png COPYONLY
    )
    #INSTALL(FILES ${PROJECT_BINARY_DIR}/doc/${PROJECT_NAME}ReferenceDocs-${OPENSCENEGRAPH_VERSION}.chm DESTINATION doc OPTIONAL COMPONENT openscenegraph-doc)
    INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/OpenThreadsReferenceDocs DESTINATION doc COMPONENT openthreads-doc)

    # Process our other doxyfiles but don't create targets for these
    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/all_Doxyfile
        ${PROJECT_BINARY_DIR}/doc/all_Doxyfile)
    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/auto_Doxyfile
        ${PROJECT_BINARY_DIR}/doc/auto_Doxyfile)
    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile
        ${PROJECT_BINARY_DIR}/doc/core_Doxyfile)

    # This creates a new target to build documentation.
    # It runs ${DOXYGEN} which is the full path and executable to
    # Doxygen on your system, set by the FindDoxygen.cmake module
    # (called by FindDocumentation.cmake).
    # It runs the final generated Doxyfile against it.
    # The DOT_PATH is substituted into the Doxyfile.
    ADD_CUSTOM_TARGET(doc_openscenegraph ${DOXYGEN}
        ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
    )
    SET_TARGET_PROPERTIES(doc_openscenegraph PROPERTIES FOLDER "Documentation")

    ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN}
        ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
    )
    SET_TARGET_PROPERTIES(doc_openthreads PROPERTIES FOLDER "Documentation")
ENDIF(BUILD_DOCUMENTATION)

OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
IF(BUILD_DASHBOARD_REPORTS)
# The following are required to uses Dart and the Cdash dashboard
# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
    INCLUDE(Dart)
ENDIF()

# present the packaging option only if we have the cpack command defined (effectively &amp;gt;= 2.6.0)
IF(CMAKE_CPACK_COMMAND)
    OPTION(BUILD_OSG_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF)
    IF(BUILD_OSG_PACKAGES)
      INCLUDE(OsgCPack)
    ENDIF()
ENDIF()

# Generate pkg-config configuration files

SET(PKGCONFIG_FILES
  openscenegraph
  openscenegraph-osg
  openscenegraph-osgDB
  openscenegraph-osgFX
  openscenegraph-osgGA
  openscenegraph-osgParticle
  openscenegraph-osgSim
  openscenegraph-osgText
  openscenegraph-osgUtil
  openscenegraph-osgTerrain
  openscenegraph-osgManipulator
  openscenegraph-osgViewer
  openscenegraph-osgWidget
  openscenegraph-osgShadow
  openscenegraph-osgAnimation
  openscenegraph-osgVolume
)

IF(QT4_FOUND)
  SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt)
ENDIF(QT4_FOUND)

FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
  CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
    ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc
    &amp;lt; at &amp;gt;ONLY
    )
  INSTALL(FILES ${PROJECT_BINARY_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc DESTINATION lib${LIB_POSTFIX}/pkgconfig COMPONENT libopenscenegraph-dev)
ENDFOREACH(PKGCONFIG_FILE)


# Run this as late as possible so users can easier spot the message
IF (NOT DEFINED REQUIRES_LIBPATH_MESSAGE AND ${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
    SET(REQUIRES_LIBPATH_MESSAGE ON)
ENDIF()

IF(REQUIRES_LIBPATH_MESSAGE)
    IF (NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)
        SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")

        MESSAGE("\nThe build system is configured to install libraries to ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX}\n"
            "Your applications may not be able to find your installed libraries unless you:\n"
            "    set your LD_LIBRARY_PATH (user specific) or\n"
            "    update your ld.so configuration (system wide)")
        IF(IS_DIRECTORY /etc/ld.so.conf.d)
            MESSAGE("You have an ld.so.conf.d directory on your system, so if you wish to ensure that\n"
                "applications find the installed osg libraries, system wide, you could install an\n"
                "OpenSceneGraph specific ld.so configuration with:\n"
                "    sudo make install_ld_conf\n")
            CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in
                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
            )
            ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
                ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
                /etc/ld.so.conf.d/openscenegraph.conf
                COMMAND ldconfig
                COMMENT "Copying openscenegraph.conf to /etc/ld.so.conf.d and running ldconfig"
            )
        ELSE()
            IF(EXISTS /etc/ld.so.conf)
                MESSAGE("You have an ld.so.conf file in /etc, if you wish to ensure \n"
                "that applications find the installed osg libraries, system wide, you\n"
                "could add ${CMAKE_INSTALL_PREFIX}/lib${LIB_POSTFIX} to it.")
            ENDIF()
        ENDIF()

        # emit a message during installation.
        INSTALL(CODE "MESSAGE(\"Libraries were installed to ${CMAKE_INSTALL_PREFIX}lib${LIB_POSTFIX}.\\nYou may need to update your ld.so configuration. \")")

    ENDIF(NOT OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE)

ELSE()
    SET(OSG_LIBPATH_MESSAGE_HAS_BEEN_RUN_BEFORE 0 CACHE INTERNAL "Flag to track whether the libpath message has been reported before")
ENDIF()


# This needs to be run very last so other parts of the scripts can take
# advantage of this.
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
    SET(OSG_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before")
ENDIF()

#-----------------------------------------------------------------------------
### uninstall target
#-----------------------------------------------------------------------------
CONFIGURE_FILE(
  "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  IMMEDIATE &amp;lt; at &amp;gt;ONLY)
ADD_CUSTOM_TARGET(uninstall
  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

#
IF(ANDROID)
    message(STATUS "Creating Android Makefile Master files" )
    configure_file("${OSG_ANDROID_TEMPLATES}/Android.mk.master.in" "${CMAKE_BINARY_DIR}/Android.mk")
    configure_file("${OSG_ANDROID_TEMPLATES}/Application.mk.master.in" "${CMAKE_BINARY_DIR}/Application.mk")
    configure_file("${OSG_ANDROID_TEMPLATES}/AndroidManifest.xml.master.in" "${CMAKE_BINARY_DIR}/AndroidManifest.xml")
ENDIF(ANDROID)

_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Thomas Hogarth</dc:creator>
    <dc:date>2012-05-14T23:16:52</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10568">
    <title>a few nvtt fixes</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10568</link>
    <description>&lt;pre&gt;hi robert,
attached are a few nvtt fixes for the latest nvtt, osg(r13078), and osx.
bob

&lt;/pre&gt;</description>
    <dc:creator>Bob Kuehne</dc:creator>
    <dc:date>2012-05-05T19:18:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10567">
    <title>osgText bugs</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10567</link>
    <description>&lt;pre&gt;Hi,
I’ve run into three bugs with osgText.cpp with OSG 3.0.1.

The first happens when you use setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT); and you place text in any plane other than osgText::Text::XY_PLANE  The essence of the issue is the auto-sizing code doesn’t work correctly for text in any plane other than XY_PLANE.  I’ve attached the program and a screen shot showing the problem. The fix was simply scaling all 3 dimensions instead of just X and Y.

The second showed up with using osgText::Text::FILLEDBOUNDINGBOX draw mode with osgText::TextLYGON_OFFSET backdropImplementation with a osglygonOffset stateAttribute attached.   osgText.cpp wasn’t respecting the PolygonOffset in the current State.   I also noticed some incorrect values in a couple glPushAttrib calls.

I’ve attached a patch file generated by SVN.

Thanks,
John.#include &amp;lt;osg/Geode&amp;gt;
#include &amp;lt;osgViewer/Viewer&amp;gt;
#include &amp;lt;osgGA/TrackballManipulator&amp;gt;
#include &amp;lt;osgText/Text&amp;gt;

void main(int argc, char*argv[])
{
    osgText::Text* text = new osgText::Text;
    text-&amp;gt;setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
    text-&amp;gt;setAxisAlignment(osgText::Text::XZ_PLANE);
    text-&amp;gt;setFont(osgText::readFontFile("fonts/arial.ttf"));
    text-&amp;gt;setFontResolution(32,32);
    text-&amp;gt;setCharacterSize(1.f);
    text-&amp;gt;setText("text");

    osg::Geode* root = new osg::Geode;
    root-&amp;gt;addDrawable(text);

    osgGA::TrackballManipulator* manip = new osgGA::TrackballManipulator;
    manip-&amp;gt;setHomePosition(osg::Vec3(0,-3,0),osg::Vec3(0,0,0),osg::Vec3(0,0,1));

    osgViewer::Viewer viewer;
    viewer.setUpViewInWindow(16,32,640,480);
    viewer.setCameraManipulator(manip);
    viewer.setSceneData(root);
    viewer.run();
}_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>John Swan-Stone</dc:creator>
    <dc:date>2012-05-05T01:15:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10566">
    <title>Add key binding help for osgmanipulator</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10566</link>
    <description>&lt;pre&gt;Add key bindings to the help and add on-screen help for osgmanipulator to make it easier to figure out how to activate the draggers.

Modified from r13078.
--
Bryan Thrall
Principal Software Engineer
FlightSafety International
bryan.thrall-A7WBat7Xm6L28lPXxEEMUQ&amp;lt; at &amp;gt;public.gmane.org
  


_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Thrall, Bryan</dc:creator>
    <dc:date>2012-05-03T20:09:55</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10563">
    <title>Text3D vertical layout lines count</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10563</link>
    <description>&lt;pre&gt;Good day!

Could you pls consider a change to text3D implementation:
In case of VERTICAL layout we use linelength variable but never increase its value during charcode iterations.
What I suggest:


Code:
diff --git a/3rdparty/osg/OpenSceneGraph/src/osgText/Text3D.cpp b/3rdparty/osg/OpenSceneGraph/src/osgText/Text3D.cpp
index a4ae866..e7c2108 100644
--- a/3rdparty/osg/OpenSceneGraph/src/osgText/Text3D.cpp
+++ b/3rdparty/osg/OpenSceneGraph/src/osgText/Text3D.cpp
&amp;lt; at &amp;gt;&amp;lt; at &amp;gt; -362,6 +362,7 &amp;lt; at &amp;gt;&amp;lt; at &amp;gt; void Text3D::computeGlyphRepresentation()
previous_charcode = charcode;
}
+linelength++;
}
}
else





Modified Text3D.cpp attached.

Cheers,
Mihail

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47323#47323




Attachments: 
http://forum.openscenegraph.org//files/text3d_438.cpp
&lt;/pre&gt;</description>
    <dc:creator>Mihail Baranov</dc:creator>
    <dc:date>2012-04-26T15:24:04</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10559">
    <title>MeshOptimizer IndexMeshVisitor</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10559</link>
    <description>&lt;pre&gt;Hi Robert,

I added a method to force the index mesh visitor to rebuild index of geometry even if it's already indexed. It's because the optimizer convert any polygons primitives to indexed triangles so It's easier to reuse this optimizer instead of rewriting a specific Optimizer that will do that.




Cedric Pinson
Provide OpenGL, WebGL services
+33 659 598 614 - 
http://cedricpinson.com - http://osgjs.org - http://sketchfab.com

_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Cedric Pinson</dc:creator>
    <dc:date>2012-04-23T15:02:57</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10552">
    <title>Patch to .png Writer to support 16bpp and Depthas greyscale</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10552</link>
    <description>&lt;pre&gt;This patch modifies ReaderWriterPNG.cpp to 
1. Check the bit depth of the passed Image and return an error if not 8 or 16. (not fully featured, but still an improvement over hard coded 8bit for everything)
2. Detect GL_DEPTH_COMPONENT pixelFormat and write it as greyscale.
3. Endian swap 16bit image data when on a little endian architecture.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47178#47178




Attachments: 
http://forum.openscenegraph.org//files/readerwriterpng_176.cpp
&lt;/pre&gt;</description>
    <dc:creator>John Kaniarz</dc:creator>
    <dc:date>2012-04-20T18:35:25</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10537">
    <title>Save some memory for loading ac3d models.</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10537</link>
    <description>&lt;pre&gt;
Hi Robert,

Attached is a change to the ac3d model loader as of rev 11498, that uses 
indexed draws instead of plain array draws to save some amount of main memory.
Draw performance does not change with the nvidia binary blob as well as with 
the open source drivers.

Please apply,

Thanks!

Mathias_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Mathias Fröhlich</dc:creator>
    <dc:date>2012-04-18T17:36:16</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10535">
    <title>Group::removeAllChildren()</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10535</link>
    <description>&lt;pre&gt;Hi Robert,

attaching submision of osg::Group::removeAllChildren()
as I am often removing all the children of a group when restructuring the 
scene graph. This simplifies complex commands like:

appSingleton-&amp;gt;getCurrentModel()-&amp;gt;removeChildren(0, appSingleton-

to much nicer and more readable (and more quickly typeable):

appSingleton-&amp;gt;getCurrentModel()-&amp;gt;removeAllChildren();

If you like the submission, you can merge it.
John_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>PCJohn</dc:creator>
    <dc:date>2012-04-18T14:46:25</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10528">
    <title>add osg::[Array]Vec{2,3,4}{i,ub,ui,us} type</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10528</link>
    <description>&lt;pre&gt;Hi Robert,

Here new type that could be usefull with new Integer
VertexAttrib{I,L}Pointer.

Cheers
David
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>David Callu</dc:creator>
    <dc:date>2012-04-17T19:51:30</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10527">
    <title>setVertexAttribLPointer andsetVertexAttribIPointer</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10527</link>
    <description>&lt;pre&gt;Hi Robert,


Here a patch to provide glVertexAttribLPointer and glVertexAttribIPointer
in OSG.

I add in Geometry an enum

        enum AttributeType
        {
            FLOAT,
            INTEGER,
            DOUBLE
        };

and a variable to ArrayData "osg::Geometry::ArrayData::AttributeType type"
to specify which kind of data we want to give to OpenGL.
default value if FLOAT


Cheers
David
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>David Callu</dc:creator>
    <dc:date>2012-04-17T19:46:17</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10526">
    <title>PrimitiveSet improve</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10526</link>
    <description>&lt;pre&gt;Hi Robert,


PrimitiveSet can use multiple instance but If I need to use the same
PrimitiveSet with different number of instance,
I have to duplicate the PrimitiveSet and potentially use many memory just
for one integer.

I submit a new function that allow user to specify how many instance to
draw on draw call.

void osg::PrimitiveSet::draw(State&amp;amp; state, bool useVertexBufferObjects,
unsigned int numInstances);


Cheers
David
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>David Callu</dc:creator>
    <dc:date>2012-04-17T19:37:06</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10525">
    <title>Uniform Matrix fix</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10525</link>
    <description>&lt;pre&gt;Hi Robert,

Here the fix for Matrix{2,3,4}x{2,3,4}{fd} defined in Uniform header.

My previous patch for Atomic Counter Uniform provide new template
implementation
of Matrix{2,3,4}x{2,3,4}{fd}. This new implementation use Column-Major
Matrix.
Original code define matrix as Row-Major matrix like other Matrix in OSG,
and
my matrix implementation break compatibility with previous code.
For example osg_normalMatrix define in osg::State report by Roland Hill.
Thanks to Paul Martz to spot me when the bug appear.

Cheers
David
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>David Callu</dc:creator>
    <dc:date>2012-04-17T19:28:02</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10524">
    <title>osg-android makefiles update</title>
    <link>http://comments.gmane.org/gmane.comp.graphics.openscenegraph.cvs/10524</link>
    <description>&lt;pre&gt;Mostly small changes to add more compile options, and shared linking (still
testing that capability, but this enables on a compile basis if the user
wants). Robert, when you give the Ok I'll update/rewrite the Android
section in the old/new wiki you'll say where is better. Mostly to be clear
for the future users what options can configure and what are their purpose.

Cheers.
_______________________________________________
osg-submissions mailing list
osg-submissions-ZwoEplunGu0hajLcUbyfC12AsgEQdTeF&amp;lt; at &amp;gt;public.gmane.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
&lt;/pre&gt;</description>
    <dc:creator>Jorge Izquierdo Ciges</dc:creator>
    <dc:date>2012-04-17T11:20:40</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.graphics.openscenegraph.cvs">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.graphics.openscenegraph.cvs</link>
  </textinput>
</rdf:RDF>

