wiki:OsgVbpBuildEnvWindows

Version 12 (modified by Torben Dannhauer, 14 years ago) (diff)

--

OSG & VPB Build Environment in Windows as Step-By-Step Tutorial

This HowTo shows one solution to create a good working OSG build environment on a windows operating system.

Prerequisites

Directory structure

The directory structure will be explaned on an example installation on drive D: :

Directory Content Source
D:\OpenSceneGraph Root folder of the OSG framework -
D:\OpenSceneGraph\gdal-1.6.x gdal-1.6.x Download precompiled from http://www.osgvisual.org/projects/osgvisual/wiki/Downloads
D:\OpenSceneGraph\3rdParty Folder containing the 3rdParty libraries in the subfolders x86 and x64 Download from http://www.osgvisual.org/projects/osgvisual/wiki/Downloads
D:\OpenSceneGraph\Data Models and pictures for the OSG examples http://www.osgvisual.org/projects/osgvisual/wiki/Downloads
D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x86 Folder containing the real osg framework compiled as 32 bit with its subfolders (bin lib include etc.) Download newest version vom SVN trunk
D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x64 Folder containing the real osg framework compiled as 64 bit with its subfolders (bin lib include etc.) Download newest version vom SVN trunk
D:\OpenSceneGraph\VirtualPlanetBuilder Folder for the VirtualPlanetBuilder installation. Download newest version from SVN trunk

Setting Environment variables

The following enviroment variables are required:

Env Variable Content Explanation
OSG %OSG_ROOT%\bin;D:\OpenSceneGraph\3rdParty_x86_x64\x86\bin\; Binary files of OSG and the 3rdparty
OSG_X64 %OSG_ROOT_X64%\bin;D:\OpenSceneGraph\3rdParty_x86_x64\x64\bin\; Binary files of OSG and the 3rdparty in 64 bit
OSG_FILE_PATH D:\OpenSceneGraph\Data;D:\OpenSceneGraph\Data\Images Path to the example data files
OSG_NOTIFY_LEVEL WARN Notify level for the console output
OSG_ROOT D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x86 Root folder of the 32 bit OSG build
OSG_ROOT_X64 D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x64 Root folder of the 64 bit OSG build
PATH %PATH%;%OSG%;OSG_X64 extend the PATH with the OSG binary pathes to start osg from konsole. Add both architectures, but at first the one you want to use for in-source debugging.

[optional ] compile GDAL

It is possible to use the prebuild GDAL binaries from http://www.osgvisual.org/projects/osgvisual/wiki/Downloads

  • Download GDAL SDK-Package (bottom of the page) from http://vbkto.dyndns.org/sdk/
  • Open in VS2008 SP1 and compile.
  • Create new gdal directory structure
    gdal-1.6.x
     - bin
     - include
     - data
     - lib
    
  • If you have compiled successfully, populate this directories:
data Content from SDK-Package/<GDAL>/data
include All includes files from SDK-Package/<GDAL> -- cpl_config.h will reside in different folders with different size, use the bigger one.
bin Copy all .exe and.dll into this directory
lib Copy gdal_i.lib into this directory
  • Delete your downloaded SDK to avoid that cmake will found this folder instead your build.

Compile OSG

The steps to build OSG are:

  • Start CMAKE and select source code
    • Sourcecode Folder: e.g. D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x86
    • Build Binaries Folder: e.g. D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x86
  • Select the following options:
    • ACTUAL_3RDPARTY_DIR D:\OpenSceneGraph\3rdParty\x86
    • CMAKE_INSTALL_PREFIX D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x86
    • BUILD_MFC_EXAMPLES On the architecture you want to use for in source debugging, use false, for the other true. (This option only appeares after setting BUILD_OSG_EXAMPLE true and configure at least one time)
  • Press Configure. On errors, correct them
  • Press Generate -> MS Visual Studio Solution will be created
  • Enter D:\OpenSceneGraph\OpenSceneGraph-2.9.10_x86 and open OpenSceneGraph.sln
  • Run BUILD_ALL as Debug Build as well as Release Build (On error retry building several times without cleaning up. Sometimes only the wrong order of the dependencies is the reason)

In my setup, I use the 32 bit build to debug my application in the OSG source. Therefore I have to add my MSVC project to the OpenSceneGraph VS Solution. To reduce the complexity in the MSVC solution, I do not build the OSG examples in the x86 build. To make all examples (x64) available in the console, I add %OSG_X64% after %OSG% to the PATH variable.

Finished! :)

Troubleshooting & Tips

  • If you have problems with linking against wldap32.lib, read this article.