[[TracNav(TracNav/TOC)]] = 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 == * Install CMAKE from http://www.cmake.org/cmake/resources/software.html * Download OSG sources * Download prebuild 3rdParty libraries from http://www.openscenegraph.org/projects/osg/wiki/Downloads/Dependencies . '''Attention: Use the right version for your compiler, the wrong version can cause unpredicatlbe linking and runtime errors! ''' * Download the example data from http://www.osgvisual.org/projects/osgvisual/wiki/Downloads == 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.9_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.9_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 followin 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.9_x86 || Root folder of the 32 bit OSG build || || OSG_ROOT_X64 || D:\OpenSceneGraph\OpenSceneGraph-2.9.9_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 {{{ #!sh gdal-1.6.x - bin - include - data - lib }}} * If you have compiled successfully, populate this directories: || data || Content from SDK-Package//data || || include || All includes files from SDK-Package/ -- 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: * CMAKE starten und Sourcecode wählen * Sourcecode Verzeichnis: D:/OpenSceneGraph/OpenSceneGraph-2.9.9 * Build Binaries Verzeichnis: D:/OpenSceneGraph/OpenSceneGraph-2.9.9 * Optionen für gewähltes Sourcecodeverzeichnis einstellen * ACTUAL_3RDPARTY_DIR D:/OpenSceneGraph/3rdparty * CMAKE_INSTALL_PREFIX D:/OpenSceneGraph/OpenSceneGraph-2.9.9 * BUILD_MFC_EXAMPLES true (Diese Option erscheint erst, wenn BUILD_OSG_EXAMPLE auf true gesetzt wurde und einmal ein "Configure" ausgeführt wurde) * BUILD_WRAPPER true * configure ausführen, bei Fehlern diese beseitigen * Generate ausführen -> MS Visual Studio Solution wird erzeugt * D:/OpenSceneGraph/OpenSceneGraph-2.9.8 betreten und !OpenSceneGraph.sln öffnen * BUILD_ALL einmal als Debug und einmal als Release kompilieren ( Bei Fehlern immer wieder OHNE Aufräumen kompilieren bis alle Fehler weg sind und der Compile gelingt) Finished! :) == Troubleshooting & Tips == * If you have problems with linking against wldap32.lib, read [http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg20490.html this article].